gameboy-advance: enable debugging with GDB

This commit is contained in:
Ayke van Laethem
2020-01-26 19:20:34 +01:00
committed by Daniel Esteban
parent 100cbad65e
commit 53688c86c8
2 changed files with 27 additions and 2 deletions
+25 -1
View File
@@ -299,7 +299,11 @@ func FlashGDB(pkgName string, ocdOutput bool, options *compileopts.Options) erro
case "msd", "command", "":
if len(config.Target.Emulator) != 0 {
// Assume QEMU as an emulator.
gdbInterface = "qemu"
if config.Target.Emulator[0] == "mgba" {
gdbInterface = "mgba"
} else {
gdbInterface = "qemu"
}
} else if openocdInterface != "" && config.Target.OpenOCDTarget != "" {
gdbInterface = "openocd"
} else if config.Target.JLinkDevice != "" {
@@ -395,6 +399,26 @@ func FlashGDB(pkgName string, ocdOutput bool, options *compileopts.Options) erro
// Maybe we should send a .Kill() after x seconds?
daemon.Wait()
}()
case "mgba":
gdbCommands = append(gdbCommands, "target remote :2345")
// Run in an emulator.
args := append(config.Target.Emulator[1:], tmppath, "-g")
daemon := exec.Command(config.Target.Emulator[0], args...)
daemon.Stdout = os.Stdout
daemon.Stderr = os.Stderr
// Make sure the daemon doesn't receive Ctrl-C that is intended for
// GDB (to break the currently executing program).
setCommandAsDaemon(daemon)
// Start now, and kill it on exit.
daemon.Start()
defer func() {
daemon.Process.Signal(os.Interrupt)
// Maybe we should send a .Kill() after x seconds?
daemon.Wait()
}()
case "msd":
return errors.New("gdb is not supported for drag-and-drop programmable devices")
default:
+2 -1
View File
@@ -26,5 +26,6 @@
"extra-files": [
"targets/gameboy-advance.s"
],
"emulator": ["mgba-qt"]
"gdb": "gdb-multiarch",
"emulator": ["mgba", "-3"]
}