gameboy-advance: enable debugging with GDB
Этот коммит содержится в:
родитель
100cbad65e
коммит
53688c86c8
2 изменённых файлов: 27 добавлений и 2 удалений
24
main.go
24
main.go
|
@ -299,7 +299,11 @@ func FlashGDB(pkgName string, ocdOutput bool, options *compileopts.Options) erro
|
||||||
case "msd", "command", "":
|
case "msd", "command", "":
|
||||||
if len(config.Target.Emulator) != 0 {
|
if len(config.Target.Emulator) != 0 {
|
||||||
// Assume QEMU as an emulator.
|
// Assume QEMU as an emulator.
|
||||||
|
if config.Target.Emulator[0] == "mgba" {
|
||||||
|
gdbInterface = "mgba"
|
||||||
|
} else {
|
||||||
gdbInterface = "qemu"
|
gdbInterface = "qemu"
|
||||||
|
}
|
||||||
} else if openocdInterface != "" && config.Target.OpenOCDTarget != "" {
|
} else if openocdInterface != "" && config.Target.OpenOCDTarget != "" {
|
||||||
gdbInterface = "openocd"
|
gdbInterface = "openocd"
|
||||||
} else if config.Target.JLinkDevice != "" {
|
} 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?
|
// Maybe we should send a .Kill() after x seconds?
|
||||||
daemon.Wait()
|
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":
|
case "msd":
|
||||||
return errors.New("gdb is not supported for drag-and-drop programmable devices")
|
return errors.New("gdb is not supported for drag-and-drop programmable devices")
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -26,5 +26,6 @@
|
||||||
"extra-files": [
|
"extra-files": [
|
||||||
"targets/gameboy-advance.s"
|
"targets/gameboy-advance.s"
|
||||||
],
|
],
|
||||||
"emulator": ["mgba-qt"]
|
"gdb": "gdb-multiarch",
|
||||||
|
"emulator": ["mgba", "-3"]
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче