Re: Hardware watchpoints; dealing with false triggers?

Eli Zaretskii
2001-12-04T11:43:04Z

On Tue, 4 Dec 2001, Orjan Friberg wrote:

> > > And this is the key issue: could the interface to the target-specific
> > > code be extended to handle the concept of "actual watchpoint address"?
> >
> > We already have this: it's called target_stopped_data_address.
> > breakpoint.c uses this macro to see which watchpoint, if any,
> > triggered.
>
> Also great. Thank you very much for your comments on this, Eli.

I need to correct myself: there's a subtle point I forgot to mention.
The current code only calls target_stopped_data_address for read and
access watchpoints (those set by `rwatch' and `awatch' commands), but not
for regular, i.e. data-write, hardware watchpoints (those set by `watch'
command). Instead, GDB compares the previous and the current value of
the watched expression, and if they differ, it decides that the
corresponding watchpoint triggered, without ever considering the address!

I think it's a bug to do that with hardware watchpoints (as opposed to
software watchpoints), so I'm trying to convince The Powers That Be to
change that (in another thread called "Re: [RFC] Possible bug with i386
watchpoints on several targets", which see). But for now, that's how
the code works. Sorry I failed to mention that in my original message.