watch -location

Jed Brown jed@59A2.org
Sun Jan 22 02:45:00 GMT 2012


I was surprised when I upgraded to 7.3.1 that my common pattern of

(gdb) print &obj->member
$1 = (int *) 0x6fcf04
(gdb) watch *$1

was no longer watching the value at this address. I found that the
changelog mentioned the new -location option, which makes this much
nicer

(gdb) watch -location obj->member
Hardware watchpoint 3: -location obj->member


I like the new method, but why did the old method stop working? It
makes some old debugging documentation incorrect.


I currently see

(gdb) info watchpoints
Num     Type           Disp Enb Address            What
3       hw watchpoint  keep y                      -location obj->member

Could the address of obj->member be printed in this output? It would
be useful for me to distinguish multiple watchpoints set for members
of different objects. (I.e. I set watchpoints twice from the same
scope with the same commands, but with different values of "obj", and
I'd like to be able to distinguish which of these are related other
than to remember which numbers refer to members of which object.)



More information about the Gdb mailing list