Skip to main content
Glama

LLDB-MCP

BSD 2-Clause "Simplified" License
1

LLDB-MCP

截屏

在这里的 acton 中查看它,自动调试缓冲区溢出: https://x.com/full\ _duplex/status/1904770477698277847

概述

LLDB-MCP 是一款将 LLDB 调试器与 Claude 的模型上下文协议 (MCP) 集成的工具。这种集成允许 Claude 直接启动、控制 LLDB 调试会话并与之交互,从而实现 AI 辅助调试工作流程。

该工具提供了一套用于使用 LLDB 的全面命令,包括:

  • 启动和管理 LLDB 会话
  • 加载程序进行调试
  • 设置断点和观察点
  • 控制程序执行
  • 检查内存、寄存器和变量
  • 分析堆栈跟踪和程序状态

特征

  • 创建和管理多个 LLDB 调试会话
  • 加载可执行文件并附加到正在运行的进程
  • 加载核心转储文件进行事后分析
  • 执行任意 LLDB 命令
  • 对程序执行的细粒度控制
  • 内存检查与拆解
  • 线程和堆栈框架检查

安装

  1. 克隆存储库:
    git clone https://github.com/stass/lldb-mcp.git cd lldb-mcp
  2. 安装依赖项:
    pip install mcp
  3. 配置 Claude 使用 LLDB-MCP 服务器:
    • 打开Claude桌面应用程序配置
    • 将以下内容添加到您的 MCP 配置中:GXP3

用法

一旦安装并配置完毕,您就可以使用自然语言通过 Claude 与 LLDB 进行交互。

基本工作流程

  1. 启动新的 LLDB 会话
  2. 加载程序
  3. 设置断点
  4. 运行程序
  5. 检查变量和内存
  6. 控制执行(继续、步骤、下一步等)
  7. 完成后终止会话

示例命令

以下是一些通过 Claude 与 LLDB-MCP 交互的示例:

  • “启动一个新的 LLDB 会话”
  • “加载程序‘/path/to/executable’”
  • “在主窗口设置断点”
  • “运行程序”
  • “显示回溯”
  • “打印变量‘count’的值”
  • “跨过下一行”
  • “检查地址 0x1000 处的内存”
  • “显示寄存器值”
  • “继续执行”
  • “终止进程”
  • “终止 LLDB 会话”

支持的命令

会话管理

  • lldb_start :启动新的 LLDB 会话
  • lldb_terminate :终止 LLDB 会话
  • lldb_list_sessions :列出所有活动的 LLDB 会话

程序加载

  • lldb_load :将程序加载到 LLDB
  • lldb_attach :附加到正在运行的进程
  • lldb_load_core :加载核心转储文件

执行控制

  • lldb_run :运行已加载的程序
  • lldb_continue :继续程序执行
  • lldb_step :跳至下一行或下一条指令
  • lldb_next :跳过函数调用
  • lldb_finish :执行直到当前函数返回
  • lldb_kill :终止正在运行的进程

断点和观察点

  • lldb_set_breakpoint :设置断点
  • lldb_breakpoint_list :列出所有断点
  • lldb_breakpoint_delete :删除断点
  • lldb_watchpoint :在变量或内存地址上设置观察点

检查

  • lldb_backtrace :显示调用堆栈
  • lldb_print :打印表达式的值
  • lldb_examine :检查内存
  • lldb_info_registers :显示寄存器
  • lldb_frame_info :获取有关堆栈帧的详细信息
  • lldb_disassemble :反汇编代码
  • lldb_process_info :获取有关当前进程的信息

线程管理

  • lldb_thread_list :列出当前进程中的所有线程
  • lldb_thread_select :选择特定线程

各种各样的

  • lldb_command :执行任意 LLDB 命令
  • lldb_expression :在当前帧中评估表达式
  • lldb_help :获取 LLDB 命令的帮助

示例程序

example/overflow.c包含一个示例 C 程序,该程序在调用某些参数时会导致缓冲区溢出。使用cc overflow.c编译该程序,并让 Claude 使用生成的程序来调试问题:

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?

调试技巧

  • 当您需要执行没有专用功能的 LLDB 命令时,请使用lldb_command
  • 启动服务器时使用--debug标志启用调试模式以获取详细日志记录
  • 服务器关闭时会话会自动清理
  • 每个会话都有一个唯一的 ID - 确保在执行命令时使用正确的 ID

要求

  • Python 3.7+
  • 系统上安装的LLDB
  • 支持 MCP 的 Claude 桌面应用程序

故障排除

  • 如果 LLDB 命令超时,请检查 LLDB 是否正确安装
  • 启动新会话时验证 LLDB 的路径
  • 附加到进程时检查权限问题
  • 如果命令未正确执行,请查看调试日志

执照

BSD 2 条款

-
security - not tested
A
license - permissive license
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

LLDB 的 MCP 服务器,允许自动分析、调试和反汇编本机应用程序。

  1. 概述
    1. 特征
      1. 安装
        1. 用法
          1. 基本工作流程
          2. 示例命令
        2. 支持的命令
          1. 会话管理
          2. 程序加载
          3. 执行控制
          4. 断点和观察点
          5. 检查
          6. 线程管理
          7. 各种各样的
        3. 示例程序
          1. 调试技巧
            1. 要求
              1. 故障排除
                1. 执照

                  Related MCP Servers

                  • -
                    security
                    A
                    license
                    -
                    quality
                    A Python-based MCP server that allows Claude and other LLMs to execute arbitrary Python code directly through your desktop Claude app, enabling data scientists to connect LLMs to APIs and executable code.
                    Last updated -
                    23
                    MIT License
                    • Apple
                    • Linux
                  • -
                    security
                    A
                    license
                    -
                    quality
                    A GDB/MI protocol server based on the MCP protocol, providing remote application debugging capabilities.
                    Last updated -
                    19
                    Rust
                    MIT License
                    • Linux
                    • Apple
                  • A
                    security
                    A
                    license
                    A
                    quality
                    MCP server for reverse engineering that enables interaction with IDA Pro for analysis tasks such as decompilation, disassembly, and memory engagement reports.
                    Last updated -
                    24
                    28
                    Python
                    MIT License
                  • -
                    security
                    A
                    license
                    -
                    quality
                    An MCP server that allows LLMs to autonomously reverse engineer applications by exposing Ghidra functionality, enabling decompilation, analysis, and automatic renaming of methods and data.
                    Last updated -
                    4,290
                    Apache 2.0
                    • Apple

                  View all related MCP servers

                  MCP directory API

                  We provide all the information about MCP servers via our MCP API.

                  curl -X GET 'https://glama.ai/api/mcp/v1/servers/stass/lldb-mcp'

                  If you have feedback or need assistance with the MCP directory API, please join our Discord server