rr-mcp 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. rr_mcp-0.2.0/.github/workflows/ci.yml +52 -0
  2. rr_mcp-0.2.0/.github/workflows/release.yml +61 -0
  3. rr_mcp-0.2.0/.gitignore +50 -0
  4. rr_mcp-0.2.0/.python-version +1 -0
  5. rr_mcp-0.2.0/LICENSE +21 -0
  6. rr_mcp-0.2.0/PKG-INFO +243 -0
  7. rr_mcp-0.2.0/README.md +212 -0
  8. rr_mcp-0.2.0/RR_DEBUGGING_GUIDE.md +263 -0
  9. rr_mcp-0.2.0/pyproject.toml +108 -0
  10. rr_mcp-0.2.0/src/rr_mcp/__init__.py +17 -0
  11. rr_mcp-0.2.0/src/rr_mcp/errors.py +41 -0
  12. rr_mcp-0.2.0/src/rr_mcp/gdbmi.py +1443 -0
  13. rr_mcp-0.2.0/src/rr_mcp/models.py +216 -0
  14. rr_mcp-0.2.0/src/rr_mcp/py.typed +0 -0
  15. rr_mcp-0.2.0/src/rr_mcp/server.py +2172 -0
  16. rr_mcp-0.2.0/src/rr_mcp/session.py +1125 -0
  17. rr_mcp-0.2.0/src/rr_mcp/trace.py +257 -0
  18. rr_mcp-0.2.0/tests/README.md +126 -0
  19. rr_mcp-0.2.0/tests/__init__.py +1 -0
  20. rr_mcp-0.2.0/tests/conftest.py +285 -0
  21. rr_mcp-0.2.0/tests/fixtures/__init__.py +0 -0
  22. rr_mcp-0.2.0/tests/fixtures/programs/CMakeLists.txt +21 -0
  23. rr_mcp-0.2.0/tests/fixtures/programs/cpp_features.cpp +185 -0
  24. rr_mcp-0.2.0/tests/fixtures/programs/crash.cpp +22 -0
  25. rr_mcp-0.2.0/tests/fixtures/programs/fork_no_exec.cpp +53 -0
  26. rr_mcp-0.2.0/tests/fixtures/programs/fork_test.cpp +88 -0
  27. rr_mcp-0.2.0/tests/fixtures/programs/recursive.cpp +29 -0
  28. rr_mcp-0.2.0/tests/fixtures/programs/simple.cpp +29 -0
  29. rr_mcp-0.2.0/tests/fixtures/programs/threads.cpp +120 -0
  30. rr_mcp-0.2.0/tests/test_operations_integration.py +1497 -0
  31. rr_mcp-0.2.0/tests/test_server.py +730 -0
  32. rr_mcp-0.2.0/tests/test_session.py +173 -0
  33. rr_mcp-0.2.0/tests/test_session_integration.py +129 -0
  34. rr_mcp-0.2.0/tests/test_trace.py +234 -0
  35. rr_mcp-0.2.0/tests/test_trace_integration.py +100 -0
