Re: ping: Re: PATCH : allow to set length of hw watchpoints (e.g. for Valgrind gdbserver)

Pedro Alves
2011-06-01T15:15:30Z

On Tuesday 31 May 2011 19:06:17, Philippe Waroquiers wrote:
>
> > If that was the only problem, than it'd be okay --- the user just
> > shouldn't use the command then. GDB will just do what the
> > user told it to. But, it looks like the patch changes the
> > behavior _even_ if the user doesn't use the command.
>
> Effectively, the patch changes the behaviour (but I believe in a more
> consistent way). But if that is considered as not good, I can change
> the patch so as to keep by default the old behaviour.

Thinking more about this, I agree. The current default is
making it so that e.g., a single watchpoint on

char s16[16];

is a sofware watchpoint against x86 gdbserver, but
it's a hardware watchpoint against native x86 gdb. gdbserver
knows how to make that a hardware watchpoint, but gdb
is not giving it a chance --- the current default assumes you
can only set a hardware watchpoint on a single word, but that's
not true on x86 gdbserver, given that the target knows to use
more than one debug register for a single watchpoint
if necessary.

> Note that one other thing that I find confusing in the current behaviour
> is that if you have a certain set of hw watchpoints that were accepted
> and you add a new one, you might obtain an error back referencing
> an "old" accepted watchpoint.
>
> I think it would be better if the watchpoints would always be re-inserted
> by gdb in the same order.

I suppose that if we made insert_breakpoint_locations
walk breakpoints by increasing number instead of walking by
breakpoint locations, it'd be good enough.

--
Pedro Alves