This PR adds a GDB-compatible remote debug stub to the standard libraries, enabling remote debugging of rosco_m68k programs on both real hardware and in MAME, using the second serial channel.
Usage
To use the debugging capability, add the library to your build with -lgdb. Then, in your code, initialise the debugger and call breakpoint to trigger a wait-for-attach:
#include <debug.h>
// ... later
if (start_debugger()) {
printf("Start debugger; Connect via GDB\n");
breakpoint();
} else {
printf("Unable to start debugger :(\n");
}
When this program is run, it will wait for the remote debugger to attach. Start gdb on your host system:
gdb -b 115200
I have found that commands like the following, placed into a .gdbinit, are very useful to save on typing:
set arch m68k
file gdbtest.elf
add-symbol-file ../../firmware/rosco_m68k_firmware/rosco_m68k.elf
target remote /dev/cu.usbserial-5
Features
Supported
Execution control, incl tracing / single-step (c, s, si etc.)
Static breakpoints (with the breakpoint() function)
What is this?
This PR adds a GDB-compatible remote debug stub to the standard libraries, enabling remote debugging of rosco_m68k programs on both real hardware and in MAME, using the second serial channel.
Usage
To use the debugging capability, add the library to your build with
-lgdb
. Then, in your code, initialise the debugger and callbreakpoint
to trigger a wait-for-attach:When this program is run, it will wait for the remote debugger to attach. Start
gdb
on your host system:I have found that commands like the following, placed into a
.gdbinit
, are very useful to save on typing:Features
Supported
c
,s
,si
etc.)breakpoint()
function)b
) in non-ROM codeUnsupported
Proof of life