Load custom symbols in GDB for Game Boy (RGBDS)

Mads Ynddal mads@ynddal.dk
Mon Feb 5 10:31:31 GMT 2024


Hi,

I’m in the process of implementing GDB remote serial protocol in my Game Boy
emulator PyBoy. I have a rudimentary setup working, and can step instructions,
add breakpoints given an address, continue execution, display memory etc.

The biggest challenge is loading symbols from the RGBDS assembler/linker package
for the Game Boy Z80 variant (not to be confused with the "gbz80" platform from
GNU Assembler). RGBDS outputs its own .sym file-format like this mock-up:

; File generated by rgblink
00:0000 main
00:0006 main.erase
00:0015 main.memcpy
...
01:00d3 main.B2
02:00db main.O
10:00e3 main.Y2
1b:00fc exit

The first digits of each line is the ROM/RAM bank number, and after the colon,
the 16-bit memory address, then a space and the label for this location.

What would be the easiest way to get GDB to load these symbols? Would a Python
extension for GDB help?

And does GDB support ROM/RAM banks? I.e. displaying memory from a specific ROM
bank, or add a breakpoint to specific bank+address.

Best regards,
—
Mads Ynddal



More information about the Gdb mailing list