Delete a watchpoint by address to automate segfault tracking

Tom Tromey tromey@redhat.com
Thu Sep 27 13:39:00 GMT 2012


>>>>> "Laurent" == Laurent G <vrygoud@gmail.com> writes:

Laurent> In the article, the author says "I couldn’t find an easy way to track
Laurent> the memory watch number that was created during the first breakpoint,
Laurent> I just built a gdb counter, and deleted the memory watch when leaving,
Laurent> since I could predict gdb’s numbering" and implements watchpoints
Laurent> destruction this way:

I think $bpnum may hold this.
See the 'Set Breaks' node of the manual.
Or it can perhaps be done from Python.

Laurent> How can I do a "delete *`print $d`" in GDB?

A few ways.

Simplest is to use "eval".

Otherwise, Python.

Otherwise, if you have an old gdb and can't upgrade, use set logging to
write out a file with the command you want (using printf), then 'source'
the file.

Tom



More information about the Gdb mailing list