6809 GDB

XRoar will now operate as a GDB remote target when run with the -gdb option. This allows remote memory & register inspection/modification, breakpoints and some extended queries.

Some basic commands can be used to interact with it from any recent GDB, but it's better if GDB itself supports 6809 disassembly. Here is a git repository containing a clone of GDB, and the necessary additions in a separate branch. Thanks to Tormod Volden, this is now easier to rebase against more recent versions, and the current patch is now against GDB 15.2.

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

Build & install with:

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

The resulting binary should be named m6809-gdb.

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

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

$ m6809-gdb
GNU gdb (GDB) 15.2
[...]
(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.

2024-11-13: Rebased and updated patch to work against GDB 15.2.

2024-02-03: Tormod Volden has done the work to forward port this patch to the current version of GDB.

2020-06-14: Pere Serrat reported that 6309 registers were not displaying properly. Hopefully fixed in the m6809-7.6 branch.

2016-05-30: This repository has changed because the source repository for GDB changed. It is now based on git://sourceware.org/git/binutils-gdb.git. Note that rebasing onto the current master will likely now fail, as GDB has changed architecturally somewhat since this branch was made.

2014-04-21: Tormod Volden has pointed out an issue with long branch disassembly - hopefully fixed in the m6809-7.6 branch.

Using DDD

At the time of writing, DDD requires a patch to work with newer versions of GDB. The Debian build contains the patch, but for your convenience, I've copied it here.

Once built, DDD can be started using m6809-gdb as its debugger, 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.

Updated 13 Nov 2024