Cover image
Try Now
2025-04-07

Un serveur MCP pour le débogage GDB.

3 years

Works with Finder

1

Github Watches

0

Github Forks

1

Github Stars

GDB MCP Server

https://github.com/user-attachments/assets/1bac46ee-4054-432d-95b8-660c9062d863

An MCP server written in MCP python SDK that enables LLMs to interact with GDB for program debugging and analysis. This tool allows LLMs to perform complex debugging tasks through a generative AI interface.

Features

  • Session Management

    • Start and manage multiple GDB sessions
    • Load programs and core dumps
    • Attach to running processes
  • Debugging Commands

    • Set breakpoints with conditions
    • Step through code (step, next, finish)
    • Continue execution
    • Get backtraces
    • Print variable values
    • Disassemble code
    • List available functions
    • Inspect registers
  • Advanced Features

    • Multi-session support
    • Working directory configuration
    • Program argument handling
    • Core dump analysis
    • Symbol inspection

Note: The info functions and disassemble commands are temporarily disabled due to GDB Machine Interface (MI) output parsing issues. These features will be restored in a future update once the output parsing is properly implemented.

Project Status

  • For known issues and current bugs, see BUGS.md
  • For planned improvements and features, see TODO.md

Tools Available

GDB_COMMANDS = [
    gdb_start,
    gdb_load,
    gdb_run,
    gdb_command,
    gdb_attach,
    gdb_load_core,
    gdb_set_breakpoint,
    gdb_continue,
    gdb_step,
    gdb_next,
    gdb_finish,
    gdb_backtrace,
    gdb_print,
    gdb_disassemble,
    gdb_info_registers,
    gdb_info_functions,
    gdb_list_sessions,
    gdb_terminate,
]

Installation

  1. Clone the repository:
git clone https://github.com/smadi0x86/gdb-mcp.git
cd gdb-mcp
  1. Install dependencies using Poetry:
poetry install
  1. Install the package in development mode:
poetry install

Usage

  1. Start the GDB MCP server:
python3 gdb-mcp.py
  1. The server will run on stdio, ready to accept commands.

LLM Client Configuration

For Claude Desktop

Add this configuration to your claude_desktop_config.json:

{
  "mcpServers": {
     "gdb": {
    "command": "python3",
    "args": ["/home/your-username/dev/personal/gdb-mcp/gdb-mcp.py"]
    }
  }
}

For VS Code Copilot

Add this configuration to your VS Code settings:

{
  "mcp": {
    "inputs": [],
    "servers": {
      "gdb": {
        "command": "python3",
        "args": ["/home/your-username/dev/personal/gdb-mcp/gdb-mcp.py"]
      }
    }
  }
}

Testing with Example Program

  1. Compile the example program with debug symbols:
gcc -g example.c -o example
  1. Use this prompt with your LLM client:
I have a binary at /path/to/example that I need to analyze. I don't have access to the source code. Please help me understand and debug this program using GDB.

1. Start a GDB session and load the binary
2. Use info functions to discover what functions are available
3. For each interesting function:
   - Disassemble it to understand its behavior
   - Set breakpoints at key instructions
   - Run the program and examine variables at breakpoints
4. When the program crashes or exhibits unexpected behavior:
   - Get a backtrace
   - Examine registers and variables
   - Help me understand what might be causing the issue

For each step:
- Explain what we're doing and why
- Show me the disassembly or variable values
- Help me interpret what we're seeing
- Suggest next steps based on our findings

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

This project is licensed under the GNU v3 License - see the LICENSE file for details.

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • https://appia.in
  • Siri Shortcut Finder – your go-to place for discovering amazing Siri Shortcuts with ease

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • tomoyoshi hirata
  • Sony α7IIIマニュアルアシスタント

  • apappascs
  • Découvrez la collection la plus complète et la plus à jour de serveurs MCP sur le marché. Ce référentiel sert de centre centralisé, offrant un vaste catalogue de serveurs MCP open-source et propriétaires, avec des fonctionnalités, des liens de documentation et des contributeurs.

  • ShrimpingIt
  • Manipulation basée sur Micropython I2C de l'exposition GPIO de la série MCP, dérivée d'Adafruit_MCP230XX

  • jae-jae
  • MCP Server pour récupérer le contenu de la page Web à l'aide du navigateur sans tête du dramwright.

  • ravitemer
  • Un puissant plugin Neovim pour gérer les serveurs MCP (Protocole de contexte modèle)

  • patruff
  • Pont entre les serveurs Olllama et MCP, permettant aux LLM locaux d'utiliser des outils de protocole de contexte de modèle

  • pontusab
  • La communauté du curseur et de la planche à voile, recherchez des règles et des MCP

  • av
  • Exécutez sans effort LLM Backends, API, Frontends et Services avec une seule commande.

  • WangRongsheng
  • 🧑‍🚀 全世界最好的 LLM 资料总结 (数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Résumé des meilleures ressources LLM du monde.

  • Mintplex-Labs
  • L'application tout-en-un desktop et Docker AI avec chiffon intégré, agents AI, constructeur d'agent sans code, compatibilité MCP, etc.

  • modelcontextprotocol
  • Serveurs de protocole de contexte modèle

    Reviews

    4 (1)
    Avatar
    user_kBtk9TA8
    2025-04-17

    GDB-MCP by smadi0x86 is an outstanding tool for multi-core debugging in GDB. It significantly enhances efficiency and effectiveness in complex debugging scenarios. The seamless integration and user-friendly interface make it an indispensable tool for developers working on multi-threaded applications. Highly recommend checking it out: https://github.com/smadi0x86/GDB-MCP.