rr-debugger
Deterministic debugging with rr record-replay. Use when debugging crashes, ASAN faults, or when reverse execution is needed. Provides reverse-next, reverse-step, reverse-continue commands and crash trace extraction.
When & Why to Use This Skill
The rr-debugger Claude skill enables deterministic record-and-replay debugging for software engineering. It allows developers to capture program execution and replay it with full reverse execution capabilities, making it possible to step backward through code to identify the root cause of complex crashes, memory corruption, and non-deterministic bugs.
Use Cases
- 1. Root Cause Analysis for Crashes: Record a program's failure and use reverse-execution commands like 'reverse-next' and 'reverse-step' to trace back from the crash point to the specific line of code that caused the error.
- 2. Debugging ASAN and Memory Faults: Efficiently diagnose AddressSanitizer (ASAN) faults by setting breakpoints at the fault location and stepping backward to find the exact moment of memory corruption.
- 3. Investigating Intermittent Bugs: Capture rare race conditions or non-deterministic bugs in a recording, allowing for consistent, deterministic replay and inspection of variables and memory states at any point in time.
- 4. Automated Execution Tracing: Utilize integrated scripts to automatically extract execution traces leading up to a crash, providing a detailed map of the program's execution path for faster resolution.
| name | rr-debugger |
|---|---|
| description | Deterministic debugging with rr record-replay. Use when debugging crashes, ASAN faults, or when reverse execution is needed. Provides reverse-next, reverse-step, reverse-continue commands and crash trace extraction. |
rr Deterministic Debugger
rr provides deterministic record-replay debugging with full reverse execution capabilities.
Core Workflow
- Record:
rr record <program> [args] - Replay:
rr replay(enters gdb interface with reverse execution)
Reverse Execution Commands
All standard gdb commands work, plus reverse variants:
reverse-next/rn: Step back over function callsreverse-step/rs: Step back into functionsreverse-continue/rc: Continue backward to previous breakpointreverse-stepi/rsi: Step back one instructionreverse-nexti/rni: Step back over one instruction
Crash Trace Extraction
Regular Crashes
After rr record <crashing-program>:
rr replay
# In gdb:
reverse-next 100 # Go back 100 steps (adjust N as needed)
# Now step forward to see execution leading to crash:
next
next
...
ASAN Crashes
After rr record <asan-program>:
rr replay
# In gdb:
bt # View stack trace
up # Issue "up" commands until last app frame (before ASAN runtime)
break *$pc # Set breakpoint at that location
reverse-continue # Go back to last app instruction before ASAN
# Now step forward to see execution leading to fault:
next
next
...
Inspecting Variables and Memory
Standard gdb commands work at any point:
print <var>: Print variable valueprint *<ptr>: Dereference pointerx/<format> <address>: Examine memoryx/10xb <addr>: 10 bytes in hexx/s <addr>: String at address
info locals: Show local variablesinfo args: Show function arguments
Source vs Assembly View
list: Show source code around current locationdisassemble: Show assembly around current locationlayout src: TUI source viewlayout asm: TUI assembly viewset disassemble-next-line on: Show assembly with each step
Automation Script
Use scripts/crash_trace.py to automatically extract execution trace before crash.