Is it possible to delete a watchpoint without knowing the watchpoint number?
I am using commands attached to a breakpoint to set a watchpoint on a memory location. I would like to have the watchpoint cleared at another breakpoint, but I can't figure out how to clear a watchpoint without the watchpoint number. Is there a command that can delete a watchpoint by memory location?
the easiest way is to use the $bpnum convenience variable, you'll probably want to store it in another convenience variable so it doesn't change when you create breakpoints/watchpoints later on.
(gdb) watch y
(gdb) set $foo_bp=$bpnum
Hardware watchpoint 2: y
(gdb) p $foo_bp
$1 = 2
(gdb) delete $foo_bp