Skip to content

Commit

Permalink
[skip-changelog] Renamed gRPC field to match JSON output (#2398)
Browse files Browse the repository at this point in the history
* Renamed gRPC field to match JSON output

* Better comment for custom_configs field

* Renamed variable
  • Loading branch information
cmaglie committed Nov 2, 2023
1 parent 830e800 commit 71b0d1a
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 56 deletions.
26 changes: 13 additions & 13 deletions commands/debug/debug_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,22 +184,22 @@ func getDebugProperties(req *rpc.GetDebugConfigRequest, pme *packagemanager.Expl
}
}

cortexDebugCustomJson := map[string]string{}
customConfigs := map[string]string{}
if cortexDebugProps := debugProperties.SubTree("cortex-debug.custom"); cortexDebugProps.Size() > 0 {
cortexDebugCustomJson["cortex-debug"] = convertToJsonMap(cortexDebugProps)
customConfigs["cortex-debug"] = convertToJsonMap(cortexDebugProps)
}
return &rpc.GetDebugConfigResponse{
Executable: debugProperties.Get("executable"),
Server: server,
ServerPath: debugProperties.Get("server." + server + ".path"),
ServerConfiguration: &serverConfiguration,
SvdFile: debugProperties.Get("svd_file"),
Toolchain: toolchain,
ToolchainPath: debugProperties.Get("toolchain.path"),
ToolchainPrefix: debugProperties.Get("toolchain.prefix"),
ToolchainConfiguration: &toolchainConfiguration,
CustomConfigurationsJson: cortexDebugCustomJson,
Programmer: req.GetProgrammer(),
Executable: debugProperties.Get("executable"),
Server: server,
ServerPath: debugProperties.Get("server." + server + ".path"),
ServerConfiguration: &serverConfiguration,
SvdFile: debugProperties.Get("svd_file"),
Toolchain: toolchain,
ToolchainPath: debugProperties.Get("toolchain.path"),
ToolchainPrefix: debugProperties.Get("toolchain.prefix"),
ToolchainConfiguration: &toolchainConfiguration,
CustomConfigs: customConfigs,
Programmer: req.GetProgrammer(),
}, nil
}

Expand Down
2 changes: 1 addition & 1 deletion internal/cli/debug/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func newDebugInfoResult(info *rpc.GetDebugConfigResponse) *debugInfoResult {
}
}
customConfigs := map[string]any{}
for id, configJson := range info.GetCustomConfigurationsJson() {
for id, configJson := range info.GetCustomConfigs() {
var config any
if err := json.Unmarshal([]byte(configJson), &config); err == nil {
customConfigs[id] = config
Expand Down
79 changes: 39 additions & 40 deletions rpc/cc/arduino/cli/commands/v1/debug.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions rpc/cc/arduino/cli/commands/v1/debug.proto
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ message GetDebugConfigResponse {
// Extra configuration parameters wrt GDB server
google.protobuf.Any server_configuration = 8;
// Custom debugger configurations (not handled directly by Arduino CLI but
// provided for 3rd party plugins/debuggers)
map<string, string> custom_configurations_json = 9;
// provided for 3rd party plugins/debuggers). The map keys identifies which
// 3rd party plugin/debugger is referred, the map string values contains a
// JSON configuration for it.
map<string, string> custom_configs = 9;
// the SVD file to use
string svd_file = 10;
// The programmer specified in the request
Expand Down

0 comments on commit 71b0d1a

Please sign in to comment.