[Maria-developers] Ever wanted to save/restore your GDB breakpoints? Here's a solution.
Hi, Today I got really annoyed while debugging a server crash with GDB. I never managed to make the same GDB reattach to a new process after a crash. This means that after each crash one has to restart GDB, and reattach to the new process. As a result all breakpoints are lost, and need to be set each time, which is pretty annoying. Today I thought that others might have been equally annoyed, and might have figured a solution. Indeed, Google is our friend, and I found the following short snippet that should be added to .gdbinit: define bsave shell rm -f brestore.txt set logging file brestore.txt set logging on info break set logging off # reformat on-the-fly to a valid gdb command file shell perl -n -e 'print "break $1\n" if /^\d+.+?(\S+)$/g' brestore.txt > brestore.gdb end document bsave store actual breakpoints end define brestore source brestore.gdb end document brestore restore breakpoints saved by bsave end The credits go to this page: http://stackoverflow.com/questions/501486/getting-gdb-to-save-a-list-of-brea... Happy debugging, Timour
Hi, one correction below:
Hi,
Today I got really annoyed while debugging a server crash with GDB. I never managed to make the same GDB reattach to a new process after a crash. This means that after each crash one has to restart GDB, and reattach to the new process.
After writing this, I decided to recheck the above statement, and discovered that the latest GDB (7.1) has fixed this problem. It *is* possible to just detach from a crashed process, and then reattach to a new one.
As a result all breakpoints are lost, and need to be set each time, which is pretty annoying. Today I thought that others might have been equally annoyed, and might have figured a solution. Indeed, Google is our friend, and I found the following short snippet that should be added to .gdbinit:
define bsave shell rm -f brestore.txt set logging file brestore.txt set logging on info break set logging off # reformat on-the-fly to a valid gdb command file shell perl -n -e 'print "break $1\n" if /^\d+.+?(\S+)$/g' brestore.txt > brestore.gdb end document bsave store actual breakpoints end
define brestore source brestore.gdb end document brestore restore breakpoints saved by bsave end
The credits go to this page: http://stackoverflow.com/questions/501486/getting-gdb-to-save-a-list-of-brea...
Happy debugging, Timour
_______________________________________________ Mailing list: https://launchpad.net/~maria-developers Post to : maria-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-developers More help : https://help.launchpad.net/ListHelp
participants (1)
-
Timour Katchaounov