gitlab.com/Raven-IO/raven-delve@v1.22.4/service/client.go (about) 1 package service 2 3 import ( 4 "time" 5 6 "gitlab.com/Raven-IO/raven-delve/service/api" 7 ) 8 9 // Client represents a debugger service client. All client methods are 10 // synchronous. 11 type Client interface { 12 // ProcessPid returns the pid of the process we are debugging. 13 ProcessPid() int 14 15 // BuildID returns the BuildID of the process' executable we are debugging. 16 BuildID() string 17 18 // LastModified returns the time that the process' executable was modified. 19 LastModified() time.Time 20 21 // Detach detaches the debugger, optionally killing the process. 22 Detach(killProcess bool) error 23 24 // Restart restarts program. Set true if you want to rebuild the process we are debugging. 25 Restart(rebuild bool) ([]api.DiscardedBreakpoint, error) 26 // RestartFrom restarts program from the specified position. 27 RestartFrom(rerecord bool, pos string, resetArgs bool, newArgs []string, newRedirects [3]string, rebuild bool) ([]api.DiscardedBreakpoint, error) 28 29 // GetState returns the current debugger state. 30 GetState() (*api.DebuggerState, error) 31 // GetStateNonBlocking returns the current debugger state, returning immediately if the target is already running. 32 GetStateNonBlocking() (*api.DebuggerState, error) 33 34 // Continue resumes process execution. 35 Continue() <-chan *api.DebuggerState 36 // Rewind resumes process execution backwards. 37 Rewind() <-chan *api.DebuggerState 38 // DirectionCongruentContinue resumes process execution, if a reverse next, step or stepout operation is in progress it will resume execution backward. 39 DirectionCongruentContinue() <-chan *api.DebuggerState 40 // Next continues to the next source line, not entering function calls. 41 Next() (*api.DebuggerState, error) 42 // ReverseNext continues backward to the previous line of source code, not entering function calls. 43 ReverseNext() (*api.DebuggerState, error) 44 // Step continues to the next source line, entering function calls. 45 Step() (*api.DebuggerState, error) 46 // ReverseStep continues backward to the previous line of source code, entering function calls. 47 ReverseStep() (*api.DebuggerState, error) 48 // StepOut continues to the return address of the current function. 49 StepOut() (*api.DebuggerState, error) 50 // ReverseStepOut continues backward to the caller of the current function. 51 ReverseStepOut() (*api.DebuggerState, error) 52 // Call resumes process execution while making a function call. 53 Call(goroutineID int64, expr string, unsafe bool) (*api.DebuggerState, error) 54 55 // StepInstruction will step a single cpu instruction. 56 StepInstruction(skipCalls bool) (*api.DebuggerState, error) 57 // ReverseStepInstruction will reverse step a single cpu instruction. 58 ReverseStepInstruction(skipCalls bool) (*api.DebuggerState, error) 59 // SwitchThread switches the current thread context. 60 SwitchThread(threadID int) (*api.DebuggerState, error) 61 // SwitchGoroutine switches the current goroutine (and the current thread as well) 62 SwitchGoroutine(goroutineID int64) (*api.DebuggerState, error) 63 // Halt suspends the process. 64 Halt() (*api.DebuggerState, error) 65 66 // GetBreakpoint gets a breakpoint by ID. 67 GetBreakpoint(id int) (*api.Breakpoint, error) 68 // GetBreakpointByName gets a breakpoint by name. 69 GetBreakpointByName(name string) (*api.Breakpoint, error) 70 // CreateBreakpoint creates a new breakpoint. 71 CreateBreakpoint(*api.Breakpoint) (*api.Breakpoint, error) 72 // CreateBreakpointWithExpr creates a new breakpoint and sets an expression to restore it after it is disabled. 73 CreateBreakpointWithExpr(*api.Breakpoint, string, [][2]string, bool) (*api.Breakpoint, error) 74 // CreateWatchpoint creates a new watchpoint. 75 CreateWatchpoint(api.EvalScope, string, api.WatchType) (*api.Breakpoint, error) 76 // ListBreakpoints gets all breakpoints. 77 ListBreakpoints(bool) ([]*api.Breakpoint, error) 78 // ClearBreakpoint deletes a breakpoint by ID. 79 ClearBreakpoint(id int) (*api.Breakpoint, error) 80 // ClearBreakpointByName deletes a breakpoint by name 81 ClearBreakpointByName(name string) (*api.Breakpoint, error) 82 // ToggleBreakpoint toggles on or off a breakpoint by ID. 83 ToggleBreakpoint(id int) (*api.Breakpoint, error) 84 // ToggleBreakpointByName toggles on or off a breakpoint by name. 85 ToggleBreakpointByName(name string) (*api.Breakpoint, error) 86 // AmendBreakpoint allows user to update an existing breakpoint for example to change the information 87 // retrieved when the breakpoint is hit or to change, add or remove the break condition 88 AmendBreakpoint(*api.Breakpoint) error 89 // CancelNext cancels a Next or Step call that was interrupted by a manual stop or by another breakpoint 90 CancelNext() error 91 92 // ListThreads lists all threads. 93 ListThreads() ([]*api.Thread, error) 94 // GetThread gets a thread by its ID. 95 GetThread(id int) (*api.Thread, error) 96 97 // ListPackageVariables lists all package variables in the context of the current thread. 98 ListPackageVariables(filter string, cfg api.LoadConfig) ([]api.Variable, error) 99 // EvalVariable returns a variable in the context of the current thread. 100 EvalVariable(scope api.EvalScope, symbol string, cfg api.LoadConfig) (*api.Variable, error) 101 102 // SetVariable sets the value of a variable 103 SetVariable(scope api.EvalScope, symbol, value string) error 104 105 // ListSources lists all source files in the process matching filter. 106 ListSources(filter string) ([]string, error) 107 // ListFunctions lists all functions in the process matching filter. 108 ListFunctions(filter string) ([]string, error) 109 // ListTypes lists all types in the process matching filter. 110 ListTypes(filter string) ([]string, error) 111 // ListPackagesBuildInfo lists all packages in the process matching filter. 112 ListPackagesBuildInfo(filter string, includeFiles bool) ([]api.PackageBuildInfo, error) 113 // ListLocalVariables lists all local variables in scope. 114 ListLocalVariables(scope api.EvalScope, cfg api.LoadConfig) ([]api.Variable, error) 115 // ListFunctionArgs lists all arguments to the current function. 116 ListFunctionArgs(scope api.EvalScope, cfg api.LoadConfig) ([]api.Variable, error) 117 // ListThreadRegisters lists registers and their values, for the given thread. 118 ListThreadRegisters(threadID int, includeFp bool) (api.Registers, error) 119 // ListScopeRegisters lists registers and their values, for the given scope. 120 ListScopeRegisters(scope api.EvalScope, includeFp bool) (api.Registers, error) 121 122 // ListGoroutines lists all goroutines. 123 ListGoroutines(start, count int) ([]*api.Goroutine, int, error) 124 // ListGoroutinesWithFilter lists goroutines matching the filters 125 ListGoroutinesWithFilter(start, count int, filters []api.ListGoroutinesFilter, group *api.GoroutineGroupingOptions, scope *api.EvalScope) ([]*api.Goroutine, []api.GoroutineGroup, int, bool, error) 126 127 // Stacktrace returns stacktrace 128 Stacktrace(goroutineID int64, depth int, opts api.StacktraceOptions, cfg *api.LoadConfig) ([]api.Stackframe, error) 129 130 // Ancestors returns ancestor stacktraces 131 Ancestors(goroutineID int64, numAncestors int, depth int) ([]api.Ancestor, error) 132 133 // AttachedToExistingProcess returns whether we attached to a running process or not 134 AttachedToExistingProcess() bool 135 136 // FindLocation returns concrete location information described by a location expression 137 // loc ::= <filename>:<line> | <function>[:<line>] | /<regex>/ | (+|-)<offset> | <line> | *<address> 138 // * <filename> can be the full path of a file or just a suffix 139 // * <function> ::= <package>.<receiver type>.<name> | <package>.(*<receiver type>).<name> | <receiver type>.<name> | <package>.<name> | (*<receiver type>).<name> | <name> 140 // * <function> must be unambiguous 141 // * /<regex>/ will return a location for each function matched by regex 142 // * +<offset> returns a location for the line that is <offset> lines after the current line 143 // * -<offset> returns a location for the line that is <offset> lines before the current line 144 // * <line> returns a location for a line in the current file 145 // * *<address> returns the location corresponding to the specified address 146 // NOTE: this function does not actually set breakpoints. 147 // If findInstruction is true FindLocation will only return locations that correspond to instructions. 148 FindLocation(scope api.EvalScope, loc string, findInstruction bool, substitutePathRules [][2]string) ([]api.Location, string, error) 149 150 // DisassembleRange disassemble code between startPC and endPC 151 DisassembleRange(scope api.EvalScope, startPC, endPC uint64, flavour api.AssemblyFlavour) (api.AsmInstructions, error) 152 // DisassemblePC disassemble code of the function containing PC 153 DisassemblePC(scope api.EvalScope, pc uint64, flavour api.AssemblyFlavour) (api.AsmInstructions, error) 154 155 // Recorded returns true if the target is a recording. 156 Recorded() bool 157 // TraceDirectory returns the path to the trace directory for a recording. 158 TraceDirectory() (string, error) 159 // Checkpoint sets a checkpoint at the current position. 160 Checkpoint(where string) (checkpointID int, err error) 161 // ListCheckpoints gets all checkpoints. 162 ListCheckpoints() ([]api.Checkpoint, error) 163 // ClearCheckpoint removes a checkpoint 164 ClearCheckpoint(id int) error 165 166 // SetReturnValuesLoadConfig sets the load configuration for return values. 167 SetReturnValuesLoadConfig(*api.LoadConfig) 168 169 // IsMulticlient returns true if the headless instance is multiclient. 170 IsMulticlient() bool 171 172 // ListDynamicLibraries returns a list of loaded dynamic libraries. 173 ListDynamicLibraries() ([]api.Image, error) 174 175 // ExamineMemory returns the raw memory stored at the given address. 176 // The amount of data to be read is specified by length which must be less than or equal to 1000. 177 // This function will return an error if it reads less than `length` bytes. 178 ExamineMemory(address uint64, length int) ([]byte, bool, error) 179 180 // StopRecording stops a recording if one is in progress. 181 StopRecording() error 182 183 // CoreDumpStart starts creating a core dump to the specified file 184 CoreDumpStart(dest string) (api.DumpState, error) 185 // CoreDumpWait waits for the core dump to finish, or for the specified amount of milliseconds 186 CoreDumpWait(msec int) api.DumpState 187 // CoreDumpCancel cancels a core dump in progress 188 CoreDumpCancel() error 189 190 // ListTargets returns the list of connected targets 191 ListTargets() ([]api.Target, error) 192 // FollowExec enables or disables the follow exec mode. In follow exec mode 193 // Delve will automatically debug child processes launched by the target 194 // process 195 FollowExec(bool, string) error 196 FollowExecEnabled() bool 197 198 // Disconnect closes the connection to the server without sending a Detach request first. 199 // If cont is true a continue command will be sent instead. 200 Disconnect(cont bool) error 201 202 // SetDebugInfoDirectories sets directories used to search for debug symbols 203 SetDebugInfoDirectories([]string) error 204 205 // GetDebugInfoDirectories returns the list of directories used to search for debug symbols 206 GetDebugInfoDirectories() ([]string, error) 207 208 // CallAPI allows calling an arbitrary rpc method (used by starlark bindings) 209 CallAPI(method string, args, reply interface{}) error 210 }