Trying to do: https://wrongbaud.github.io/posts/ghidra-debugger/ but with SMS
Start with blastem, Ghidra 10+
Tried running in windows via: blastem.exe ROM_FILE.bin -D
but I couldn't get ghidra to connect to it. not sure which option to choose.
Trying gdb via ssh.
Blastem's read me says
Invoke an m68k-elf targeted gdb with the ELF file. Once inside the gdb session, type: target remote | BLASTEM_PATH/blastem ROM_FILE.bin -D
Build 6800 gdb: https://sourceware.org/pipermail/gdb/2011-January/039404.html
I tried using WSL, but I forgot blastem needs guid, and doesn't run in wsl ( haven't figured out the wsl2 gui things).
stephen@Cube-Windows:~/source$ blastem romfile.bin -D
error: XDG_RUNTIME_DIR not set in the environment.
The path /dev/dri/ cannot be opened or is not available
The path /dev/dri/ cannot be opened or is not available
Unable to init SDL: No available video device
Switched to vm
sudo apt insttal gcc
sudo apt install make
sudo apt install blastem
source$ wget http://ftp.gnu.org/gnu/gdb/gdb-10.2.tar.gz
source$ tar -xvzf gdb-10.2.tar.gz
source$ cd gdb-10.2
source/gdb-10.2$ ./configure --host=i686-pc-linux-gnu --target=m68k-elf --prefix=/opt/m68k
...
source/gdb-10.2$ make
...
/bin/bash: i686-pc-linux-gnu-ar: command not found
Installing binutils and GCC as cross-compiler for the Motorolla 68000: https://darkdust.net/writings/megadrive/crosscompiler
~/source$ wget https://ftp.gnu.org/gnu/binutils/binutils-2.37.tar.xz
./configure --prefix=/opt/m68k --target=m68k-coff
make
...
checking for cos in -lm... yes
*** Configuration m68k-unknown-coff is obsolete.
*** Support has been REMOVED.
I think this isn't going to end well, since I think gdb is expecting ELF format, but they don't come that way. Blastem says
To use this, you'll want to configure your Makefile to produce both an ELF executable and a raw binary.
Giving up for now:
Trying dbgengEngine locally:
with arguments similar to
blastem.exe ROM_FILE.bin -D
But I think that debugs blastem.exe not ROM_FILE.bin
Maybe this isn't what I'm looking for. I think I want Ghidra to connect to a remote GDB stub, like is provided by OpenOCD: https://github.com/openocd-org/openocd/blob/master/src/server/gdb_server.c , maybe that way Ghidra can pretend to be GDB frontend and connect directly to blastem.
Probably something like: https://github.com/Comsecuris/gdbghidra