From d3e09f321548422f6a19b430441a5c7c47e46473 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 25 Oct 2023 15:45:04 +0200 Subject: [PATCH 1/2] Added `programmer` field to debug info response --- commands/debug/debug_info.go | 1 + internal/cli/debug/debug.go | 2 ++ rpc/cc/arduino/cli/commands/v1/debug.pb.go | 15 +++++++++++++-- rpc/cc/arduino/cli/commands/v1/debug.proto | 2 ++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/commands/debug/debug_info.go b/commands/debug/debug_info.go index cd5308ece7c..a8731ab1d6a 100644 --- a/commands/debug/debug_info.go +++ b/commands/debug/debug_info.go @@ -197,6 +197,7 @@ func getDebugProperties(req *rpc.GetDebugConfigRequest, pme *packagemanager.Expl ToolchainPrefix: debugProperties.Get("toolchain.prefix"), ToolchainConfiguration: &toolchainConfiguration, CortexDebugCustomJson: cortexDebugCustomJson, + Programmer: req.GetProgrammer(), }, nil } diff --git a/internal/cli/debug/debug.go b/internal/cli/debug/debug.go index e7001a2a8d3..756b662cb2e 100644 --- a/internal/cli/debug/debug.go +++ b/internal/cli/debug/debug.go @@ -126,6 +126,7 @@ type debugInfoResult struct { ServerConfig any `json:"server_configuration,omitempty"` SvdFile string `json:"svd_file,omitempty"` CortexDebugCustomConfig any `json:"cortex-debug_custom_configuration,omitempty"` + Programmer string `json:"programmer"` } type openOcdServerConfigResult struct { @@ -166,6 +167,7 @@ func newDebugInfoResult(info *rpc.GetDebugConfigResponse) *debugInfoResult { ServerConfig: serverConfig, SvdFile: info.SvdFile, CortexDebugCustomConfig: cortexDebugCustomConfig, + Programmer: info.Programmer, } } diff --git a/rpc/cc/arduino/cli/commands/v1/debug.pb.go b/rpc/cc/arduino/cli/commands/v1/debug.pb.go index 4dc46f0b13a..ff514779bf5 100644 --- a/rpc/cc/arduino/cli/commands/v1/debug.pb.go +++ b/rpc/cc/arduino/cli/commands/v1/debug.pb.go @@ -300,6 +300,8 @@ type GetDebugConfigResponse struct { CortexDebugCustomJson string `protobuf:"bytes,9,opt,name=cortex_debug_custom_json,json=cortexDebugCustomJson,proto3" json:"cortex_debug_custom_json,omitempty"` // the SVD file to use SvdFile string `protobuf:"bytes,10,opt,name=svd_file,json=svdFile,proto3" json:"svd_file,omitempty"` + // The programmer specified in the request + Programmer string `protobuf:"bytes,11,opt,name=programmer,proto3" json:"programmer,omitempty"` } func (x *GetDebugConfigResponse) Reset() { @@ -404,6 +406,13 @@ func (x *GetDebugConfigResponse) GetSvdFile() string { return "" } +func (x *GetDebugConfigResponse) GetProgrammer() string { + if x != nil { + return x.Programmer + } + return "" +} + // Configurations specific for the 'gcc' toolchain type DebugGCCToolchainConfiguration struct { state protoimpl.MessageState @@ -556,7 +565,7 @@ var file_cc_arduino_cli_commands_v1_debug_proto_rawDesc = []byte{ 0x65, 0x62, 0x75, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xcd, 0x03, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x44, 0x65, + 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xed, 0x03, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x44, 0x65, 0x62, 0x75, 0x67, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x61, 0x62, 0x6c, @@ -585,7 +594,9 @@ var file_cc_arduino_cli_commands_v1_debug_proto_rawDesc = []byte{ 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, 0x6f, 0x72, 0x74, 0x65, 0x78, 0x44, 0x65, 0x62, 0x75, 0x67, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4a, 0x73, 0x6f, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x76, 0x64, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, - 0x76, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x22, 0x20, 0x0a, 0x1e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x47, + 0x76, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x61, + 0x6d, 0x6d, 0x65, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x67, + 0x72, 0x61, 0x6d, 0x6d, 0x65, 0x72, 0x22, 0x20, 0x0a, 0x1e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x47, 0x43, 0x43, 0x54, 0x6f, 0x6f, 0x6c, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x70, 0x0a, 0x1f, 0x44, 0x65, 0x62, 0x75, 0x67, 0x4f, 0x70, 0x65, 0x6e, 0x4f, 0x43, 0x44, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x43, 0x6f, diff --git a/rpc/cc/arduino/cli/commands/v1/debug.proto b/rpc/cc/arduino/cli/commands/v1/debug.proto index b183abb0410..944250cfd65 100644 --- a/rpc/cc/arduino/cli/commands/v1/debug.proto +++ b/rpc/cc/arduino/cli/commands/v1/debug.proto @@ -96,6 +96,8 @@ message GetDebugConfigResponse { string cortex_debug_custom_json = 9; // the SVD file to use string svd_file = 10; + // The programmer specified in the request + string programmer = 11; } // Configurations specific for the 'gcc' toolchain From 30bd6114661aca41e4ccf4603a3989373d4eea17 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 25 Oct 2023 15:50:15 +0200 Subject: [PATCH 2/2] Added integration test --- internal/integrationtest/debug/debug_test.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/internal/integrationtest/debug/debug_test.go b/internal/integrationtest/debug/debug_test.go index 6f7dd422737..0d3a0cc9dbf 100644 --- a/internal/integrationtest/debug/debug_test.go +++ b/internal/integrationtest/debug/debug_test.go @@ -147,7 +147,8 @@ func testAllDebugInformation(t *testing.T, env *integrationtest.Environment, cli "thb setup", "c" ] - } + }, + "programmer": "atmel_ice" }`) } @@ -189,7 +190,8 @@ func testAllDebugInformation(t *testing.T, env *integrationtest.Environment, cli "thb setup", "c" ] - } + }, + "programmer": "my_cold_ice" }`) { @@ -211,7 +213,8 @@ func testAllDebugInformation(t *testing.T, env *integrationtest.Environment, cli "single-script" ] }, - "svd_file": "svd-file" + "svd_file": "svd-file", + "programmer": "atmel_ice" }`) } @@ -234,7 +237,8 @@ func testAllDebugInformation(t *testing.T, env *integrationtest.Environment, cli "cold_ice_script" ] }, - "svd_file": "svd-file" + "svd_file": "svd-file", + "programmer": "my_cold_ice" }`) }