From fbfed8f8d90a58a6108daefd0f545f5f7f3beadf Mon Sep 17 00:00:00 2001 From: hitzhangjie Date: Thu, 10 Mar 2022 01:12:42 +0800 Subject: [PATCH] service-*: conform to godoc comments (#2916) --- service/api/types.go | 4 +-- service/client.go | 34 ++++++++++++------------ service/dap/error_ids.go | 3 +++ service/rpc1/{readme.txtr => readme.txt} | 0 service/rpccallback.go | 2 +- 5 files changed, 23 insertions(+), 20 deletions(-) rename service/rpc1/{readme.txtr => readme.txt} (100%) diff --git a/service/api/types.go b/service/api/types.go index 276d66fc..a9def948 100644 --- a/service/api/types.go +++ b/service/api/types.go @@ -282,7 +282,7 @@ const ( // frame that no longer exists) VariableFakeAddress - // VariableCPrt means the variable is a C pointer + // VariableCPtr means the variable is a C pointer VariableCPtr // VariableCPURegister means this variable is a CPU register. @@ -433,7 +433,7 @@ const ( Continue = "continue" // Rewind resumes process execution backwards (target must be a recording). Rewind = "rewind" - // DirecitonCongruentContinue resumes process execution, if a reverse next, step or stepout operation is in progress it will resume execution backward. + // DirectionCongruentContinue resumes process execution, if a reverse next, step or stepout operation is in progress it will resume execution backward. DirectionCongruentContinue = "directionCongruentContinue" // Step continues to next source line, entering function calls. Step = "step" diff --git a/service/client.go b/service/client.go index 90b74d23..bfb35967 100644 --- a/service/client.go +++ b/service/client.go @@ -9,10 +9,10 @@ import ( // Client represents a debugger service client. All client methods are // synchronous. type Client interface { - // Returns the pid of the process we are debugging. + // ProcessPid returns the pid of the process we are debugging. ProcessPid() int - // Returns the BuildID of the process' executable we are debugging. + // BuildID returns the BuildID of the process' executable we are debugging. BuildID() string // LastModified returns the time that the process' executable was modified. @@ -21,9 +21,9 @@ type Client interface { // Detach detaches the debugger, optionally killing the process. Detach(killProcess bool) error - // Restarts program. Set true if you want to rebuild the process we are debugging. + // Restart restarts program. Set true if you want to rebuild the process we are debugging. Restart(rebuild bool) ([]api.DiscardedBreakpoint, error) - // Restarts program from the specified position. + // RestartFrom restarts program from the specified position. RestartFrom(rerecord bool, pos string, resetArgs bool, newArgs []string, newRedirects [3]string, rebuild bool) ([]api.DiscardedBreakpoint, error) // GetState returns the current debugger state. @@ -35,7 +35,7 @@ type Client interface { Continue() <-chan *api.DebuggerState // Rewind resumes process execution backwards. Rewind() <-chan *api.DebuggerState - // DirecitonCongruentContinue resumes process execution, if a reverse next, step or stepout operation is in progress it will resume execution backward. + // DirectionCongruentContinue resumes process execution, if a reverse next, step or stepout operation is in progress it will resume execution backward. DirectionCongruentContinue() <-chan *api.DebuggerState // Next continues to the next source line, not entering function calls. Next() (*api.DebuggerState, error) @@ -52,9 +52,9 @@ type Client interface { // Call resumes process execution while making a function call. Call(goroutineID int, expr string, unsafe bool) (*api.DebuggerState, error) - // SingleStep will step a single cpu instruction. + // StepInstruction will step a single cpu instruction. StepInstruction() (*api.DebuggerState, error) - // ReverseSingleStep will reverse step a single cpu instruction. + // ReverseStepInstruction will reverse step a single cpu instruction. ReverseStepInstruction() (*api.DebuggerState, error) // SwitchThread switches the current thread context. SwitchThread(threadID int) (*api.DebuggerState, error) @@ -81,10 +81,10 @@ type Client interface { ToggleBreakpoint(id int) (*api.Breakpoint, error) // ToggleBreakpointByName toggles on or off a breakpoint by name. ToggleBreakpointByName(name string) (*api.Breakpoint, error) - // Allows user to update an existing breakpoint for example to change the information + // AmendBreakpoint allows user to update an existing breakpoint for example to change the information // retrieved when the breakpoint is hit or to change, add or remove the break condition AmendBreakpoint(*api.Breakpoint) error - // Cancels a Next or Step call that was interrupted by a manual stop or by another breakpoint + // CancelNext cancels a Next or Step call that was interrupted by a manual stop or by another breakpoint CancelNext() error // ListThreads lists all threads. @@ -106,7 +106,7 @@ type Client interface { ListFunctions(filter string) ([]string, error) // ListTypes lists all types in the process matching filter. ListTypes(filter string) ([]string, error) - // ListLocals lists all local variables in scope. + // ListLocalVariables lists all local variables in scope. ListLocalVariables(scope api.EvalScope, cfg api.LoadConfig) ([]api.Variable, error) // ListFunctionArgs lists all arguments to the current function. ListFunctionArgs(scope api.EvalScope, cfg api.LoadConfig) ([]api.Variable, error) @@ -120,16 +120,16 @@ type Client interface { // ListGoroutinesWithFilter lists goroutines matching the filters ListGoroutinesWithFilter(start, count int, filters []api.ListGoroutinesFilter, group *api.GoroutineGroupingOptions) ([]*api.Goroutine, []api.GoroutineGroup, int, bool, error) - // Returns stacktrace + // Stacktrace returns stacktrace Stacktrace(goroutineID int, depth int, opts api.StacktraceOptions, cfg *api.LoadConfig) ([]api.Stackframe, error) - // Returns ancestor stacktraces + // Ancestors returns ancestor stacktraces Ancestors(goroutineID int, numAncestors int, depth int) ([]api.Ancestor, error) - // Returns whether we attached to a running process or not + // AttachedToExistingProcess returns whether we attached to a running process or not AttachedToExistingProcess() bool - // Returns concrete location information described by a location expression + // FindLocation returns concrete location information described by a location expression // loc ::= : | [:] | // | (+|-) | | *
// * can be the full path of a file or just a suffix // * ::= .. | .(*). | . | . | (*). | @@ -143,9 +143,9 @@ type Client interface { // If findInstruction is true FindLocation will only return locations that correspond to instructions. FindLocation(scope api.EvalScope, loc string, findInstruction bool, substitutePathRules [][2]string) ([]api.Location, error) - // Disassemble code between startPC and endPC + // DisassembleRange disassemble code between startPC and endPC DisassembleRange(scope api.EvalScope, startPC, endPC uint64, flavour api.AssemblyFlavour) (api.AsmInstructions, error) - // Disassemble code of the function containing PC + // DisassemblePC disassemble code of the function containing PC DisassemblePC(scope api.EvalScope, pc uint64, flavour api.AssemblyFlavour) (api.AsmInstructions, error) // Recorded returns true if the target is a recording. @@ -162,7 +162,7 @@ type Client interface { // SetReturnValuesLoadConfig sets the load configuration for return values. SetReturnValuesLoadConfig(*api.LoadConfig) - // IsMulticlien returns true if the headless instance is multiclient. + // IsMulticlient returns true if the headless instance is multiclient. IsMulticlient() bool // ListDynamicLibraries returns a list of loaded dynamic libraries. diff --git a/service/dap/error_ids.go b/service/dap/error_ids.go index 09567776..72223291 100644 --- a/service/dap/error_ids.go +++ b/service/dap/error_ids.go @@ -10,6 +10,7 @@ const ( // Where applicable and for consistency only, // values below are inspired the original vscode-go debug adaptor. + FailedToLaunch = 3000 FailedToAttach = 3001 FailedToInitialize = 3002 @@ -27,7 +28,9 @@ const ( UnableToDisassemble = 2013 UnableToListRegisters = 2014 UnableToRunDlvCommand = 2015 + // Add more codes as we support more requests + NoDebugIsRunning = 3000 DebuggeeIsRunning = 4000 DisconnectError = 5000 diff --git a/service/rpc1/readme.txtr b/service/rpc1/readme.txt similarity index 100% rename from service/rpc1/readme.txtr rename to service/rpc1/readme.txt diff --git a/service/rpccallback.go b/service/rpccallback.go index 224dd6c9..59e0b79a 100644 --- a/service/rpccallback.go +++ b/service/rpccallback.go @@ -4,7 +4,7 @@ package service type RPCCallback interface { Return(out interface{}, err error) - // SetupDone returns a channel that should be closed to signal that the + // SetupDoneChan returns a channel that should be closed to signal that the // asynchornous method has completed setup and the server is ready to // receive other requests. SetupDoneChan() chan struct{}