import "github.com/go-delve/delve/service/debugger"
debugger.go debugger_linux.go debugger_unix.go
const ( ExecutingExistingFile = ExecuteKind(iota) ExecutingGeneratedFile ExecutingGeneratedTest ExecutingOther )
var ( // ErrCanNotRestart is returned when the target cannot be restarted. // This is returned for targets that have been attached to, or when // debugging core files. ErrCanNotRestart = errors.New("can not restart this target") // ErrNotRecording is returned when StopRecording is called while the // debugger is not recording the target. ErrNotRecording = errors.New("debugger is not recording") )
type Config struct { // WorkingDir is working directory of the new process. This field is used // only when launching a new process. WorkingDir string // AttachPid is the PID of an existing process to which the debugger should // attach. AttachPid int // CoreFile specifies the path to the core dump to open. CoreFile string // Backend specifies the debugger backend. Backend string // Foreground lets target process access stdin. Foreground bool // DebugInfoDirectories is the list of directories to look for // when resolving external debug info files. DebugInfoDirectories []string // CheckGoVersion is true if the debugger should check the version of Go // used to compile the executable and refuse to work on incompatible // versions. CheckGoVersion bool // TTY is passed along to the target process on creation. Used to specify a // TTY for that process. TTY string // Packages contains the packages that we are debugging. Packages []string // BuildFlags contains the flags passed to the compiler. BuildFlags string // ExecuteKind contains the kind of the executed program. ExecuteKind ExecuteKind // Redirects specifies redirect rules for stdin, stdout and stderr Redirects [3]string // DisableASLR disables ASLR DisableASLR bool }
Config provides the configuration to start a Debugger.
Only one of ProcessArgs or AttachPid should be specified. If ProcessArgs is provided, a new process will be launched. Otherwise, the debugger will try to attach to an existing process with AttachPid.
type Debugger struct {
// contains filtered or unexported fields
}
Debugger service.
Debugger provides a higher level of abstraction over proc.Process. It handles converting from internal types to the types expected by clients. It also handles functionality needed by clients, but not needed in lower lever packages such as proc.
New creates a new Debugger. ProcessArgs specify the commandline arguments for the new process.
func (d *Debugger) AmendBreakpoint(amend *api.Breakpoint) error
AmendBreakpoint will update the breakpoint with the matching ID.
Ancestors returns the stacktraces for the ancestors of a goroutine.
func (d *Debugger) AsmInstructionText(inst *proc.AsmInstruction, flavour proc.AssemblyFlavour) string
Attach will attach to the process specified by 'pid'.
func (d *Debugger) Breakpoints() []*api.Breakpoint
Breakpoints returns the list of current breakpoints.
CancelNext will clear internal breakpoints, thus cancelling the 'next', 'step' or 'stepout' operation.
Checkpoint will set a checkpoint specified by the locspec.
func (d *Debugger) Checkpoints() ([]proc.Checkpoint, error)
Checkpoints will return a list of checkpoints.
func (d *Debugger) ClearBreakpoint(requestedBp *api.Breakpoint) (*api.Breakpoint, error)
ClearBreakpoint clears a breakpoint.
ClearCheckpoint will clear the checkpoint of the given ID.
func (d *Debugger) Command(command *api.DebuggerCommand) (*api.DebuggerState, error)
Command handles commands which control the debugger lifecycle
func (d *Debugger) ConvertStacktrace(rawlocs []proc.Stackframe, cfg *proc.LoadConfig) ([]api.Stackframe, error)
ConvertStacktrace converts a slice of proc.Stackframe into a slice of api.Stackframe, loading local variables and arguments of each frame if cfg is not nil.
func (d *Debugger) CreateBreakpoint(requestedBp *api.Breakpoint) (*api.Breakpoint, error)
CreateBreakpoint creates a breakpoint.
CurrentPackage returns the fully qualified name of the package corresponding to the function location of the current thread.
Detach detaches from the target process. If `kill` is true we will kill the process after detaching.
func (d *Debugger) Disassemble(goroutineID int, addr1, addr2 uint64) ([]proc.AsmInstruction, error)
Disassemble code between startPC and endPC. if endPC == 0 it will find the function containing startPC and disassemble the whole function.
DwarfRegisterToString returns the name and value representation of the given register.
func (d *Debugger) EvalVariableInScope(goid, frame, deferredCall int, symbol string, cfg proc.LoadConfig) (*proc.Variable, error)
EvalVariableInScope will attempt to evaluate the variable represented by 'symbol' in the scope provided.
ExamineMemory returns the raw memory stored at the given address. The amount of data to be read is specified by length. This function will return an error if it reads less than `length` bytes.
func (d *Debugger) FindBreakpoint(id int) *api.Breakpoint
FindBreakpoint returns the breakpoint specified by 'id'.
func (d *Debugger) FindBreakpointByName(name string) *api.Breakpoint
FindBreakpointByName returns the breakpoint specified by 'name'
func (d *Debugger) FindLocation(goid, frame, deferredCall int, locStr string, includeNonExecutableLines bool, substitutePathRules [][2]string) ([]api.Location, error)
FindLocation will find the location specified by 'locStr'.
FindThread returns the thread for the given 'id'.
FindThreadReturnValues returns the return values of the function that the thread of the given 'id' just stepped out of.
func (d *Debugger) FunctionArguments(goid, frame, deferredCall int, cfg proc.LoadConfig) ([]*proc.Variable, error)
FunctionArguments returns the arguments to the current function.
FunctionReturnLocations returns all return locations for the given function, a list of addresses corresponding to 'ret' or 'call runtime.deferreturn'.
Functions returns a list of functions in the target process.
func (d *Debugger) GetVersion(out *api.GetVersionOut) error
Goroutines will return a list of goroutines in the target process.
LastModified returns the time that the process' executable was last modified.
Launch will start a process with the given args and working directory.
ListDynamicLibraries returns a list of loaded dynamic libraries.
func (d *Debugger) ListPackagesBuildInfo(includeFiles bool) []*proc.PackageBuildInfo
ListPackagesBuildInfo returns the list of packages used by the program along with the directory where each package was compiled and optionally the list of files constituting the package.
func (d *Debugger) LocalVariables(goid, frame, deferredCall int, cfg proc.LoadConfig) ([]*proc.Variable, error)
LocalVariables returns a list of the local variables.
LockTarget acquires the target mutex.
PackageVariables returns a list of package variables for the thread, optionally regexp filtered using regexp described in 'filter'.
ProcessPid returns the PID of the process the debugger is debugging.
Recorded returns true if the target is a recording.
func (d *Debugger) Restart(rerecord bool, pos string, resetArgs bool, newArgs []string, newRedirects [3]string, rebuild bool) ([]api.DiscardedBreakpoint, error)
Restart will restart the target process, first killing and then exec'ing it again. If the target process is a recording it will restart it from the given position. If pos starts with 'c' it's a checkpoint ID, otherwise it's an event number. If resetArgs is true, newArgs will replace the process args.
func (d *Debugger) ScopeRegisters(goid, frame, deferredCall int, floatingPoint bool) (*op.DwarfRegisters, error)
ScopeRegisters returns registers for the specified scope.
SetVariableInScope will set the value of the variable represented by 'symbol' to the value given, in the given scope.
Sources returns a list of the source files for target binary.
func (d *Debugger) Stacktrace(goroutineID, depth int, opts api.StacktraceOptions) ([]proc.Stackframe, error)
Stacktrace returns a list of Stackframes for the given goroutine. The length of the returned list will be min(stack_len, depth). If 'full' is true, then local vars, function args, etc will be returned as well.
State returns the current state of the debugger.
func (d *Debugger) StopReason() proc.StopReason
StopReason returns the reason the reason why the target process is stopped. A process could be stopped for multiple simultaneous reasons, in which case only one will be reported.
StopRecording stops a recording (if one is in progress)
ThreadRegisters returns registers of the specified thread.
Threads returns the threads of the target process.
Types returns all type information in the binary.
UnlockTarget releases the target mutex.
Package debugger imports 29 packages (graph) and is imported by 30 packages. Updated 2020-12-16. Refresh now. Tools for package owners.