@@ -0,0 +1,52 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ workflow_call:
8
+
9
+ jobs:
10
+ lint:
11
+ name: Lint & type check
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: "3.12"
19
+
20
+ - name: Install uv
21
+ uses: astral-sh/setup-uv@v4
22
+
23
+ - name: Install dependencies
24
+ run: uv sync --all-extras
25
+
26
+ - name: Ruff check
27
+ run: uv run ruff check src/ tests/
28
+
29
+ - name: Mypy
30
+ run: uv run mypy src/
31
+
32
+ test:
33
+ name: Test (Python ${{ matrix.python-version }})
34
+ runs-on: ubuntu-latest
35
+ strategy:
36
+ matrix:
37
+ python-version: ["3.11", "3.12", "3.13"]
38
+ steps:
39
+ - uses: actions/checkout@v4
40
+
41
+ - uses: actions/setup-python@v5
42
+ with:
43
+ python-version: ${{ matrix.python-version }}
44
+
45
+ - name: Install uv
46
+ uses: astral-sh/setup-uv@v4
47
+
48
+ - name: Install dependencies
49
+ run: uv sync --all-extras
50
+
51
+ - name: Run unit tests
52
+ run: uv run pytest tests/test_server.py tests/test_trace.py tests/test_session.py -v
@@ -0,0 +1,61 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ jobs:
9
+ ci:
10
+ name: CI
11
+ uses: ./.github/workflows/ci.yml
12
+
13
+ build:
14
+ name: Build distribution
15
+ needs: ci
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ with:
20
+ fetch-depth: 0 # hatch-vcs needs full history for version
21
+
22
+ - uses: actions/setup-python@v5
23
+ with:
24
+ python-version: "3.12"
25
+
26
+ - name: Install build dependencies
27
+ run: pip install build
28
+
29
+ - name: Build package
30
+ run: python -m build
31
+
32
+ - name: Verify version matches tag
33
+ run: |
34
+ TAG="${GITHUB_REF#refs/tags/v}"
35
+ SDIST=$(ls dist/*.tar.gz)
36
+ PKG_VERSION=$(basename "$SDIST" | sed 's/^rr_mcp-//;s/\.tar\.gz$//')
37
+ if [ "$TAG" != "$PKG_VERSION" ]; then
38
+ echo "::error::Tag v$TAG does not match package version $PKG_VERSION"
39
+ exit 1
40
+ fi
41
+ echo "Version: $PKG_VERSION"
42
+
43
+ - uses: actions/upload-artifact@v4
44
+ with:
45
+ name: dist
46
+ path: dist/
47
+
48
+ publish:
49
+ name: Publish to PyPI
50
+ needs: build
51
+ runs-on: ubuntu-latest
52
+ environment: pypi
53
+ permissions:
54
+ id-token: write
55
+ steps:
56
+ - uses: actions/download-artifact@v4
57
+ with:
58
+ name: dist
59
+ path: dist/
60
+
61
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,50 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual environments
24
+ .venv/
25
+ venv/
26
+ ENV/
27
+
28
+ # uv
29
+ uv.lock
30
+
31
+ # Testing
32
+ .pytest_cache/
33
+ .coverage
34
+ htmlcov/
35
+ .tox/
36
+ .nox/
37
+
38
+ # Type checking
39
+ .mypy_cache/
40
+
41
+ # IDE
42
+ .idea/
43
+ .vscode/
44
+ *.swp
45
+ *.swo
46
+ *~
47
+
48
+ # OS
49
+ .DS_Store
50
+ Thumbs.db
@@ -0,0 +1 @@
1
+ 3.11
rr_mcp-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Jan-Niklas Jaeschke
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
rr_mcp-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,243 @@
1
+ Metadata-Version: 2.4
2
+ Name: rr-mcp
3
+ Version: 0.2.0
4
+ Summary: MCP server for orchestrating multi-process rr debugging sessions
5
+ Project-URL: Homepage, https://github.com/jnjaeschke/rr-mcp
6
+ Project-URL: Repository, https://github.com/jnjaeschke/rr-mcp
7
+ Project-URL: Issues, https://github.com/jnjaeschke/rr-mcp/issues
8
+ Author-email: Jan-Niklas Jaeschke <jjaschke@mozilla.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: debugger,gdb,mcp,reverse-debugging,rr
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Software Development :: Debuggers
21
+ Requires-Python: >=3.11
22
+ Requires-Dist: mcp>=1.0.0
23
+ Requires-Dist: pygdbmi>=0.11.0.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: mypy>=1.13.0; extra == 'dev'
26
+ Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
27
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
28
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
29
+ Requires-Dist: ruff>=0.8.0; extra == 'dev'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # rr-mcp
33
+
34
+ MCP (Model Context Protocol) server for orchestrating multi-process [rr](https://rr-project.org/) debugging sessions.
35
+
36
+ ## Overview
37
+
38
+ rr-mcp enables AI agents (like Claude) to debug multi-process applications using rr's record-and-replay capabilities. It provides:
39
+
40
+ - **48 specialized debugging tools** with rich descriptions and usage context
41
+ - **Dynamic MCP resources** that expose live session state (`rr://sessions/{id}`)
42
+ - **Concurrent replay sessions** for debugging different processes simultaneously
43
+ - **Full reverse execution** — step, continue, and finish in both directions
44
+ - **Multi-process support** — debug exec'd processes (`pid`) or forked-without-exec children (`fork_pid`)
45
+ - **Conditional and temporary breakpoints**, watchpoints, and catchpoints (throw/catch/syscall/signal)
46
+
47
+ **New to rr debugging?** See [RR_DEBUGGING_GUIDE.md](RR_DEBUGGING_GUIDE.md) for concepts, workflows, and best practices.
48
+
49
+ ## Requirements
50
+
51
+ - Linux (rr only runs on Linux)
52
+ - Python 3.11+
53
+ - [rr](https://rr-project.org/) installed and in PATH
54
+ - An rr recording to debug
55
+
56
+ ## Installation
57
+
58
+ ### Claude Code
59
+
60
+ ```bash
61
+ claude mcp add rr-mcp -- uvx rr-mcp
62
+ ```
63
+
64
+ ### Other MCP clients
65
+
66
+ Any MCP client that supports stdio servers can run `uvx rr-mcp` (or `pipx run rr-mcp`).
67
+
68
+ ### Installing from source
69
+
70
+ **For development** (recommended - no reinstall needed after changes):
71
+
72
+ ```bash
73
+ git clone https://github.com/jnjaeschke/rr-mcp && cd rr-mcp
74
+ uv sync # Install dependencies
75
+
76
+ # Configure Claude Code to run from source
77
+ claude mcp add rr-mcp -- uv run --directory /absolute/path/to/rr-mcp rr-mcp
78
+ ```
79
+
80
+ **For production use**:
81
+
82
+ ```bash
83
+ git clone https://github.com/jnjaeschke/rr-mcp && cd rr-mcp
84
+ uv tool install .
85
+
86
+ # Configure Claude Code
87
+ claude mcp add rr-mcp -- rr-mcp
88
+ ```
89
+
90
+ For other MCP clients, use the appropriate command (`uv run ...` for development or `rr-mcp` for production).
91
+
92
+ ## Usage
93
+
94
+ Once installed, the server loads automatically when you start your MCP client. Verify it's working by asking:
95
+
96
+ > "List available rr traces"
97
+
98
+ Claude will use the `traces_list` tool to show recordings in your `_RR_TRACE_DIR` (defaults to `~/.local/share/rr`).
99
+
100
+ ### MCP Resources
101
+
102
+ - `rr://guide` — Debugging guide with workflows, tool selection advice, and common pitfalls
103
+ - `rr://traces` — Dynamic list of available recordings
104
+ - `rr://sessions/{id}` — Current session state (position, location)
105
+ - `rr://sessions/{id}/backtrace` — Live call stack for a session
106
+
107
+ ### Tools
108
+
109
+ 48 debugging tools organized into categories. Each tool includes rich descriptions with usage context, parameter documentation, return value format specifications, and workflow guidance.
110
+
111
+ #### Trace Management (3 tools)
112
+
113
+ | Tool | Description |
114
+ |------|-------------|
115
+ | `traces_list` | List all available rr recordings on the system |
116
+ | `trace_info` | Get metadata about a trace (creation time, binary, etc.) |
117
+ | `trace_processes` | List processes in a trace with PIDs and exec info |
118
+
119
+ #### Session Lifecycle (3 tools)
120
+
121
+ | Tool | Description |
122
+ |------|-------------|
123
+ | `session_create` | Create a replay session for a specific process. Supports `pid` (exec'd processes) and `fork_pid` (forked-without-exec children) |
124
+ | `session_list` | List all active replay sessions |
125
+ | `session_close` | End a session and free its resources |
126
+
127
+ #### Execution Control (14 tools)
128
+
129
+ | Tool | Description |
130
+ |------|-------------|
131
+ | `continue` / `reverse_continue` | Run forward/backward until breakpoint, signal, or end |
132
+ | `step` / `reverse_step` | Step by source lines, into functions |
133
+ | `next` / `reverse_next` | Step by source lines, over functions |
134
+ | `finish` / `reverse_finish` | Run to end/start of current function |
135
+ | `stepi` / `reverse_stepi` | Step by machine instructions, into calls |
136
+ | `nexti` / `reverse_nexti` | Step by machine instructions, over calls |
137
+ | `run_to_event` | Jump to a specific rr event number |
138
+ | `interrupt` | Stop a running program |
139
+
140
+ #### Breakpoints & Watchpoints (7 tools)
141
+
142
+ | Tool | Description |
143
+ |------|-------------|
144
+ | `breakpoint_set` | Set breakpoints by function, file:line, or address. Supports conditional (`condition`) and temporary breakpoints. Pending breakpoints are enabled automatically for unloaded code |
145
+ | `breakpoint_delete` | Delete a breakpoint by number |
146
+ | `breakpoint_list` | List all breakpoints with their state |
147
+ | `breakpoint_enable` / `breakpoint_disable` | Toggle breakpoints on/off |
148
+ | `watchpoint_set` | Break on memory writes, reads, or access to an expression |
149
+ | `catch` | Catchpoints for C++ `throw`/`catch`, syscalls (optionally filtered by name), and signals |
150
+
151
+ #### Inspection (14 tools)
152
+
153
+ | Tool | Description |
154
+ |------|-------------|
155
+ | `backtrace` | Call stack with optional `full` mode (includes locals per frame) |
156
+ | `print` | Evaluate an expression in the current context |
157
+ | `locals` | Local variables in the current frame |
158
+ | `args` | Function arguments across stack frames |
159
+ | `frame_select` | Switch to a different stack frame |
160
+ | `registers` | CPU registers (`gp_only` flag filters to general-purpose registers) |
161
+ | `examine_memory` | Formatted memory dump (like GDB's `x` command) |
162
+ | `when` | Current rr event and tick position |
163
+ | `threads_list` / `thread_select` | List and switch between threads |
164
+ | `checkpoint_create` | Save execution position for instant return later |
165
+ | `checkpoint_restore` | Jump back to a saved checkpoint |
166
+ | `checkpoint_delete` / `checkpoint_list` | Manage checkpoints |
167
+
168
+ #### Signal Handling & Memory Search (2 tools)
169
+
170
+ | Tool | Description |
171
+ |------|-------------|
172
+ | `handle_signal` | Configure how GDB handles a signal (stop, pass, print) |
173
+ | `find_in_memory` | Search memory range for a byte pattern |
174
+
175
+ #### Source & Advanced (5 tools)
176
+
177
+ | Tool | Description |
178
+ |------|-------------|
179
+ | `source_list` | Show source code around a location with context lines |
180
+ | `source_path` | Resolve a filename to its full path |
181
+ | `source_files` | List all source files in the program |
182
+ | `info` | GDB `info` subcommands (proc mappings, shared libs, symbols, types, signals) |
183
+ | `gdb_raw` | Execute an arbitrary GDB command (escape hatch) |
184
+
185
+ All tools include detailed descriptions visible to Claude. See tool definitions in [src/rr_mcp/server.py](src/rr_mcp/server.py).
186
+
187
+ ## Example Session
188
+
189
+ ```text
190
+ Agent: Let me list the available traces.
191
+ [calls traces_list]
192
+
193
+ Agent: I see firefox-0. Let me check what processes are in it.
194
+ [calls trace_processes with trace="firefox-0"]
195
+
196
+ Agent: The main process is PID 12345, and there's a content process
197
+ PID 12350 that crashed with SIGSEGV. Let me debug the content
198
+ process — it forked without exec, so I need fork_pid.
199
+ [calls session_create with trace="firefox-0", fork_pid=12350]
200
+
201
+ Agent: Let me see where we are and get the crash backtrace.
202
+ [calls backtrace with session_id="abc123"]
203
+
204
+ Agent: Frame #3 in HandleEvent dereferences a null mWidget pointer.
205
+ Let me see the source code around that line.
206
+ [calls source_list with location="HandleEvent.cpp:142"]
207
+
208
+ Agent: I'll set a watchpoint on mWidget to find where it was set to null,
209
+ then reverse-continue to catch the moment it happened.
210
+ [calls watchpoint_set with expression="this->mWidget", access_type="write"]
211
+ [calls reverse_continue]
212
+
213
+ Agent: The watchpoint triggered at event 84021 in Widget::Destroy().
214
+ Let me check who called this.
215
+ [calls backtrace]
216
+
217
+ Agent: I'll save this position as a checkpoint so I can return here later,
218
+ then continue investigating the caller.
219
+ [calls checkpoint_create]
220
+ ```
221
+
222
+ ## Development
223
+
224
+ ```bash
225
+ # Install dev dependencies
226
+ uv sync --all-extras
227
+
228
+ # Run tests (parallel execution with pytest-xdist)
229
+ uv run pytest -n auto
230
+
231
+ # Run tests (sequential)
232
+ uv run pytest
233
+
234
+ # Run linter
235
+ uv run ruff check src/ tests/
236
+
237
+ # Run type checker
238
+ uv run mypy src/
239
+ ```
240
+
241
+ ## License
242
+
243
+ MIT
rr_mcp-0.2.0/README.md ADDED
@@ -0,0 +1,212 @@
1
+ # rr-mcp
2
+
3
+ MCP (Model Context Protocol) server for orchestrating multi-process [rr](https://rr-project.org/) debugging sessions.
4
+
5
+ ## Overview
6
+
7
+ rr-mcp enables AI agents (like Claude) to debug multi-process applications using rr's record-and-replay capabilities. It provides:
8
+
9
+ - **48 specialized debugging tools** with rich descriptions and usage context
10
+ - **Dynamic MCP resources** that expose live session state (`rr://sessions/{id}`)
11
+ - **Concurrent replay sessions** for debugging different processes simultaneously
12
+ - **Full reverse execution** — step, continue, and finish in both directions
13
+ - **Multi-process support** — debug exec'd processes (`pid`) or forked-without-exec children (`fork_pid`)
14
+ - **Conditional and temporary breakpoints**, watchpoints, and catchpoints (throw/catch/syscall/signal)
15
+
16
+ **New to rr debugging?** See [RR_DEBUGGING_GUIDE.md](RR_DEBUGGING_GUIDE.md) for concepts, workflows, and best practices.
17
+
18
+ ## Requirements
19
+
20
+ - Linux (rr only runs on Linux)
21
+ - Python 3.11+
22
+ - [rr](https://rr-project.org/) installed and in PATH
23
+ - An rr recording to debug
24
+
25
+ ## Installation
26
+
27
+ ### Claude Code
28
+
29
+ ```bash
30
+ claude mcp add rr-mcp -- uvx rr-mcp
31
+ ```
32
+
33
+ ### Other MCP clients
34
+
35
+ Any MCP client that supports stdio servers can run `uvx rr-mcp` (or `pipx run rr-mcp`).
36
+
37
+ ### Installing from source
38
+
39
+ **For development** (recommended - no reinstall needed after changes):
40
+
41
+ ```bash
42
+ git clone https://github.com/jnjaeschke/rr-mcp && cd rr-mcp
43
+ uv sync # Install dependencies
44
+
45
+ # Configure Claude Code to run from source
46
+ claude mcp add rr-mcp -- uv run --directory /absolute/path/to/rr-mcp rr-mcp
47
+ ```
48
+
49
+ **For production use**:
50
+
51
+ ```bash
52
+ git clone https://github.com/jnjaeschke/rr-mcp && cd rr-mcp
53
+ uv tool install .
54
+
55
+ # Configure Claude Code
56
+ claude mcp add rr-mcp -- rr-mcp
57
+ ```
58
+
59
+ For other MCP clients, use the appropriate command (`uv run ...` for development or `rr-mcp` for production).
60
+
61
+ ## Usage
62
+
63
+ Once installed, the server loads automatically when you start your MCP client. Verify it's working by asking:
64
+
65
+ > "List available rr traces"
66
+
67
+ Claude will use the `traces_list` tool to show recordings in your `_RR_TRACE_DIR` (defaults to `~/.local/share/rr`).
68
+
69
+ ### MCP Resources
70
+
71
+ - `rr://guide` — Debugging guide with workflows, tool selection advice, and common pitfalls
72
+ - `rr://traces` — Dynamic list of available recordings
73
+ - `rr://sessions/{id}` — Current session state (position, location)
74
+ - `rr://sessions/{id}/backtrace` — Live call stack for a session
75
+
76
+ ### Tools
77
+
78
+ 48 debugging tools organized into categories. Each tool includes rich descriptions with usage context, parameter documentation, return value format specifications, and workflow guidance.
79
+
80
+ #### Trace Management (3 tools)
81
+
82
+ | Tool | Description |
83
+ |------|-------------|
84
+ | `traces_list` | List all available rr recordings on the system |
85
+ | `trace_info` | Get metadata about a trace (creation time, binary, etc.) |
86
+ | `trace_processes` | List processes in a trace with PIDs and exec info |
87
+
88
+ #### Session Lifecycle (3 tools)
89
+
90
+ | Tool | Description |
91
+ |------|-------------|
92
+ | `session_create` | Create a replay session for a specific process. Supports `pid` (exec'd processes) and `fork_pid` (forked-without-exec children) |
93
+ | `session_list` | List all active replay sessions |
94
+ | `session_close` | End a session and free its resources |
95
+
96
+ #### Execution Control (14 tools)
97
+
98
+ | Tool | Description |
99
+ |------|-------------|
100
+ | `continue` / `reverse_continue` | Run forward/backward until breakpoint, signal, or end |
101
+ | `step` / `reverse_step` | Step by source lines, into functions |
102
+ | `next` / `reverse_next` | Step by source lines, over functions |
103
+ | `finish` / `reverse_finish` | Run to end/start of current function |
104
+ | `stepi` / `reverse_stepi` | Step by machine instructions, into calls |
105
+ | `nexti` / `reverse_nexti` | Step by machine instructions, over calls |
106
+ | `run_to_event` | Jump to a specific rr event number |
107
+ | `interrupt` | Stop a running program |
108
+
109
+ #### Breakpoints & Watchpoints (7 tools)
110
+
111
+ | Tool | Description |
112
+ |------|-------------|
113
+ | `breakpoint_set` | Set breakpoints by function, file:line, or address. Supports conditional (`condition`) and temporary breakpoints. Pending breakpoints are enabled automatically for unloaded code |
114
+ | `breakpoint_delete` | Delete a breakpoint by number |
115
+ | `breakpoint_list` | List all breakpoints with their state |
116
+ | `breakpoint_enable` / `breakpoint_disable` | Toggle breakpoints on/off |
117
+ | `watchpoint_set` | Break on memory writes, reads, or access to an expression |
118
+ | `catch` | Catchpoints for C++ `throw`/`catch`, syscalls (optionally filtered by name), and signals |
119
+
120
+ #### Inspection (14 tools)
121
+
122
+ | Tool | Description |
123
+ |------|-------------|
124
+ | `backtrace` | Call stack with optional `full` mode (includes locals per frame) |
125
+ | `print` | Evaluate an expression in the current context |
126
+ | `locals` | Local variables in the current frame |
127
+ | `args` | Function arguments across stack frames |
128
+ | `frame_select` | Switch to a different stack frame |
129
+ | `registers` | CPU registers (`gp_only` flag filters to general-purpose registers) |
130
+ | `examine_memory` | Formatted memory dump (like GDB's `x` command) |
131
+ | `when` | Current rr event and tick position |
132
+ | `threads_list` / `thread_select` | List and switch between threads |
133
+ | `checkpoint_create` | Save execution position for instant return later |
134
+ | `checkpoint_restore` | Jump back to a saved checkpoint |
135
+ | `checkpoint_delete` / `checkpoint_list` | Manage checkpoints |
136
+
137
+ #### Signal Handling & Memory Search (2 tools)
138
+
139
+ | Tool | Description |
140
+ |------|-------------|
141
+ | `handle_signal` | Configure how GDB handles a signal (stop, pass, print) |
142
+ | `find_in_memory` | Search memory range for a byte pattern |
143
+
144
+ #### Source & Advanced (5 tools)
145
+
146
+ | Tool | Description |
147
+ |------|-------------|
148
+ | `source_list` | Show source code around a location with context lines |
149
+ | `source_path` | Resolve a filename to its full path |
150
+ | `source_files` | List all source files in the program |
151
+ | `info` | GDB `info` subcommands (proc mappings, shared libs, symbols, types, signals) |
152
+ | `gdb_raw` | Execute an arbitrary GDB command (escape hatch) |
153
+
154
+ All tools include detailed descriptions visible to Claude. See tool definitions in [src/rr_mcp/server.py](src/rr_mcp/server.py).
155
+
156
+ ## Example Session
157
+
158
+ ```text
159
+ Agent: Let me list the available traces.
160
+ [calls traces_list]
161
+
162
+ Agent: I see firefox-0. Let me check what processes are in it.
163
+ [calls trace_processes with trace="firefox-0"]
164
+
165
+ Agent: The main process is PID 12345, and there's a content process
166
+ PID 12350 that crashed with SIGSEGV. Let me debug the content
167
+ process — it forked without exec, so I need fork_pid.
168
+ [calls session_create with trace="firefox-0", fork_pid=12350]
169
+
170
+ Agent: Let me see where we are and get the crash backtrace.
171
+ [calls backtrace with session_id="abc123"]
172
+
173
+ Agent: Frame #3 in HandleEvent dereferences a null mWidget pointer.
174
+ Let me see the source code around that line.
175
+ [calls source_list with location="HandleEvent.cpp:142"]
176
+
177
+ Agent: I'll set a watchpoint on mWidget to find where it was set to null,
178
+ then reverse-continue to catch the moment it happened.
179
+ [calls watchpoint_set with expression="this->mWidget", access_type="write"]
180
+ [calls reverse_continue]
181
+
182
+ Agent: The watchpoint triggered at event 84021 in Widget::Destroy().
183
+ Let me check who called this.
184
+ [calls backtrace]
185
+
186
+ Agent: I'll save this position as a checkpoint so I can return here later,
187
+ then continue investigating the caller.
188
+ [calls checkpoint_create]
189
+ ```
190
+
191
+ ## Development
192
+
193
+ ```bash
194
+ # Install dev dependencies
195
+ uv sync --all-extras
196
+
197
+ # Run tests (parallel execution with pytest-xdist)
198
+ uv run pytest -n auto
199
+
200
+ # Run tests (sequential)
201
+ uv run pytest
202
+
203
+ # Run linter
204
+ uv run ruff check src/ tests/
205
+
206
+ # Run type checker
207
+ uv run mypy src/
208
+ ```
209
+
210
+ ## License
211
+
212
+ MIT