← Back to GDB and RR Debugging

Install GDB and RR Debugging

Pick your client, copy the command, done.

1

Add it to Claude Code

claude mcp add gdb-mcp -- uv tool run gdb-mcp

Available Tools (34)

Once configured, GDB and RR Debugging gives your AI agent access to:

start_sessionSpawn a GDB process, optionally loading a binary
binaryargs
stop_sessionKill a session and free its resources
session_id
list_sessionsShow all active sessions with idle time and kind
rr_recordRecord a program execution
binaryargs
start_replay_sessionStart an rr replay session
trace_dir
reverse-continueRun backwards to the previous breakpoint or watchpoint
session_id
reverse-stepStep backwards one source line or instruction
session_id
reverse-nextStep backwards one source line or instruction (skips calls)
session_id
reverse-finishRun backwards to where the current function was called
session_id
runStart or restart the inferior
session_id
continue_execContinue after a stop
session_id
stepStep into next line or instruction
session_id
nextStep over next line or instruction
session_id
finishRun until current function returns
session_id
untilRun until a specific location
session_idlocation
interruptInterrupt a running inferior
session_id
breakpointSet a breakpoint
session_idlocationcondition
delete_breakpointsDelete one or all breakpoints
session_idbreakpoint_id
watchStop when an expression is written, read, or accessed
session_idexpression
list_threadsList all threads with their current location
session_id
select_threadSwitch to a specific thread
session_idthread_id
backtraceShow the full call stack
session_id
select_frameSelect a frame by number
session_idframe_id
upMove up toward the caller
session_id
downMove down toward the innermost frame
session_id
contextFull snapshot of current location, arguments, locals, and source
session_id
list_variablesVariables in the current frame
session_id
printEvaluate and print a GDB expression
session_idexpression
examineExamine memory at an address
session_idaddressformat
info_registersShow CPU register values
session_id
list_sourceShow source code around the current position
session_id
disassembleDisassemble a function or address range
session_idfunction
exec_commandRun any GDB command and return its output
session_idcommand
batch_commandsRun a list of commands sequentially
session_idcommands

Try It Out

After setup, try these prompts with your AI agent:

Start a GDB session for my binary at ./build/app and set a breakpoint at main.
Run the program and show me the backtrace when it hits the breakpoint.
Record this execution using rr so I can perform reverse debugging.
Step backwards through the code to find where the variable 'x' was modified.
Examine the memory at the current stack pointer address.
Alternative installation methods

Gemini CLI

curl -fsSL https://raw.githubusercontent.com/schuay/gdb-mcp/main/install-gemini.sh | bash

Keep this setup from going cold

Save the docs, env vars, and workflow around GDB and RR Debugging in Conare so Claude Code, Codex, and Cursor remember it next time.

Remember this setup