The LLDB MCP Server provides comprehensive debugging capabilities for LLDB through MCP-compatible AI assistants, enabling interactive debugging of native programs, crash analysis, and runtime state inspection.
Core Capabilities:
Execution Control
Run programs with arguments, environment variables, working directory control, and optional breakpoints
Analyze crash dumps and core files for post-mortem debugging
Execute arbitrary LLDB commands for flexible debugging scenarios
Breakpoints & Watchpoints
Set breakpoints by function name, file:line, address, or regex pattern with optional conditions
Set watchpoints on variables to break on read/write access
Runtime State Inspection
Examine local variables and arguments at breakpoints
Get stack backtraces for single or all threads with complete call chains
View CPU register values (general purpose, floating point, SIMD/vector)
Read raw memory at specified addresses in various formats (hex, binary, decimal, string, disassembly)
List all threads with their states, stop reasons, and execution points
Code Analysis
Disassemble functions or address ranges with optional source code interleaving
View source code for files, functions, or current locations with line numbers
Look up symbols by name, regex pattern, address, or type
List loaded executables and shared libraries with load addresses
Expression Evaluation
Evaluate C/C++ expressions in debug context (variables, pointers, function calls, sizeof)
Utilities
Get LLDB version information
Access LLDB command help for specific commands or general usage
Key Features:
Supports both markdown (human-readable) and JSON (structured) output formats
Works with crash dumps and core files for post-mortem analysis
Supports conditional breakpoints and watchpoints
Integrates with Claude Code and other MCP-compatible AI assistants
Provides structured debugging tools for LLDB, including execution control, breakpoint management, memory inspection, register viewing, stack traces, disassembly, symbol lookup, and expression evaluation for debugging C/C++ programs.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@LLDB MCP Serveranalyze the crash dump in ./core with ./myprogram"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
LLDB MCP Server
An MCP (Model Context Protocol) server that provides structured debugging tools for LLDB, designed for use with Claude Code and other MCP-compatible AI assistants.
Features
This server exposes LLDB debugging capabilities through well-defined MCP tools:
Execution Control
lldb_run - Run a program with optional breakpoints and arguments
lldb_analyze_crash - Analyze crash dumps and core files
Breakpoints & Watchpoints
lldb_set_breakpoint - Set breakpoints by function, file:line, or address
lldb_watchpoint - Set watchpoints to break on variable access
Inspection
lldb_examine_variables - View local variables and arguments
lldb_backtrace - Get stack traces for all threads
lldb_registers - View CPU register values
lldb_read_memory - Read and display memory contents
lldb_threads - List all threads and their states
Code Analysis
lldb_disassemble - Disassemble functions or address ranges
lldb_source - List source code with line numbers
lldb_symbols - Look up symbols by name, regex, or address
lldb_images - List loaded executables and shared libraries
Expression Evaluation
lldb_evaluate - Evaluate C/C++ expressions in debug context
Utilities
lldb_run_command - Run arbitrary LLDB commands
lldb_help - Get help on LLDB commands
lldb_version - Show LLDB version info
Requirements
Python 3.10+
LLDB (with command-line tool in PATH)
mcp[cli]Python package
Installing LLDB
Ubuntu/Debian:
sudo apt install lldbmacOS:
# LLDB comes with Xcode Command Line Tools
xcode-select --installWindows:
# Install via LLVM releases or Visual Studio
winget install LLVM.LLVMInstallation
Quick Start (Recommended)
We provide a setup script that installs all dependencies and verifies the installation.
Make the script executable
chmod +x setup_for_copilot.sh
Run the setup script
./setup_for_copilot.sh
This script will:
Check for Python 3 and pip
Install required Python packages (
mcp[cli],pydantic,httpx)
Verify the installation by running tests
Option 1: Install from source
# Clone the repository
git clone https://github.com/yourusername/lldb-mcp.git
cd lldb-mcp
# Install dependencies
pip install -e .Option 2: Install dependencies directly
pip install "mcp[cli]" pydantic httpxConfiguration for Claude Code
Automatic Configuration
You can easily add the server to Claude Code using the mcp add command:
claude mcp add lldb python3 /path/to/lldb-mcp/lldb_mcp_server.pyReplace /path/to/lldb-mcp with the actual path to the repository.
Manual Configuration
Add the following to your Claude Code MCP configuration file:
Location of config file
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
Configuration
{
"mcpServers": {
"lldb": {
"command": "python",
"args": ["/path/to/lldb-mcp/lldb_mcp_server.py"]
}
}
}Or if installed as a package:
{
"mcpServers": {
"lldb": {
"command": "lldb-mcp"
}
}
}Using uvx (recommended for isolation)
{
"mcpServers": {
"lldb": {
"command": "uvx",
"args": ["--from", "/path/to/lldb-mcp", "lldb-mcp"]
}
}
}Usage Examples
Once configured, you can ask Claude Code to help with debugging tasks:
Analyze a Crash
"Analyze the crash dump in ./core and the executable ./myprogram to find what caused the segfault"
Set Breakpoints and Examine State
"Set a breakpoint at the processData function in processor.cpp, run the program with argument 'test.txt', and show me the local variables when it stops"
Disassemble Code
"Show me the assembly for the main function in ./myprogram"
Evaluate Expressions
"Run ./myprogram until it hits parseConfig and evaluate the expression config->max_threads"
Memory Inspection
"Read 128 bytes of memory at address 0x7fff5fbff000 in hexadecimal format"
Symbol Lookup
"Find all symbols matching 'parse.*' regex in ./myprogram"
Tool Reference
lldb_run_command
Execute any LLDB command directly.
{
"command": "help breakpoint", # Any LLDB command
"target": "./myprogram", # Optional: executable to load
"working_dir": "/path/to/dir" # Optional: working directory
}lldb_analyze_crash
Analyze crash dumps with full context.
{
"executable": "./myprogram",
"core_file": "./core", # Optional: core dump
"response_format": "markdown" # or "json"
}lldb_set_breakpoint
Set breakpoints with conditions.
{
"executable": "./myprogram",
"location": "main.cpp:42", # or "functionName" or "0x400500"
"condition": "i > 100" # Optional: break condition
}lldb_examine_variables
View variables at a breakpoint.
{
"executable": "./myprogram",
"breakpoint": "processData",
"variables": ["buffer", "size"], # Optional: specific vars
"args": ["input.txt"], # Optional: program args
"response_format": "markdown"
}lldb_disassemble
Disassemble code regions.
{
"executable": "./myprogram",
"target": "main", # Function name, address range, or "current"
"show_bytes": true, # Show opcode bytes
"mixed": true # Interleave source
}lldb_read_memory
Read memory contents.
{
"executable": "./myprogram",
"address": "0x7fff5fbff000",
"count": 64, # Bytes to read
"format": "x", # x=hex, b=binary, d=decimal, s=string
"breakpoint": "main" # Optional: stop here first
}lldb_evaluate
Evaluate C/C++ expressions.
{
"executable": "./myprogram",
"expression": "ptr->data[5]",
"breakpoint": "processBuffer",
"args": ["test.dat"]
}lldb_backtrace
Get stack traces.
{
"executable": "./myprogram",
"breakpoint": "handleError", # or use core_file
"core_file": "./core", # For post-mortem
"all_threads": true,
"limit": 50,
"response_format": "json" # Structured output
}lldb_registers
View CPU registers.
{
"executable": "./myprogram",
"breakpoint": "criticalSection",
"register_set": "general", # general, float, vector, all
"specific_registers": ["rax", "rbx", "rsp"] # Optional
}lldb_watchpoint
Set data watchpoints.
{
"executable": "./myprogram",
"variable": "global_counter",
"watch_type": "write", # write, read, read_write
"condition": "global_counter > 1000"
}lldb_symbols
Look up symbols.
{
"executable": "./myprogram",
"query": "process.*",
"query_type": "regex" # name, regex, address, type
}Alternative: Using LLDB's Built-in MCP Server
LLDB 18+ has built-in MCP support. To use it instead:
Start LLDB and enable MCP:
(lldb) protocol-server start MCP listen://localhost:59999Configure Claude Code to connect via netcat:
{ "mcpServers": { "lldb": { "command": "/usr/bin/nc", "args": ["localhost", "59999"] } } }
Note: LLDB's built-in MCP only exposes a single lldb_command tool, whereas this server provides structured, specialized tools for better AI integration.
Development
Running Tests
pytest tests/Type Checking
mypy lldb_mcp_server.pyLinting
ruff check lldb_mcp_server.py
ruff format lldb_mcp_server.pyTroubleshooting
"LLDB executable not found"
Ensure LLDB is installed and in your PATH:
which lldb
lldb --versionPermission denied on core files
On Linux, enable core dumps:
ulimit -c unlimited
sudo sysctl -w kernel.core_pattern=core.%pDebugger can't find symbols
Compile your programs with debug info:
g++ -g -O0 myprogram.cpp -o myprogram
clang++ -g -O0 myprogram.cpp -o myprogramLicense
MIT License - see LICENSE file for details.
Contributing
Contributions welcome! Please read CONTRIBUTING.md for guidelines.