From 2a4eb1b060d2d96e19f626cefd2d21404d7c97da Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 26 Feb 2020 10:23:58 +0100 Subject: [PATCH 1/4] When running debugger always use forward slash in paths --- commands/debug/debug.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/commands/debug/debug.go b/commands/debug/debug.go index 46083091930..6d6786b37a3 100644 --- a/commands/debug/debug.go +++ b/commands/debug/debug.go @@ -51,6 +51,12 @@ func Debug(ctx context.Context, req *dbg.DebugConfigReq, inStream io.Reader, out return nil, errors.Wrap(err, "Cannot get command line for tool") } + // Transform every path to forward slashes (on Windows some tools further + // escapes the command line so the backslash "\" gets in the way). + for i, param := range commandLine { + commandLine[i] = filepath.ToSlash(param) + } + // Run Tool cmd, err := executils.Command(commandLine) if err != nil { From 8b82066ee9ca9e1b3358c46b1e5dde56833184c4 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 26 Feb 2020 10:24:27 +0100 Subject: [PATCH 2/4] Add more debugging output when running debugger commandline --- commands/debug/debug.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/commands/debug/debug.go b/commands/debug/debug.go index 6d6786b37a3..7b3ea1a4bb1 100644 --- a/commands/debug/debug.go +++ b/commands/debug/debug.go @@ -58,6 +58,12 @@ func Debug(ctx context.Context, req *dbg.DebugConfigReq, inStream io.Reader, out } // Run Tool + entry := logrus.NewEntry(logrus.StandardLogger()) + for i, param := range commandLine { + entry = entry.WithField(fmt.Sprintf("param%d", i), param) + } + entry.Debug("Executing debugger") + cmd, err := executils.Command(commandLine) if err != nil { return nil, errors.Wrap(err, "Cannot execute debug tool") From 455610cf3a054197e5d30dbf7470c8aa7d8f84df Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 26 Feb 2020 11:46:24 +0100 Subject: [PATCH 3/4] Temporary fix for arduino.samd core 1.8.5 --- commands/debug/debug.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/commands/debug/debug.go b/commands/debug/debug.go index 7b3ea1a4bb1..ec93707845f 100644 --- a/commands/debug/debug.go +++ b/commands/debug/debug.go @@ -236,6 +236,10 @@ func getCommandLine(req *dbg.DebugConfigReq, pm *packagemanager.PackageManager) // Build recipe for tool recipe := toolProperties.Get("debug.pattern") + // REMOVEME: hotfix for samd core 1.8.5 + if recipe == `"{path}/{cmd}" --interpreter=mi2 -ex "set pagination off" -ex 'target extended-remote | {tools.openocd.path}/{tools.openocd.cmd} -s "{tools.openocd.path}/share/openocd/scripts/" --file "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "gdb_port pipe" -c "telnet_port 0"' {build.path}/{build.project_name}.elf` { + recipe = `"{path}/{cmd}" --interpreter=mi2 -ex "set pagination off" -ex 'target extended-remote | "{tools.openocd.path}/{tools.openocd.cmd}" -s "{tools.openocd.path}/share/openocd/scripts/" --file "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "gdb_port pipe" -c "telnet_port 0"' "{build.path}/{build.project_name}.elf"` + } cmdLine := toolProperties.ExpandPropsInString(recipe) cmdArgs, err := properties.SplitQuotedString(cmdLine, `"'`, false) if err != nil { From 6c502dab857fedb46affeea8daa591db8d376def Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 26 Feb 2020 14:07:44 +0100 Subject: [PATCH 4/4] Fix gdb timeout on Windows --- commands/debug/debug.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/debug/debug.go b/commands/debug/debug.go index ec93707845f..dc73031e3ee 100644 --- a/commands/debug/debug.go +++ b/commands/debug/debug.go @@ -238,7 +238,7 @@ func getCommandLine(req *dbg.DebugConfigReq, pm *packagemanager.PackageManager) recipe := toolProperties.Get("debug.pattern") // REMOVEME: hotfix for samd core 1.8.5 if recipe == `"{path}/{cmd}" --interpreter=mi2 -ex "set pagination off" -ex 'target extended-remote | {tools.openocd.path}/{tools.openocd.cmd} -s "{tools.openocd.path}/share/openocd/scripts/" --file "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "gdb_port pipe" -c "telnet_port 0"' {build.path}/{build.project_name}.elf` { - recipe = `"{path}/{cmd}" --interpreter=mi2 -ex "set pagination off" -ex 'target extended-remote | "{tools.openocd.path}/{tools.openocd.cmd}" -s "{tools.openocd.path}/share/openocd/scripts/" --file "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "gdb_port pipe" -c "telnet_port 0"' "{build.path}/{build.project_name}.elf"` + recipe = `"{path}/{cmd}" --interpreter=mi2 -ex "set remotetimeout 5" -ex "set pagination off" -ex 'target extended-remote | "{tools.openocd.path}/{tools.openocd.cmd}" -s "{tools.openocd.path}/share/openocd/scripts/" --file "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "gdb_port pipe" -c "telnet_port 0"' "{build.path}/{build.project_name}.elf"` } cmdLine := toolProperties.ExpandPropsInString(recipe) cmdArgs, err := properties.SplitQuotedString(cmdLine, `"'`, false)