gdbgui: GDB on the web

Posted on Jul 22, 2022

⬅️ Back to Intro

⬅️ Prev Post

gdbgui is a “browser-based frontend to gdb.” It includes a gdb console so that any actions that can’t be performed by the GUI can still be done.

gdbgui demo

Why not make a VS Code remote server? VS Code only officially supports Ubuntu 16.04+, and while it is possible to run it on 14.04 by upgrading glibc & libstdc++ manually, the resulting experience is pretty bad on the DE1 (very sluggish and high CPU usage). I wasn’t sure if this was a slow hardware or old software issue so eventually I just gave up.

Installing gdbgui 0.9.0

I’ve found version 0.9.0 (or 0.8.0) of gdbgui to be the most stable. Anything above 0.9.0 doesn’t work due to a known bug with old versions of gdb.

gdbgui is distributed as a Python package on pypi. 0.9.0 requires at least Python 3.4. Python 3.4 is available in the trusty Ubuntu repository, so you’ll need to be running Ubuntu 14.04 to install it (see my previous post).

If you haven’t already, the first step is to install/update Python:

$ apt-get install python3 python3-pip

I also chose to use virtual environments as it’s really easy to break the system interpreter.

$ apt-get install python3-virtualenv

Python Dependencies

When installing package dependencies, Pip by default will install the latest version of the dependency. This is a problem since we’re using an old version of Python. So we need to make sure that all dependencies (including those belonging to other dependencies) are compatible with Python 3.4.

Fortunately (for you), I’ve gone through the trouble of determining all the required versions:

# requirements.txt for gdb 0.9.0
Flask == 0.12.2
Flask-SocketIO == 2.9.2
Flask-Compress == 1.4.0
pygdbmi == 0.8
pypugjs == 5.0.1
Jinja2 == 2.8
MarkupSafe == 0.20
gevent == 1.2.2
eventlet == 0.21.0
Pygments == 2.2.0
greenlet == 0.4.10
six == 1.10.0
python-engineio == 1.0.0 
python-socketio == 1.6.1
click == 2.0.0
itsdangerous == 0.21
Werkzeug == 0.12

gdbgui == 0.9.0

Finally, you can install gdbgui with the following commands:

# create and activate virtual env
$ virtualenv -p python3 venv/
$ source venv/bin/activate

# install gdbgui via requirements.txt
(venv) $ pip3 install -r requirements.txt

Running gdbgui

You can run gdbgui on an executable (compiled with debug symbols) normally as you would with gdb:

(venv) $ g++ hello_world.cpp -o hello_world -g
(venv) $ gdbgui --host de1soc.local hello_world
Opening gdbgui in browser at http://de1soc.local:5000
exit gdbgui by pressing CTRL+C

This will create a server with address http://de1soc.local:5000 (assuming the hostname of your device is de1soc)

⬅️ Prev Post