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.

Debugging Rust Programs

gdbgui can be used to debug programs written in Rust. Assuming you use Cargo to create a new program and build it in Debug mode in the standard way:

cargo new myprog
cd myprog
cargo build

You can start debugging with a simple

gdbgui target/debug/myprog

There are a couple of small difficulties.

1.) Instead of showing your main function the initial screen will be blank and gdbgui will print File not found: main. You need to help gdbgui out by typing main into the file browser box:

and selecting the file. The source code should then appear in the browser and you can click to set breakpoints and run the program. Of course, if you want to break in some other file, you can find that in the file browser instead.

Note for macOS Users: When you load your rust binary on a mac, you may see many warnings like this

warning /Users/user/examples/rust/target/debug/deps/hello-486956f9dde465e5.9elsx31vb4it187.rcgu.o': can't open to read symbols: No such file or directory.

Symbols are names of variables, functions and types defined in your program. You can define symbols for your program by loading symbol files. gdb usually does this automatically for you, but sometimes has trouble finding the right paths.

In this case, you need to manually tell gdb where the symbol files is; it's usually the first part of the missing file. In the above example, it's hello-486956f9dde465e5.9elsx31vb4it187.rcgu.o.

You can load this into gdb with the following command (changed as appropriate):

symbol-file /Users/user/git/gdbgui/examples/rust/target/debug/deps/hello-486956f9dde465e5

2.) The GDB pretty-printing macros that Rust ships with. GDB can't find these by default, which makes it print the message

warning: Missing auto-load script at offset 0 in section .debug_gdb_scripts of file /home/phil/temp/myprog/target/debug/myprog.
Use `info auto-load python-scripts [REGEXP]' to list them.

You can safely ignore this, but the Rust issue describes the workarounds necessary (create a .gdbinit file and paste a few lines into the Python helper script).

and now gdb will be able to see which files were used to compile your binary, among other things.

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 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.


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: gdbgui [-h] [-g GDB] [--gdb-args GDB_ARGS] [--rr] [-p PORT]
              [--host HOST] [-r] [--auth-file AUTH_FILE] [--user USER]
              [--password PASSWORD] [--key KEY] [--cert CERT]
              [--remap-sources REMAP_SOURCES] [--project PROJECT] [-v]
              [--hide-gdbgui-upgrades] [-n] [-b BROWSER] [--license LICENSE]
              [--debug] [--args ...]

A server that provides a graphical user interface to the gnu debugger (gdb).

positional arguments:
  cmd                   The executable file and any arguments to pass to it.
                        To pass flags to the binary, wrap in quotes, or use
                        --args instead. Example: gdbgui ./mybinary [other-
                        gdbgui-args...] Example: gdbgui './mybinary myarg
                        -flag1 -flag2' [other gdbgui args...]

optional arguments:
  -h, --help            show this help message and exit
  --args ...            Specify the executable file and any arguments to pass
                        to it. All arguments are taken literally, so if used,
                        this must be the last argument passed to gdbgui.
                        Example: gdbgui [...] --args ./mybinary myarg -flag1

gdb settings:
  -g GDB, --gdb GDB     Path to debugger. Default: gdb
  --gdb-args GDB_ARGS   Arguments passed directly to gdb when gdb is invoked.
                        For example,--gdb-args="--nx --tty=/dev/ttys002"
  --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

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:
  -r, --remote          Shortcut to set host to 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
  --cert CERT           SSL certificate. Generate with:openssl req -newkey
                        rsa:2048 -nodes -keyout host.key -x509 -days 365 -out

other settings:
  --remap-sources REMAP_SOURCES, -m REMAP_SOURCES
                        Replace compile-time source paths to local source
                        paths. Pass valid JSON key/value pairs.i.e. --remap-
                        sources='{"/buildmachine": "/home/chad"}'
  --project PROJECT     Set the project directory. When viewing the "folders"
                        pane, paths are shown relative to this directory.
  -v, --version         Print version
                        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.
  -b BROWSER, --browser BROWSER
                        Use the given browser executable instead of the system
  --license LICENSE     Store gdbgui ad-free license key.
  --debug               The debug flag of this Flask application. Pass this
                        flag when debugging gdbgui itself to automatically
                        reload the server when changes are detected