
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A comprehensive list of basic gdb (gnu debugger) commands for students and developers. Learn how to compile your program with the -g flag, run gdb, set breakpoints, examine source code, and inspect variables. Useful for debugging c++ programs.
Typology: Study notes
1 / 1
This page cannot be seen from the preview
Don't miss anything!

g Compiling your program All source files must be compiled with the -g flag. For example: g++ -g -c main.cc
g Running GDB To run gdb, type: gdb
g To exit from GDB q
g To run your program (possibly after setting some breakpoints) r
g To look at source code l
g Breakpoints b
g To look at and/or change the values of variables p
g Call information bt Show all currently active functions.
g Help information help To see a summary of GDB commands (follow instructions for more detailed information).
g C++ classes and class templates
To refer to a class member function ( e.g. to look at the source code or to set a breakpoint) use: