0Pricing
C++ Academy · Lesson

Using gdb and lldb

Step through programs.

Interactive Debuggers

gdb (GNU) and lldb (LLVM) let you pause a running program, inspect variables, and step through code line by line. Their commands are similar.

Compile with Debug Info

Always build with -g (and ideally -O0) so the debugger can map machine code back to your source.

g++ -g -O0 main.cpp -o app
# then
gdb ./app

All lessons in this course

  1. Using gdb and lldb
  2. AddressSanitizer
  3. UBSan and TSan
  4. Valgrind Basics
← Back to C++ Academy