SuperAPIAI Directory

lldb-mcp

github.com · AI coding

LLDB integration for binary and core file analysis, debugging and disassembly.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)

About this tool

LLDB-MCP is a tool that integrates the LLDB debugger with Claude's Model Context Protocol (MCP). Through this integration, Claude can directly start, control, and interact with LLDB debugging sessions, thereby supporting AI-assisted debugging workflows.

Purpose

LLDB-MCP is designed to enable AI assistants (such as Claude) to operate the LLDB debugger through natural language, for binary and core file analysis, debugging, and disassembly. It is suitable for scenarios that require AI-assisted program debugging, crash analysis, memory inspection, and more.

Main Capabilities

This tool provides a comprehensive set of commands, covering the following aspects:

  • Start and manage LLDB sessions
  • Load programs for debugging
  • Set breakpoints and watchpoints
  • Control program execution
  • Inspect memory, registers, and variables
  • Analyze stack traces and program state
  • 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 inspection and disassembly
  • Thread and stack frame inspection

Usage

  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 application configuration
    • Add the following to the MCP configuration:
      "mcpServers" : {
        "lldb-mcp" : {
          "command" : "python3",
          "args" : ["/path/to/lldb-mcp/lldb_mcp.py"],
          "disabled" : false
        }
      }
      
  4. After installation and configuration are complete, you can interact with LLDB through Claude using natural language.

Example Commands

The following are examples of interacting 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 the next line or instruction
  • lldb_next: Step over function calls
  • lldb_finish: Execute until the current function returns
  • lldb_kill: Terminate 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
  • lldb_backtrace: Show the call stack
  • lldb_print: Print the value of an expression
  • lldb_examine: Examine memory
  • lldb_info_registers: Show 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
  • 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 a buffer overflow with specific arguments. Use cc overflow.c to compile it, and have Claude debug the issue using the resulting program.

Usage tips

  • When you need to execute an LLDB command that has no dedicated function, use lldb_command.
  • Use the --debug flag when starting the server to enable debug mode for detailed logs.
  • 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

  • LLDB is installed on the system
  • Claude desktop application with MCP support

Troubleshooting

  • If LLDB commands time out, check whether LLDB is installed correctly.
  • Verify the LLDB path when starting a new session.
  • Check for permission issues when attaching to a process.
  • If commands are not executed correctly, check the debug logs.
Up/Down to navigate · Enter to open · ESC to closeBrowse all tools