GDB

a debugger for C programming.

to compile stuff I type:

gcc file.c -lm this links the math libraries

to run the debugger:

gcc -g file.c -lm
gdb a.out
run runs the compiled program //
run 62 //runs the compiled program with input 62

l pressing "l" lists the program

pressing return does the same

b 23 puts a break point at line 23

steps through the program line at a time

n

p fnip p means print

You can set variables in the program:

set N=3

p N prints N

To step through each step in a line:

s

When you hit a break to continue:

c

during a loop, for example, you can continue through multiple iterations:

c 10

To delete a break point that the program stops at:

clear

To quit if it's processing things

ctrl + c

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.