gdb自然调试器
为与克劳德或其他人工智能助手一起使用提供GDB调试功能,允许用户通过自然语言管理调试会话、设置断点、检查变量和执行GDB命令。
服务介绍
MCP GDB 服务器
一个提供 GDB 调试功能的 Model Context Protocol (MCP) 服务器,用于与 Claude 或其他 AI 助手配合使用。
特性
- 启动和管理 GDB 调试会话
- 加载程序和核心转储以进行分析
- 设置断点、单步执行代码并检查内存
- 查看调用堆栈、变量和寄存器
- 执行任意 GDB 命令
安装
# Clone the repository
git clone https://github.com/signal-slot/mcp-gdb.git
cd mcp-gdb
# Install dependencies
npm install
# Build the project
npm run build
使用方法
与 Claude 或其他支持 MCP 的助手一起使用
- 在 Claude 桌面应用程序或浏览器扩展中配置 MCP 设置,以包含此服务器:
{
"mcpServers": {
"gdb": {
"command": "node",
"args": ["/path/to/mcp-gdb/build/index.js"],
"disabled": false
}
}
}
-
重启 Claude 或刷新页面。
-
现在你可以在与 Claude 的对话中使用 GDB 工具了。
示例命令
以下是一些通过 Claude 使用 GDB MCP 服务器的示例:
启动 GDB 会话
Use gdb_start to start a new debugging session
加载程序
Use gdb_load to load /path/to/my/program with the sessionId that was returned from gdb_start
设置断点
Use gdb_set_breakpoint to set a breakpoint at main in the active GDB session
运行程序
Use gdb_continue to start execution
检查变量
Use gdb_print to evaluate the expression "my_variable" in the current context
获取回溯
Use gdb_backtrace to see the current call stack
终止会话
Use gdb_terminate to end the debugging session
支持的 GDB 命令
gdb_start: 启动一个新的 GDB 会话gdb_load: 将程序加载到 GDB 中gdb_command: 执行任意 GDB 命令gdb_terminate: 终止 GDB 会话gdb_list_sessions: 列出所有活动的 GDB 会话gdb_attach: 附加到正在运行的进程gdb_load_core: 加载核心转储文件gdb_set_breakpoint: 设置断点gdb_continue: 继续程序执行gdb_step: 单步执行程序gdb_next: 跨过函数调用gdb_finish: 执行直到当前函数返回gdb_backtrace: 显示调用堆栈gdb_print: 打印表达式的值gdb_examine: 检查内存gdb_info_registers: 显示寄存器
许可证
MIT