@@ -37,27 +37,10 @@ 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 )
41
- if err != nil {
42
- return nil , err
43
- }
44
-
45
- server := props .Get ("server" )
46
- toolchain := props .Get ("toolchain" )
47
- resp := & debug.GetDebugConfigResp {
48
- Executable : props .Get ("executable" ),
49
- Server : server ,
50
- ServerPath : props .Get ("server." + server + ".path" ),
51
- ServerConfiguration : props .SubTree ("server." + server ).AsMap (),
52
- Toolchain : toolchain ,
53
- ToolchainPath : props .Get ("toolchain.path" ),
54
- ToolchainPrefix : props .Get ("toolchain.prefix" ),
55
- ToolchainConfiguration : props .SubTree ("toolchain." + toolchain ).AsMap (),
56
- }
57
- return resp , nil
40
+ return getDebugProperties (req , pm )
58
41
}
59
42
60
- func getDebugProperties (req * debug.DebugConfigReq , pm * packagemanager.PackageManager ) (* properties. Map , error ) {
43
+ func getDebugProperties (req * debug.DebugConfigReq , pm * packagemanager.PackageManager ) (* debug. GetDebugConfigResp , error ) {
61
44
// TODO: make a generic function to extract sketch from request
62
45
// and remove duplication in commands/compile.go
63
46
if req .GetSketchPath () == "" {
@@ -157,5 +140,16 @@ func getDebugProperties(req *debug.DebugConfigReq, pm *packagemanager.PackageMan
157
140
return nil , status .Error (codes .Unimplemented , fmt .Sprintf ("debugging not supported for board %s" , req .GetFqbn ()))
158
141
}
159
142
160
- return debugProperties , nil
143
+ server := debugProperties .Get ("server" )
144
+ toolchain := debugProperties .Get ("toolchain" )
145
+ return & debug.GetDebugConfigResp {
146
+ Executable : debugProperties .Get ("executable" ),
147
+ Server : server ,
148
+ ServerPath : debugProperties .Get ("server." + server + ".path" ),
149
+ ServerConfiguration : debugProperties .SubTree ("server." + server ).AsMap (),
150
+ Toolchain : toolchain ,
151
+ ToolchainPath : debugProperties .Get ("toolchain.path" ),
152
+ ToolchainPrefix : debugProperties .Get ("toolchain.prefix" ),
153
+ ToolchainConfiguration : debugProperties .SubTree ("toolchain." + toolchain ).AsMap (),
154
+ }, nil
161
155
}
0 commit comments