Skip to content

Commit 40aa4b2

Browse files
committed
feat: allow boards to change debug support via FQBN options
"debug.executable" must be present AND non-empty for debugging to be supported, allowing board overrides. Also, use the same logic in the details view and in the actual debug command implementation.
1 parent 4bf81fd commit 40aa4b2

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

Diff for: commands/board/details.go

+9-3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/arduino/arduino-cli/arduino/utils"
2424
"github.com/arduino/arduino-cli/commands/internal/instances"
2525
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
26+
"github.com/arduino/go-properties-orderedmap"
2627
)
2728

2829
// Details returns all details for a board including tools and HW identifiers.
@@ -64,9 +65,14 @@ func Details(ctx context.Context, req *rpc.BoardDetailsRequest) (*rpc.BoardDetai
6465
details.BuildProperties, _ = utils.ExpandBuildProperties(details.GetBuildProperties())
6566
}
6667

67-
details.DebuggingSupported = boardProperties.ContainsKey("debug.executable") ||
68-
boardPlatformRelease.Properties.ContainsKey("debug.executable") ||
69-
(boardRefPlatform != nil && boardRefPlatform.Properties.ContainsKey("debug.executable"))
68+
toolProperties := properties.NewMap()
69+
if boardRefPlatform != nil {
70+
toolProperties.Merge(boardRefPlatform.Properties)
71+
}
72+
toolProperties.Merge(boardPlatform.Properties)
73+
toolProperties.Merge(boardPlatform.RuntimeProperties())
74+
toolProperties.Merge(boardProperties)
75+
details.DebuggingSupported = toolProperties.ContainsKey("debug.executable") && toolProperties.Get("debug.executable") != ""
7076

7177
details.Package = &rpc.Package{
7278
Name: boardPackage.Name,

Diff for: commands/debug/debug_info.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func getDebugProperties(req *rpc.GetDebugConfigRequest, pme *packagemanager.Expl
134134
debugProperties.Set(k, toolProperties.ExpandPropsInString(v))
135135
}
136136

137-
if !debugProperties.ContainsKey("executable") {
137+
if !debugProperties.ContainsKey("executable") || debugProperties.Get("executable") == "" {
138138
return nil, &arduino.FailedDebugError{Message: tr("Debugging not supported for board %s", req.GetFqbn())}
139139
}
140140

Diff for: docs/UPGRADING.md

+2
Original file line numberDiff line numberDiff line change
@@ -2521,6 +2521,8 @@ debug.server.openocd.scripts_dir={runtime.tools.openocd-0.10.0-arduino7.path}/sh
25212521
debug.server.openocd.script={runtime.platform.path}/variants/{build.variant}/{build.openocdscript}
25222522
```
25232523
2524+
The `debug.executable` key must be present and non-empty for debugging to be supported.
2525+
25242526
The `debug.server.XXXX` subkeys are optional and also "free text", this means that the configuration may be extended as
25252527
needed by the specific server. For now only `openocd` is supported. Anyway, if this change works, any other kind of
25262528
server may be fairly easily added.

0 commit comments

Comments
 (0)