Tuesday, September 21, 2004
Command Line GDB
You can set a breakpoint, then program a bunch of stuff to happen when the breakpoint fires. The last command in that sequence can be a "continue", so you can do printf debugging without changing the executable!
These are my favorite gdb commands:
p print p structure.element
b break b file:line
c continue c
^c break execution
clear clear break clear file:line
b file:line gives you a breakpoint number e.g., 1
To set the command sequence for break 1:
this sequence prints the contents of structure.element and continues execution.
Copyright (c) 2004 Larry Martin. All Rights reserved.