gameboy-advance: enable debugging with GDB

Этот коммит содержится в:
Ayke van Laethem 2020-01-26 19:20:34 +01:00 коммит произвёл Daniel Esteban
родитель 100cbad65e
коммит 53688c86c8
2 изменённых файлов: 27 добавлений и 2 удалений

24
main.go
Просмотреть файл

@ -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.
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:

Просмотреть файл

@ -26,5 +26,6 @@
"extra-files": [
"targets/gameboy-advance.s"
],
"emulator": ["mgba-qt"]
"gdb": "gdb-multiarch",
"emulator": ["mgba", "-3"]
}