Running Locally

After downloading gdbgui, you can launch it like so:

See more examples when launching here.

A new tab in your browser will open with gdbgui in it. If a browser tab did not open, navigate to the ip/port that gdbgui is being served on (i.e. http://localhost:5000).

Now that gdbgui is open, you can interactively run a program with it.

For a list of gdbgui arguments, see the Arguments section below or type gdbgui --help.

Running gdbgui Remotely

Because gdbgui is a server, it naturally allows you to debug programs running on other computers.

Connecting to gdbserver

Like gdb, gdbserver is also made by gnu, but with the following important differences:

gdbserver runs on a remote machine or embedded target, which, as the name suggests, runs a server. gdb communicates with gdbserver so you can debug on your local machine. To do this, the remote machine must run the server and program:

gdbserver 0.0.0.0:9000 mybinary.a

Then you can launch gdb or gdbgui and connect to it. In gdbgui, use the dropdown to select Connect to gdbserver, and enter

<remote ip address>:9000

Read more at the gdbserver homepage.

Settings

gdbgui settings can be accessed by clicking the gear icon in the top right of the frontend. Most of these settings persist between sessions for a given url and port.

Keyboard Shortcuts

The following keyboard shortcuts are available when the focus is not in an input field. They have the same effect as when the button is pressed.

Debugging Faults

If your program exits unexpectedly from something like a SEGFAULT, gdbgui displays a button in the console to re-enter the state the program was in when it exited. This allows you to inspect the stack, the line on which the program exited, memory, variables, registers, etc.

Command line API

This is the output of the commandgdbgui -horgdbgui --help

usage: backend.py [-h] [--args ARGS [ARGS ...]] [-x GDB_CMD_FILE] [-g GDB]
                  [--rr] [-p PORT] [--host HOST] [-r] [--auth-file AUTH_FILE]
                  [--user USER] [--password PASSWORD] [--key KEY]
                  [--cert CERT] [--license LICENSE] [--project PROJECT] [-v]
                  [--hide_gdbgui_upgrades] [-n] [--debug]
                  [cmd [cmd ...]]

A server that provides a graphical user interface to the gnu debugger (gdb).
https://github.com/cs01/gdbgui

optional arguments:
  -h, --help            show this help message and exit

gdb commands:
  cmd                   The binary and arguments to run in gdb. Example:
                        './mybinary myarg -flag1 -flag2'
  --args ARGS [ARGS ...]
                        Alias for cmd argument above. Example: gdbgui --args
                        "./mybinary myarg -flag1 -flag2"
  -x GDB_CMD_FILE, --gdb_cmd_file GDB_CMD_FILE
                        Execute GDB commands from file.
  -g GDB, --gdb GDB     Path to debugger. Default: gdb
  --rr                  Use `rr replay` instead of gdb. Replays last recording
                        by default. Replay arbitrary recording by passing
                        recorded directory as an argument. i.e. gdbgui
                        /recorded/dir --rr. See http://rr-project.org/.

gdbgui network settings:
  -p PORT, --port PORT  The port on which gdbgui will be hosted. Default: 5000
  --host HOST           The host ip address on which gdbgui serve. Default:
                        127.0.0.1
  -r, --remote          Shortcut to set host to 0.0.0.0 and suppress browser
                        from opening. This allows remote access to gdbgui and
                        is useful when running on a remote machine that you
                        want to view/debug from your local browser, or let
                        someone else debug your application remotely.

security settings:
  --auth-file AUTH_FILE
                        Require authentication before accessing gdbgui in the
                        browser. Specify a file that contains the HTTP Basic
                        auth username and password separate by newline.
  --user USER           Username when authenticating
  --password PASSWORD   Password when authenticating
  --key KEY             SSL private key. Generate with:openssl req -newkey
                        rsa:2048 -nodes -keyout host.key -x509 -days 365 -out
                        host.cert
  --cert CERT           SSL certificate. Generate with:openssl req -newkey
                        rsa:2048 -nodes -keyout host.key -x509 -days 365 -out
                        host.cert

other settings:
  --license LICENSE     Store gdbgui ad-free license key.
  --project PROJECT     Set the project directory. When viewing the "folders"
                        pane, paths are shown relative to this directory.
  -v, --version         Print version
  --hide_gdbgui_upgrades
                        Hide messages regarding newer version of gdbgui.
                        Default: False.
  -n, --no_browser      By default, the browser will open with gdbgui. Pass
                        this flag so the browser does not open.
  --debug               The debug flag of this Flask application. Pass this
                        flag when debugging gdbgui itself to automatically
                        reload the server when changes are detected