This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
watch -location
- From: Jed Brown <jed at 59A2 dot org>
- To: gdb at sourceware dot org
- Date: Sat, 21 Jan 2012 20:45:14 -0600
- Subject: watch -location
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.)