Alex Rivera | Logout

GDB breakpoints

Asked 2009-02-01T15:10:23.487
37

I have a list of breakpoints which I want to add each time I debug a particular program.

Is there a way I can put all of the breakpoint information in a file and use it at the start of each debug session? In other words can I provide a script file with breakpoint information to GDB before I give the 'run' command?

Edit
Report

2 Answers

13

Besides using an external file, you can also just keep GDB open: If the binary under GDB changes, it will reload the binary and libraries without losing your breakpoints the next time you run.

answered 2009-02-01T15:20:19.850
3

Or use:

gdb --command=commands.gdb ./a.out

where commands.gdb is a text file with your breakpoints.

--command is probably the same as -x

answered 2009-02-01T15:22:25.350

Your Answer