C++ Debuggers
GDB, LLDB, rr (time-travel), and WinDbg — compared across platform support, IDE integration, scripting, and reverse execution.
Quick pick
Feature comparison
| Feature | GDB | LLDB | rr | WinDbg |
|---|---|---|---|---|
| Reverse/time-travel | ||||
| Python scripting | ||||
| STL pretty-printers | ||||
| RTOS thread awareness | ||||
| Core dump analysis | ||||
| Remote debugging | ||||
| Linux | ||||
| macOS | Homebrew | |||
| Windows | MinGW/MSYS2 | Limited | ||
| Embedded | Via LLDB-server |
The universal Linux debugger. Runs everywhere, understands everything, scripted via Python.
Strengths
- Universal — works on every Linux architecture
- Python scripting API — automate complex debug sessions
- STL pretty-printers for readable std::vector / std::map
- Remote debugging via gdbserver
- RTOS awareness (FreeRTOS, Zephyr threads)
- Core dump analysis
Weaknesses
- CLI-centric — IDE integration varies in quality
- Slower than LLDB for large symbol sets
- No time-travel (use rr on top of GDB for that)
Faster startup, better C++ expression evaluation, macOS/iOS native, VS Code default via CodeLLDB.
Strengths
- Faster startup and symbol loading than GDB
- Superior C++ expression evaluation (Clang frontend)
- Native macOS/iOS debugger (Xcode uses LLDB)
- Python scripting + SBDebugger API
- CodeLLDB: best VS Code debug experience
- Better DWARF parsing speed
Weaknesses
- Windows support is limited (use WinDbg on Windows)
- Fewer RTOS plugins than GDB
- Some GDB commands differ in syntax
Record once, replay deterministically forever. The only practical tool for Heisenbugs.
Strengths
- Time-travel debugging — step backwards through execution
- Deterministic replay — reproduce flaky bugs 100%
- Works as a GDB front-end — GDB commands still work
- Pernosco integration for team collaborative debugging
- No code changes required — record any binary
Weaknesses
- Linux-only (requires hardware perf counters)
- Recording overhead (~1.5-3× slower)
- No multi-process or GPU debugging
- Incompatible with some hardware-level events
Essential for Windows kernel debugging, crash dumps, and COM/WinRT. Nothing else comes close on Windows.
Strengths
- Only real option for Windows kernel debugging
- TTD (Time Travel Debugging) built-in
- Best Windows crash dump analysis
- DML extensions for rich output
- JavaScript scripting (WinDbg Preview)
Weaknesses
- Windows-only
- Steep learning curve for WinDbg scripting
- Not useful for Linux/macOS targets
Essential commands cheatsheet
GDB
| Command | Action |
|---|---|
| b main | Breakpoint at main |
| r [args] | Run with args |
| n / s | Next / step-into |
| fin | Finish current function |
| bt | Backtrace (call stack) |
| p expr | Print expression |
| watch var | Watchpoint on var |
| info threads | List threads |
| thread N | Switch to thread N |
| x/10xw &arr | Examine memory |
rr (time-travel)
| Command | Action |
|---|---|
| rr record ./app | Record execution |
| rr replay | Start replay (opens GDB) |
| reverse-continue | Run backwards to prev event |
| reverse-next | Step backward |
| reverse-step | Step-into backward |
| reverse-finish | Return to caller (backwards) |
| watch -l var | Watchpoint: any write to var |
| rr ps | List recorded traces |
Deep-dive guides
"GDB reference for C++ developers: breakpoints, watchpoints, stack inspection, STL pretty-printing, TUI mode, and scripting."
LLDB debugger for C++ — essential commands, breakpoints, watchpoints, expression evaluation, Python scripting, and LLDB vs GDB command mapping.
rr (Record and Replay) reference: recording executions, replaying deterministically, reverse debugging, and catching intermittent bugs.
Valgrind Memcheck, Callgrind, Helgrind, and DRD — detecting memory errors, use-after-free, leaks, data races, and reading Valgrind reports.
WinDbg for C++ developers — crash dump analysis, kernel debugging, TTD time-travel debugging, symbols, SOS, and the dx command.