@@ -37,31 +37,17 @@ import (
37
37
func GetDebugConfig (ctx context.Context , req * debug.DebugConfigReq ) (* debug.GetDebugConfigResp , error ) {
38
38
pm := commands .GetPackageManager (req .GetInstance ().GetId ())
39
39
40
- props , err := getDebugProperties (req , pm )
40
+ resp , err := getDebugProperties (req , pm )
41
41
if err != nil {
42
42
return nil , err
43
43
}
44
-
45
- if ! props .ContainsKey ("executable" ) {
44
+ if resp .GetExecutable () == "" {
46
45
return nil , status .Error (codes .Unimplemented , fmt .Sprintf ("debugging not supported for board %s" , req .GetFqbn ()))
47
46
}
48
-
49
- server := props .Get ("server" )
50
- toolchain := props .Get ("toolchain" )
51
- resp := & debug.GetDebugConfigResp {
52
- Executable : props .Get ("executable" ),
53
- Server : server ,
54
- ServerPath : props .Get ("server." + server + ".path" ),
55
- ServerConfiguration : props .SubTree ("server." + server ).AsMap (),
56
- Toolchain : toolchain ,
57
- ToolchainPath : props .Get ("toolchain.path" ),
58
- ToolchainPrefix : props .Get ("toolchain.prefix" ),
59
- ToolchainConfiguration : props .SubTree ("toolchain." + toolchain ).AsMap (),
60
- }
61
47
return resp , nil
62
48
}
63
49
64
- func getDebugProperties (req * debug.DebugConfigReq , pm * packagemanager.PackageManager ) (* properties. Map , error ) {
50
+ func getDebugProperties (req * debug.DebugConfigReq , pm * packagemanager.PackageManager ) (* debug. GetDebugConfigResp , error ) {
65
51
// TODO: make a generic function to extract sketch from request
66
52
// and remove duplication in commands/compile.go
67
53
if req .GetSketchPath () == "" {
@@ -156,5 +142,17 @@ func getDebugProperties(req *debug.DebugConfigReq, pm *packagemanager.PackageMan
156
142
for k , v := range toolProperties .SubTree ("debug" ).AsMap () {
157
143
debugProperties .Set (k , toolProperties .ExpandPropsInString (v ))
158
144
}
159
- return debugProperties , nil
145
+
146
+ server := debugProperties .Get ("server" )
147
+ toolchain := debugProperties .Get ("toolchain" )
148
+ return & debug.GetDebugConfigResp {
149
+ Executable : debugProperties .Get ("executable" ),
150
+ Server : server ,
151
+ ServerPath : debugProperties .Get ("server." + server + ".path" ),
152
+ ServerConfiguration : debugProperties .SubTree ("server." + server ).AsMap (),
153
+ Toolchain : toolchain ,
154
+ ToolchainPath : debugProperties .Get ("toolchain.path" ),
155
+ ToolchainPrefix : debugProperties .Get ("toolchain.prefix" ),
156
+ ToolchainConfiguration : debugProperties .SubTree ("toolchain." + toolchain ).AsMap (),
157
+ }, nil
160
158
}
0 commit comments