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 ./appAll lessons in this course
- Using gdb and lldb
- AddressSanitizer
- UBSan and TSan
- Valgrind Basics