Debugging - C - C++
Debug Process
- cc -g factorial.c # compile the program with the debugging flag enabled
- gdb a.out # enter the debugger for the compiled binary
- break 10 # set up breakpoint at line number 10
- run # run the program with debugger
- p i # Prints the i variable
- n # step through individual lines (treating function calls as single line)
- s # step through individual lines without treating functions as single instruction
- c # continue executing binary til next breakpoint