Re: support for BookE hardware debug features

Thiago Jung Bauermann
2009-03-03T19:32:25Z

El lun, 02-03-2009 a las 12:55 -0800, Joel Brobecker escribiÃ³:
> > - support for the two DVCs (Data Value Compare), which enable
> > hardware-accelerated conditions for hardware watchpoints,
>
> This sounds like an interesting feature. Certain versions of VxWorks
> now come with a feature that's slightly comparable. I don't believe
> that the target really had DVC, but the kernel made it look that way.
> The purpose is to avoid having a lot of communication between the
> debugger and the target when the hardware value check is a simple 32bit
> value compare.

Nice to know that there are other targets with a similar feature.

> > We don't know yet how we'll extend gdb commands to express the ranged
> > breakpoints and watchpoints, and the DVCs. For the latter maybe we can
> > add some intelligence to use the registers if the condition expression
> > is simple enough, I didn't think much about this yet.
>
> When I looked at extending GDB for this, the feedback I got from the
> users is that they didn't want to have a special syntax to activate
> the feature. So I had to hack into condition evaluation code to
> add a target-specific feature that would inspect the expression tree
> and identify simple cases where DVC could be used.
>
> It wasn't all that pretty, but it remained a reasonable approach
> because we restricted ourselves to a selected number of expressions:
>
> (gdb) watch * if * BINOP_EQUAL <litteral>
> (gdb) watch <variable> if <variable> BINOP_EQUAL <litteral>
>
> For illustration, I fished the code out from one of our old trees.
> I'm not sure whether this is really a viable approach for you or not.
> The thing is, I don't see any other except maybe formalizing a little
> bit more how DVC would work and push some of the tree-inspection code
> up in the core.

I was thinking about something along those lines too. Possibly adding a
target hook which would receive a struct expression with the condition
and a watchpoint address, and return true if it can be
hardware-accelerated. That hook would also set up the hardware debug
registers accordingly.

Since there is at least one other target (VxWorks, as you say) which
would also benefit from the hook, this seems to be a good option, what
do you think?

Regarding what is a viable approach, our main concern is that we do it
in a way which will be accepted upstream.

> static int
> watch_star_address_if_star_address_equal_literal_p (struct breakpoint *b,
> TGT_ARG_T *data_value)

Thanks for sharing this code, by the way. Just a question to be on the
safe side: is there any copyright implication if we stare at it for too
long (half-joking)?