The gdb debugger

These notes are by no means comprehensive – for further details, use gdb’s built-in help function.


Compiling to be able to debug:

g++ -g fname – e.g., g++ -g try1.cpp

Running the debugger on the resulting object-file

gdb objFile – e.g., gdb a.out

Debugging functions:

Examining the source code

Running the program

Examining/ changing variables

Setting breakpoints

Additional run commands

 

For further help:

Use gdb’s built-in help feature: type help within gdb to obtain a list of help topics. Full documentation on each gdb function is available three levels down the help hierarchy.