$npx -y skills add gadievron/raptor --skill rr-debuggerDeterministic 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.
| 1 | # rr Deterministic Debugger |
| 2 | |
| 3 | rr provides deterministic record-replay debugging with full reverse execution capabilities. |
| 4 | |
| 5 | ## Core Workflow |
| 6 | |
| 7 | 1. **Record**: `rr record <program> [args]` |
| 8 | 2. **Replay**: `rr replay` (enters gdb interface with reverse execution) |
| 9 | |
| 10 | ## Reverse Execution Commands |
| 11 | |
| 12 | All standard gdb commands work, plus reverse variants: |
| 13 | |
| 14 | - `reverse-next` / `rn`: Step back over function calls |
| 15 | - `reverse-step` / `rs`: Step back into functions |
| 16 | - `reverse-continue` / `rc`: Continue backward to previous breakpoint |
| 17 | - `reverse-stepi` / `rsi`: Step back one instruction |
| 18 | - `reverse-nexti` / `rni`: Step back over one instruction |
| 19 | |
| 20 | ## Crash Trace Extraction |
| 21 | |
| 22 | ### Regular Crashes |
| 23 | |
| 24 | After `rr record <crashing-program>`: |
| 25 | |
| 26 | ```bash |
| 27 | rr replay |
| 28 | # In gdb: |
| 29 | reverse-next 100 # Go back 100 steps (adjust N as needed) |
| 30 | # Now step forward to see execution leading to crash: |
| 31 | next |
| 32 | next |
| 33 | ... |
| 34 | ``` |
| 35 | |
| 36 | ### ASAN Crashes |
| 37 | |
| 38 | After `rr record <asan-program>`: |
| 39 | |
| 40 | ```bash |
| 41 | rr replay |
| 42 | # In gdb: |
| 43 | bt # View stack trace |
| 44 | up # Issue "up" commands until last app frame (before ASAN runtime) |
| 45 | break *$pc # Set breakpoint at that location |
| 46 | reverse-continue # Go back to last app instruction before ASAN |
| 47 | # Now step forward to see execution leading to fault: |
| 48 | next |
| 49 | next |
| 50 | ... |
| 51 | ``` |
| 52 | |
| 53 | ## Inspecting Variables and Memory |
| 54 | |
| 55 | Standard gdb commands work at any point: |
| 56 | |
| 57 | - `print <var>`: Print variable value |
| 58 | - `print *<ptr>`: Dereference pointer |
| 59 | - `x/<format> <address>`: Examine memory |
| 60 | - `x/10xb <addr>`: 10 bytes in hex |
| 61 | - `x/s <addr>`: String at address |
| 62 | - `info locals`: Show local variables |
| 63 | - `info args`: Show function arguments |
| 64 | |
| 65 | ## Source vs Assembly View |
| 66 | |
| 67 | - `list`: Show source code around current location |
| 68 | - `disassemble`: Show assembly around current location |
| 69 | - `layout src`: TUI source view |
| 70 | - `layout asm`: TUI assembly view |
| 71 | - `set disassemble-next-line on`: Show assembly with each step |
| 72 | |
| 73 | ## Automation Script |
| 74 | |
| 75 | Use `scripts/crash_trace.py` to automatically extract execution trace before crash. |