Automagically setup breakpoints with gdbPosted: November 5, 2013
When you are trying to debug a project you don’t know you’ll probably end up recompiling a few times, then restarting your debugging session. This can be quite frustrating, when you have gdb workset full of breakpoints, watch expressions and all that stuff.
Luckily you can easily restore your state if you just write all the gdb commands you need into a file, then start gdb with “–command=state.gdb”. Magic! All your breakpoints are there.
Alternatively, an even better solution: just don’t exit gdb after recompiling, simply “kill” your currently under-debug process (ie type “kill” inside gdb, do not kill gdb itself!) and gdb will be smart enough to reload your binary if it changed.