From 373fa6d69b73fbdbade8f92f9c6dc70145b063cc Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Tue, 29 Oct 2019 11:44:30 +0100 Subject: [PATCH] main: halt GDB on start Most programmers support the "reset halt" command, which resets the target but keeps it halted at the first instruction. This is a much more natural way of working with GDB, and allows setting breakpoints before the program is started. This commit switches to `reset halt` by default and also stops running the program directly when debugging natively on the host. --- main.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main.go b/main.go index b35f63b1..2077edee 100644 --- a/main.go +++ b/main.go @@ -530,9 +530,8 @@ func FlashGDB(pkgName, target, port string, ocdOutput bool, config *BuildConfig) switch gdbInterface { case "native": // Run GDB directly. - gdbCommands = append(gdbCommands, "run") case "openocd": - gdbCommands = append(gdbCommands, "target remote :3333", "monitor halt", "load", "monitor reset", "c") + gdbCommands = append(gdbCommands, "target remote :3333", "monitor halt", "load", "monitor reset halt") // We need a separate debugging daemon for on-chip debugging. args, err := spec.OpenOCDConfiguration()