The other common debug programs on Unix systems are dbx and dbxtool.
Before a program can be processed by the debugger, it must be compiled with the debugger option.
gcc -ggdb -o pipe pipe.cThe program can then be passed to the debugger with
gdb pipeTo pass command line parameters to the program use:
set args -size bigThis is equivalent to saying:
pipe -size bigTo single step:
break run stepThe step command stops execution at the next source statement, if that statement is a function call, gdb will single step into the function.
step can be abreviated to s
next can be abreviated to n
To set break points:
break 48 <-- Program will stop BEFORE executing line 48 break FuncName <-- Program will stop when entering the function runTo display the contents of a variable:
print antTo change the value of a variable:
set ant = 4 set char = 'z'