OK, info break lists the breakpoints, but not in a format that would work well with reusing them using the --command as in this question. Does GDB have a method for
Extension to the answer from Johannes: you could automatically reformat the output of info break into a valid GDB command file:
.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
Afterwards you have a valid commandfile in brestore.gdb.
This worked for me when the application is compiled with -g.
I also successfully tested it with GDB v6.8 on Ubuntu 9.10 (Karmic Koala).