← 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-mcpAvailable Tools (34)
Once configured, GDB and RR Debugging gives your AI agent access to:
start_sessionSpawn a GDB process, optionally loading a binarybinaryargsstop_sessionKill a session and free its resourcessession_idlist_sessionsShow all active sessions with idle time and kindrr_recordRecord a program executionbinaryargsstart_replay_sessionStart an rr replay sessiontrace_dirreverse-continueRun backwards to the previous breakpoint or watchpointsession_idreverse-stepStep backwards one source line or instructionsession_idreverse-nextStep backwards one source line or instruction (skips calls)session_idreverse-finishRun backwards to where the current function was calledsession_idrunStart or restart the inferiorsession_idcontinue_execContinue after a stopsession_idstepStep into next line or instructionsession_idnextStep over next line or instructionsession_idfinishRun until current function returnssession_iduntilRun until a specific locationsession_idlocationinterruptInterrupt a running inferiorsession_idbreakpointSet a breakpointsession_idlocationconditiondelete_breakpointsDelete one or all breakpointssession_idbreakpoint_idwatchStop when an expression is written, read, or accessedsession_idexpressionlist_threadsList all threads with their current locationsession_idselect_threadSwitch to a specific threadsession_idthread_idbacktraceShow the full call stacksession_idselect_frameSelect a frame by numbersession_idframe_idupMove up toward the callersession_iddownMove down toward the innermost framesession_idcontextFull snapshot of current location, arguments, locals, and sourcesession_idlist_variablesVariables in the current framesession_idprintEvaluate and print a GDB expressionsession_idexpressionexamineExamine memory at an addresssession_idaddressformatinfo_registersShow CPU register valuessession_idlist_sourceShow source code around the current positionsession_iddisassembleDisassemble a function or address rangesession_idfunctionexec_commandRun any GDB command and return its outputsession_idcommandbatch_commandsRun a list of commands sequentiallysession_idcommandsTry 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 | bashKeep 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.