Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Inlined gRPC methods to implement GetDebugConfig and IsDebugSupported
  • Loading branch information
cmaglie committed Aug 7, 2024
commit d27cd49b0441f8fd1283ee340106853ae19c2ae1
11 changes: 0 additions & 11 deletions commands/service_debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package commands

import (
"context"
"errors"
"os"

Expand Down Expand Up @@ -64,13 +63,3 @@ func (s *arduinoCoreServerImpl) Debug(stream rpc.ArduinoCoreService_DebugServer)
}
return stream.Send(resp)
}

// GetDebugConfig return metadata about a debug session
func (s *arduinoCoreServerImpl) GetDebugConfig(ctx context.Context, req *rpc.GetDebugConfigRequest) (*rpc.GetDebugConfigResponse, error) {
return GetDebugConfig(ctx, req)
}

// IsDebugSupported checks if debugging is supported for a given configuration
func (s *arduinoCoreServerImpl) IsDebugSupported(ctx context.Context, req *rpc.IsDebugSupportedRequest) (*rpc.IsDebugSupportedResponse, error) {
return IsDebugSupported(ctx, req)
}
4 changes: 2 additions & 2 deletions commands/service_debug_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
)

// GetDebugConfig returns metadata to start debugging with the specified board
func GetDebugConfig(ctx context.Context, req *rpc.GetDebugConfigRequest) (*rpc.GetDebugConfigResponse, error) {
func (s *arduinoCoreServerImpl) GetDebugConfig(ctx context.Context, req *rpc.GetDebugConfigRequest) (*rpc.GetDebugConfigResponse, error) {
pme, release, err := instances.GetPackageManagerExplorer(req.GetInstance())
if err != nil {
return nil, err
Expand All @@ -48,7 +48,7 @@ func GetDebugConfig(ctx context.Context, req *rpc.GetDebugConfigRequest) (*rpc.G
}

// IsDebugSupported checks if the given board/programmer configuration supports debugging.
func IsDebugSupported(ctx context.Context, req *rpc.IsDebugSupportedRequest) (*rpc.IsDebugSupportedResponse, error) {
func (s *arduinoCoreServerImpl) IsDebugSupported(ctx context.Context, req *rpc.IsDebugSupportedRequest) (*rpc.IsDebugSupportedResponse, error) {
pme, release, err := instances.GetPackageManagerExplorer(req.GetInstance())
if err != nil {
return nil, err
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 @@ -122,7 +122,7 @@ func runDebugCommand(ctx context.Context, srv rpc.ArduinoCoreServiceServer, args

if printInfo {

if res, err := commands.GetDebugConfig(ctx, debugConfigRequested); err != nil {
if res, err := srv.GetDebugConfig(ctx, debugConfigRequested); err != nil {
errcode := feedback.ErrBadArgument
if errors.Is(err, &cmderrors.MissingProgrammerError{}) {
errcode = feedback.ErrMissingProgrammer
Expand Down
3 changes: 1 addition & 2 deletions internal/cli/debug/debug_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"context"
"os"

"github.com/arduino/arduino-cli/commands"
"github.com/arduino/arduino-cli/internal/cli/arguments"
"github.com/arduino/arduino-cli/internal/cli/feedback"
"github.com/arduino/arduino-cli/internal/cli/feedback/result"
Expand Down Expand Up @@ -61,7 +60,7 @@ func runDebugCheckCommand(ctx context.Context, srv rpc.ArduinoCoreServiceServer,
feedback.FatalError(err, feedback.ErrBadArgument)
}
fqbn := fqbnArg.String()
resp, err := commands.IsDebugSupported(ctx, &rpc.IsDebugSupportedRequest{
resp, err := srv.IsDebugSupported(ctx, &rpc.IsDebugSupportedRequest{
Instance: instance,
Fqbn: fqbn,
Port: port,
Expand Down