2

I'm newbie to emulator. Nowadays I try to view src code of mgba(GBA Emulator).

https://github.com/mgba-emu/mgba

I built and found option -g.

-g option means Start GDB session (default port 2345) from help.

Is it able to be debugged with GDB?

How can I debug with GDB?

Please tell me how to or other methods to trace source code?

(Sorry for my poor English.)

Kyuvie
  • 23
  • 5
  • Could you please clarify - Do you want to debug the operation of the mgba emulator itself or do you want to debug a gameboy game? – Mark Plotnick Mar 15 '21 at 06:17
  • mgba. i want to verify that my reading source code is correct. – Kyuvie Mar 16 '21 at 09:09
  • OK. In that case, you just want a normal gdb session. Do not give mgba the `-g` option. Instead, use the shell command line you'd ordinarily use to run mgba, but put the word `gdb` at the beginning of it. – Mark Plotnick Mar 16 '21 at 15:52

1 Answers1

1

The -g option means you can remotely debug your rom with a remote debugger of gdb like gdb, ghidra or radare2. You will need another tool as mentioned before.

Sadly you can not debug remotely a classic gameboy rom. It only works for gameboy advance roms.

If you just want to debug the rom with no remote debugging access you can still use gdb from mgba with no remote debugging using the command

mgba -d your_rom.gb

a terminal should start. Then use gdb commands such as c to continue.

If you do not like gdb, you can get a look at BGB if you prefer a more graphic debugger.