Mail Archives: djgpp-workers/1999/05/27/03:27:35
On Wed, 26 May 1999, I wrote:
> Watchpoints still don't work, at least sometimes, but that is the case
> with Robert's binary (and with GDB 4.16) as well.
It turns out I was wrong. First, the watchpoints in v4.18 do work
better than in 4.16 (I found several cases where the former reported a
hit while the latter didn't). And second, in all the cases I've seen
where GDB 4.18 didn't catch the data access, it was because the
variable was in a register (I debugged an application compiled with
-O2).
I find the following a useful trick when debugging optimized code. If
you want to be sure GDB will catch data accesses to a variable `foo',
try "watch &foo" first; if the variable is in a register, GDB will
complain loudly, and you will know you can't watch that variable.
Btw, FSDB (which I used until now whenever I needed to catch data
accesses) simply refuses to put a data breakpoint on register
variables--you simply cannot get to those variables in FSDB because
specifying their names in the Where-is pane yields nothing.
- Raw text -