Skip to main content

Natural language interface for GDB

Project description

AgentGDB

Supercharge your GDB debugging with the power of LLMs!

AgentGDB is a tool that brings natural language understanding to the GDB debugger. Describe what you want to do in plain English, and AgentGDB will translate your request into the appropriate GDB commands. Focus on solving bugs, not memorizing debugger syntax!

AgentGDB Screenshot

Contents

  1. Installation
  2. Updating
  3. Usage
  4. Features
  5. Contributing

Installation

You can install AgentGDB using pip:

pip install agentgdb

Alternatively, you can install from source:

git clone https://github.com/jjravi/AgentGDB.git
cd AgentGDB
python -m venv openai-env
source openai-env/bin/activate
pip install -e .

You'll need to have GDB installed on your system.

Updating

To update AgentGDB, simply run:

pip install -U agentgdb

Or if installed from source:

git pull origin main
pip install -e .

Usage

To use AgentGDB, you need to configure GDB to find the AgentGDB package and its dependencies. The recommended way is to add the following to your ~/.gdbinit file:

# In ~/.gdbinit
python
import sys
import subprocess
import os

try:
    env_python = "python3"  # Or "python", or e.g., "/path/to/venv/bin/python"

    paths_str = subprocess.check_output(
        [env_python, "-c", "import sys, os; print(os.linesep.join(sys.path))"],
        stderr=subprocess.PIPE
    ).decode("utf-8")

    for p in paths_str.split(os.linesep):
        if p and os.path.isdir(p) and p not in sys.path:
            sys.path.append(p)

    import agentgdb
    gdb.execute(f"source {agentgdb.MAIN_SCRIPT_PATH}") # load config and register GDB commands.

except FileNotFoundError:
    print(f"[AgentGDB] Error: Python executable '{env_python}' not found. Please check the path in your .gdbinit.")
except subprocess.CalledProcessError as e:
    error_message = e.stderr.decode().strip() if e.stderr else str(e)
    print(f"[AgentGDB] Error getting sys.path from '{env_python}': {error_message}")
    print(f"[AgentGDB] Ensure '{env_python}' is a valid Python interpreter and has the 'agentgdb' package and its dependencies (like 'openai') installed.")
except ImportError:
    print("[AgentGDB] Error: Could not import 'agentgdb' package after setting sys.path.")
    print(f"[AgentGDB] This usually means 'agentgdb' is not installed in the Python environment targeted by '{env_python}'.")
except Exception as e:
    print(f"[AgentGDB] An unexpected error occurred during AgentGDB setup: {e}")

end

Once your ~/.gdbinit is configured, start GDB as usual:

gdb your_program

Then, you can use the natural language commands:

  • agent: Executes the command directly
  • ask: Shows the suggested command and asks for confirmation before execution

Examples:

(gdb) agent show all breakpoints
(gdb) ask print the value of variable x

Features

  • Natural Language to GDB: Describe your intent, and AgentGDB figures out the command.
  • Multi-stage Processing:
    1. Classifies your query into GDB command categories
    2. Gets help for relevant command class
    3. Selects the most appropriate command
    4. Gets detailed help for the selected command
    5. Generates the exact GDB command to accomplish your intent
  • Two Interaction Modes: Direct execution with agent or confirmation-based with ask
  • Streaming Output: See the LLM's thought process and command generation in real time.

Contributing

Contributions are welcome! Please open issues or pull requests on GitHub.


Note: AgentGDB is under active development. Feedback and suggestions are highly appreciated!

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

agentgdb-0.1.4.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

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

agentgdb-0.1.4-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file agentgdb-0.1.4.tar.gz.

File metadata

  • Download URL: agentgdb-0.1.4.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for agentgdb-0.1.4.tar.gz
Algorithm Hash digest
SHA256 b0c721e45ceb1211cbe2c4614008b7bb0f96038aa8d3f8baa9a887c24de330c5
MD5 d334c59f03c88d4241c1631c5080de74
BLAKE2b-256 58066a797bd714d70e71bd5df3d018f59b8c195a6d3f185c24edd92436f592a9

See more details on using hashes here.

File details

Details for the file agentgdb-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: agentgdb-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for agentgdb-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 da4e71bced43560f52e2109a040f3bedf93fea0941381a70788b725223490d13
MD5 090359bffbfb802f5ec50b03fa10c462
BLAKE2b-256 3662e033e33184713d3c0f80cdc6a720730f5de4c0ee1d59796505afc63d10c0

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