Skip to content

Commit 9cda1f7

Browse files
committed
Allow optional programmer in debug
This is a cherry-pick of arduino#2540 from the 0.35.x branch
1 parent d99184e commit 9cda1f7

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

Diff for: commands/debug/debug_info.go

+8-9
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,14 @@ func getDebugProperties(req *rpc.GetDebugConfigRequest, pme *packagemanager.Expl
154154
}
155155
}
156156

157-
if req.GetProgrammer() == "" {
158-
return nil, &cmderrors.MissingProgrammerError{}
159-
}
160-
if p, ok := platformRelease.Programmers[req.GetProgrammer()]; ok {
161-
toolProperties.Merge(p.Properties)
162-
} else if refP, ok := referencedPlatformRelease.Programmers[req.GetProgrammer()]; ok {
163-
toolProperties.Merge(refP.Properties)
164-
} else {
165-
return nil, &cmderrors.ProgrammerNotFoundError{Programmer: req.GetProgrammer()}
157+
if req.GetProgrammer() != "" {
158+
if p, ok := platformRelease.Programmers[req.GetProgrammer()]; ok {
159+
toolProperties.Merge(p.Properties)
160+
} else if refP, ok := referencedPlatformRelease.Programmers[req.GetProgrammer()]; ok {
161+
toolProperties.Merge(refP.Properties)
162+
} else {
163+
return nil, &cmderrors.ProgrammerNotFoundError{Programmer: req.GetProgrammer()}
164+
}
166165
}
167166

168167
var importPath *paths.Path

Diff for: commands/debug/debug_test.go

-6
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@ func TestGetCommandLine(t *testing.T) {
6565
pme, release := pm.NewExplorer()
6666
defer release()
6767

68-
{
69-
// Check programmer required
70-
_, err := getCommandLine(req, pme)
71-
require.Error(t, err)
72-
}
73-
7468
{
7569
// Check programmer not found
7670
req.Programmer = "not-existent"

Diff for: internal/integrationtest/debug/debug_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,6 @@ func testAllDebugInformation(t *testing.T, env *integrationtest.Environment, cli
336336
}
337337

338338
func testDebugCheck(t *testing.T, env *integrationtest.Environment, cli *integrationtest.ArduinoCLI) {
339-
_, _, err := cli.Run("debug", "check", "-b", "arduino:samd:mkr1000")
340-
require.Error(t, err)
341-
342339
out, _, err := cli.Run("debug", "check", "-b", "arduino:samd:mkr1000", "-P", "atmel_ice")
343340
require.NoError(t, err)
344341
require.Contains(t, string(out), "The given board/programmer configuration supports debugging.")

0 commit comments

Comments
 (0)