6809 GDB

GDB is a widely-used debugger, but it does not have built-in support for the MC6809. This page hosts a set of patches to add:

This allows GDB to connect to XRoar (when it is run with the -gdb option), automatically determing the architecture and (flexible) number of registers that an emulated machine can support and then disassemble, single step, set breakpoints & watchpoints and inspect memory. There is no support for high level language call stacks; m6809-gdb operates only as an assembly-level debugger.

Installation

Ensure you have all the dependencies installed (gmp, mpfr, libexpat).

Clone this git repository, which is a complete copy of the upstream GDB git repository with the necessary additions in a separate branch:

$ git clone -b m6809-17 https://www.6809.org.uk/git/binutils-gdb.git

Build & install with:

$ cd binutils-gdb
$ ./configure --target=m6809 --enable-targets=m6801 \
        --disable-readline --with-system-readline --disable-sim \
        --disable-ld --with-gnu-as=no
$ make
$ make install

The make install line should copy the binary into place with the name m6809-gdb.

As building for Windows is a bit more of a chore, here's a pre-built executable (version 17.x): m6809-gdb.exe.

Execution

Now fire up XRoar with the -gdb option, and try:

$ m6809-gdb
GNU gdb (GDB) 17.2.90.20260605-git
[...]
(gdb) target remote localhost:65520

Windows note: looks like localhost doesn't necessarily resolve by default on Windows. Try substituting 127.0.0.1 and add -gdb-ip 127.0.0.1 as an extra option to XRoar.

Using DDD

DDD (Data Display Debugger) is a graphical front-end for GDB. It can be started using m6809-gdb, and told to connect to XRoar on its default port:

$ ddd --debugger m6809-gdb --eval-command="target remote localhost:65520"

Please consult the documentation for GDB and DDD for more information on using these tools.

Acknowledgements

These patches have evolved over time with code and comments from Tormod Volden and Pere Serrat. They very much use existing targets as a reference (in particular the m68hc11 and z80 targets).

Updated 13 Jun 2026