Skip to main content

LLDB debugger integration for Model Context Protocol

Project description

LLDB-MCP

Screenshot

See it in acton here, automatically debugging a buffer overflow: https://x.com/full_duplex/status/1904770477698277847

Overview

LLDB-MCP is a tool that integrates the LLDB debugger with Claude's Model Context Protocol (MCP). This integration allows Claude to start, control, and interact with LLDB debugging sessions directly, enabling AI-assisted debugging workflows.

The tool provides a comprehensive set of commands for working with LLDB, including:

  • Starting and managing LLDB sessions
  • Loading programs for debugging
  • Setting breakpoints and watchpoints
  • Controlling program execution
  • Examining memory, registers, and variables
  • Analyzing stack traces and program state

Features

  • Create and manage multiple LLDB debugging sessions
  • Load executables and attach to running processes
  • Load core dump files for post-mortem analysis
  • Execute arbitrary LLDB commands
  • Fine-grained control over program execution
  • Memory examination and disassembly
  • Thread and stack frame inspection

Installation

  1. Clone the repository:

    git clone https://github.com/stass/lldb-mcp.git
    cd lldb-mcp
    
  2. Install dependencies:

    pip install mcp
    
  3. Configure Claude to use the LLDB-MCP server:

    • Open the Claude desktop app configuration
    • Add the following to your MCP configuration:
    "mcpServers": {
      "lldb-mcp": {
        "command": "python3",
        "args": ["/path/to/lldb-mcp/lldb_mcp.py"],
        "disabled": false
      }
    }
    

Usage

Once installed and configured, you can interact with LLDB through Claude using natural language.

Basic Workflow

  1. Start a new LLDB session
  2. Load a program
  3. Set breakpoints
  4. Run the program
  5. Inspect variables and memory
  6. Control execution (continue, step, next, etc.)
  7. Terminate the session when done

Example Commands

Here are some examples of how to interact with LLDB-MCP through Claude:

  • "Start a new LLDB session"
  • "Load the program '/path/to/executable'"
  • "Set a breakpoint at main"
  • "Run the program"
  • "Show backtrace"
  • "Print the value of variable 'count'"
  • "Step over the next line"
  • "Examine memory at address 0x1000"
  • "Show register values"
  • "Continue execution"
  • "Kill the process"
  • "Terminate the LLDB session"

Supported Commands

Session Management

  • lldb_start: Start a new LLDB session
  • lldb_terminate: Terminate an LLDB session
  • lldb_list_sessions: List all active LLDB sessions

Program Loading

  • lldb_load: Load a program into LLDB
  • lldb_attach: Attach to a running process
  • lldb_load_core: Load a core dump file

Execution Control

  • lldb_run: Run the loaded program
  • lldb_continue: Continue program execution
  • lldb_step: Step to next line or instruction
  • lldb_next: Step over function calls
  • lldb_finish: Execute until the current function returns
  • lldb_kill: Kill the running process

Breakpoints and Watchpoints

  • lldb_set_breakpoint: Set a breakpoint
  • lldb_breakpoint_list: List all breakpoints
  • lldb_breakpoint_delete: Delete a breakpoint
  • lldb_watchpoint: Set a watchpoint on a variable or memory address

Inspection

  • lldb_backtrace: Show call stack
  • lldb_print: Print value of expression
  • lldb_examine: Examine memory
  • lldb_info_registers: Display registers
  • lldb_frame_info: Get detailed information about a stack frame
  • lldb_disassemble: Disassemble code
  • lldb_process_info: Get information about the current process

Thread Management

  • lldb_thread_list: List all threads in the current process
  • lldb_thread_select: Select a specific thread

Miscellaneous

  • lldb_command: Execute an arbitrary LLDB command
  • lldb_expression: Evaluate an expression in the current frame
  • lldb_help: Get help for LLDB commands

Example program

example/overflow.c contains an example C program that causes buffer overflow with certain arguments. Compile it using cc overflow.c and ask Claude to debug the issue with the resulting program:

I'm trying to debug my program a.out that is crashing with certain arguments, e.g. when I pass "hello".
Can you help me debug it?

Debugging Tips

  • Use lldb_command when you need to execute LLDB commands that don't have a dedicated function
  • Enable debug mode with --debug flag when starting the server for detailed logging
  • Sessions are automatically cleaned up when the server shuts down
  • Each session has a unique ID - make sure to use the correct ID when executing commands

Requirements

  • Python 3.7+
  • LLDB installed on the system
  • Claude desktop app with MCP support

Troubleshooting

  • If LLDB commands are timing out, check that LLDB is installed correctly
  • Verify the path to LLDB when starting a new session
  • Check for permission issues when attaching to processes
  • Review debug logs if commands aren't executing correctly

License

BSD 2-clause

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iflow_mcp_stass_lldb_mcp-0.1.0.tar.gz (711.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iflow_mcp_stass_lldb_mcp-0.1.0-py3-none-any.whl (717.1 kB view details)

Uploaded Python 3

File details

Details for the file iflow_mcp_stass_lldb_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: iflow_mcp_stass_lldb_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 711.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_stass_lldb_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d6b1f16219bbbfc52af9b17555742f269952f086f4c6ec8d1e98bf0a60cf89fd
MD5 8f2d75f3011d28ce163919bbd4857e05
BLAKE2b-256 d6ba15239ae25dacabe8ba93b12a43f676a477601b8fb6a0fcec01098b6dbf92

See more details on using hashes here.

File details

Details for the file iflow_mcp_stass_lldb_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: iflow_mcp_stass_lldb_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 717.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_stass_lldb_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 314f09eb17bbbd4e64100088ca8aa7f5ad239d819bc03c39c5f285b8d78c551b
MD5 cba49e996edca30a3247c8d96f601b4c
BLAKE2b-256 8626fa52f04b7be441777453625eda60662795d2b260325b742b556242361b82

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page