On 18.09.2015 13:32, Peter Maydell wrote:
>> +/* Return true if PC matches an installed breakpoint.  */
>> > +static inline bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, int mask)
>> > +{
>> > +    CPUBreakpoint *bp;
>> > +
>> > +    if (unlikely(!QTAILQ_EMPTY(&cpu->breakpoints))) {
>> > +        QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) {
>> > +            if (bp->pc == pc && (bp->flags & mask)) {
>> > +                return true;
>> > +            }
>> > +        }
>> > +    }
>> > +    return false;
>> > +}
> This won't work with the fix for ARM breakpoints Sergey currently has
> on list: http://patchwork.ozlabs.org/patch/517359/
> where we need to behave differently for "there's a GDB breakpoint
> here" and "there's a CPU breakpoint here" (because the complex
> conditions on the latter require us to call a helper function to
> see if we need to actually generate an EXCP_DEBUG exception).
>

This is actually a good idea to move this boilerplate code into a single
function. I think the problem can be solved by simply adding an optional
parameter to get a reference to the matched breakpoint back from this
function.

Best regards,
Sergey

Reply via email to