The gdb-mcp server exposes GDB and rr debugging capabilities as structured tools, enabling an AI assistant to fully control and inspect program execution.
Session Management
start_session— launch a new GDB process, optionally loading a binary, arguments, and working directorystop_session— kill a session and free its resourceslist_sessions— view all running sessions, their kind (gdborrr-replay), and status
Time-Travel Debugging (rr)
rr_record— capture a full deterministic execution trace, returning atrace_dirstart_replay_session— replay a recorded trace to enable reverse executionreverse-continue— run backwards to the previous breakpoint or watchpointreverse-step— step backwards one line/instruction, entering callsreverse-next— step backwards one line/instruction, skipping callsreverse-finish— run backwards to where the current function was called
Execution Control
run— start or restart the inferior programcontinue_exec— resume execution from a stopstep/next— step forward into or over the next source line/instructionfinish— run until the current function returnsuntil— run forward to a specific locationinterrupt— send SIGINT to unblock a running session
Breakpoints & Watchpoints
breakpoint— break at a function, file:line, or address, with optional conditions and temporary flagdelete_breakpoints— remove one or all breakpointswatch— stop on write, read, or any access to an expression/memory location
Thread Management
list_threads— show all threads and their current locationselect_thread— switch to a specific thread
Stack Frame Navigation
backtrace— show the full call stackselect_frame— jump to a specific frame by numberup/down— move toward the caller or innermost frame
Inspection & Introspection
context— full snapshot of current frame, arguments, locals, and source after any stoplist_variables— show local variables and/or function argumentsprint— evaluate and print any GDB expression with optional formattingexamine— dump memory at an address with configurable format and unit sizeinfo_registers— display CPU register values (all or specific)list_source— show source code around the current position or a given locationdisassemble— disassemble a function or address range, optionally interleaved with source
Generic Commands
exec_command— execute any arbitrary GDB command and return its outputbatch_commands— run a sequence of GDB commands in one round-trip to reduce latency
gdb-mcp
MCP server that exposes GDB debugging as tools. An AI assistant can set breakpoints, run programs, step through code, inspect variables and memory, and examine registers — all via structured tool calls.
Reverse debugging with rr is also supported.
Requirements
Related MCP server: MCP Server GDB
Installation
uv tool install git+https://github.com/schuay/gdb-mcp.gitThis installs a gdb-mcp command into an isolated environment and puts a
shim on your $PATH. Upgrade later with:
uv tool upgrade gdb-mcpInstall and configure Gemini CLI
curl -fsSL https://raw.githubusercontent.com/schuay/gdb-mcp/main/install-gemini.sh | bashThis installs the tool and adds the server to ~/.gemini/settings.json.
Requires jq.
Tools
Session management
Tool | Description |
| Spawn a GDB process, optionally loading a binary |
| Kill a session and free its resources |
| Show all active sessions with idle time and kind ( |
Time-travel debugging (rr)
rr records a full execution trace and replays it deterministically, enabling reverse-execution (reverse-continue, reverse-step, etc.).
Tool | Description |
| Record a program execution; returns |
| Start an rr replay session; accepts |
A replay session works with all standard tools, plus dedicated reverse-execution tools:
Tool | Description |
| Run backwards to the previous breakpoint or watchpoint |
| Step backwards one source line or instruction (enters calls) |
| Step backwards one source line or instruction (skips calls) |
| Run backwards to where the current function was called |
Typical workflow:
rr_record("/path/to/binary", args=["--flag"])
→ { "trace_dir": "/home/user/.local/share/rr/binary-0", ... }
start_replay_session(trace_dir="/home/user/.local/share/rr/binary-0")
→ { "session_id": "a1b2c3d4", ... }
# Now use the session_id with any tool: breakpoint, run, reverse-continue, etc.Execution control
Execution tools block until the inferior stops (breakpoint, signal, exit, or
timeout). While blocked, use interrupt to send SIGINT and unblock.
Tool | GDB command | Description |
|
| Start or restart the inferior |
|
| Continue after a stop |
|
| Step into next line or instruction |
|
| Step over next line or instruction |
|
| Run until current function returns |
|
| Run until a specific location (skip loops) |
| SIGINT | Interrupt a running inferior |
Breakpoints and watchpoints
Tool | GDB command | Description |
|
| Set a breakpoint (supports conditions) |
|
| Delete one or all breakpoints |
|
| Stop when an expression is written, read, or accessed |
Threads
Tool | GDB command | Description |
|
| List all threads with their current location |
|
| Switch to a specific thread |
Stack frames
Tool | GDB command | Description |
|
| Show the full call stack |
|
| Select a frame by number |
|
| Move up toward the caller |
|
| Move down toward the innermost frame |
Inspection
Tool | GDB command | Description |
| frame + info args + info locals + list | Full snapshot of current location, arguments, locals, and source — call this after every stop |
|
| Variables in the current frame |
|
| Evaluate and print a GDB expression |
|
| Examine memory at an address |
|
| Show CPU register values |
|
| Show source code around the current position |
|
| Disassemble a function or address range |
Generic
Tool | Description |
| Run any GDB command and return its output |
| Run a list of commands sequentially (fewer round-trips) |
exec_command handles execution commands correctly: advance, jump,
signal, and return all block until the inferior stops, just like the named
tools do.
Notes
GDB plugins such as pwndbg or GEF work if installed, but their custom
prompts ((pwndbg), gef>) will break session startup. Either avoid them or
force the standard prompt in .gdbinit:
set prompt (gdb)Timeout behaviour: if an execution command times out, the session is in an
indeterminate state. Call interrupt to stop the inferior, wait for the
blocked tool call to return, then resume normally. When in doubt, stop_session
start_sessiongives a clean slate.