Skip to main content

Harness the power of ChatGPT directly inside the GDB debugger!

Project description

ChatGDB

Harness the power of ChatGPT inside the GDB/LLDB debugger!

ChatGDB is a tool designed to superpower your debugging experience with GDB or LLDB, debuggers for compiled languages. Use it to accelerate your debugging workflow by leveraging the power of ChatGPT to assist you while using GDB/LLDB!

It allows you to explain in natural language what you want to do, and then automatically execute the relevant command. Optionally, you can ask ChatGPT to explain the command it just ran or even pass in any question for it to answer. Focus on what's important - figuring out that nasty bug instead of chasing down GDB/LLDB commands at the tip of your tongue.

Image

Contents

  1. Installation
  2. Updating
  3. Usage
  4. Contributing
  5. Getting Updates

Installation instructions

First, make sure you install pip. ChatGDB also requires a python version of 3.3 or above.

To install, run the command

pip3 install chatgdb.

It will create an executable called chatgdb that you will have to use to set your api key. To do that, run the command

chatgdb -k <API KEY>

Without the API key, you won't be able to make requests to OpenAI. The API key is stored in text in the same directory as the installed script, which is currently in your python site packages folder along with the main script. You can easily find this location by running the following in your terminal:

python -m site --user-site

Optionally, you can also download the compressed files in the releases page to get the scripts directly. If you do this, navigate to the chatgdb folder, and you can install with

pip3 install ..

Updating

To update ChatGDB, run the following

pip3 install chatgdb --upgrade

Usage

For GDB usage, I first recommend editing your $HOME/.gdbinit to source the main script automatically on startup. Run the following command:

echo "source $(python -m site --user-site)/chatgdb/gdb.py" > $HOME/.gdbinit

The same applies for LLDB. Edit your $HOME/.lldbinit and run the following command:

echo "command script import $(python -m site --user-site)/chatgdb/lldb.py" > $HOME/.lldbinit

While inside your debugger, you can run the command chat appended by your query, for example chat list all breakpoints that I created. There is also a command called explain that you can use with no arguments to explain the previously run command, and optionally, with a query to just ask GPT a question. For example, running explain directly after running break 7 would prompt the tool to explain how breakpoints work. Running explain how input formatting works in gdb would prompt it to explain input formatting (see the image at the top).

Run chat help to print out a short tutorial on how to use the tool.

Contributing

Thanks for your interest in contributing to ChatGDB! See CONTRIBUTING.md on ways to help the development effort.

Staying Updated

If you'd like to stay up-to-date on new features/fixes, follow my twitter. There's plenty of exciting features on the horizon such as complete context-awareness that will make it possible for ChatGDB to not only help you use GDB, but to help you fix the code itself.

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

chatgdb-1.1.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

chatgdb-1.1.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file chatgdb-1.1.0.tar.gz.

File metadata

  • Download URL: chatgdb-1.1.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.10 Linux/6.2.9-arch1-1

File hashes

Hashes for chatgdb-1.1.0.tar.gz
Algorithm Hash digest
SHA256 7f1fdbc474435246bfb5787ab3db65fa79e8cb2c6814d90d8149c9f9e0c707f3
MD5 e480311f31716fdaa8e0aa1f7d98fc4d
BLAKE2b-256 96f2eb903d8eab848fd1e7af655529462c76d3d0e05d89b410e3867803eee805

See more details on using hashes here.

File details

Details for the file chatgdb-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: chatgdb-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.10 Linux/6.2.9-arch1-1

File hashes

Hashes for chatgdb-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae22ce9cc27bce5feb4d4db6ad675129d5392602f4b28f15e3aba5bad953fe96
MD5 ca49a3a722434d06a13841a46ec63614
BLAKE2b-256 14d1eba2950378a3c806767427309224244e1e9c2caeada61b951f582128826d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page