Documentation ¶
Index ¶
- Variables
- type Config
- type Debugger
- func (d *Debugger) AmendBreakpoint(amend *api.Breakpoint) error
- func (d *Debugger) Ancestors(goroutineID, numAncestors, depth int) ([]api.Ancestor, error)
- func (d *Debugger) Attach(pid int, path string) (*proc.Target, error)
- func (d *Debugger) Breakpoints() []*api.Breakpoint
- func (d *Debugger) CancelNext() error
- func (d *Debugger) Checkpoint(where string) (int, error)
- func (d *Debugger) Checkpoints() ([]api.Checkpoint, error)
- func (d *Debugger) ClearBreakpoint(requestedBp *api.Breakpoint) (*api.Breakpoint, error)
- func (d *Debugger) ClearCheckpoint(id int) error
- func (d *Debugger) Command(command *api.DebuggerCommand) (*api.DebuggerState, error)
- func (d *Debugger) CreateBreakpoint(requestedBp *api.Breakpoint) (*api.Breakpoint, error)
- func (d *Debugger) Detach(kill bool) error
- func (d *Debugger) Disassemble(goroutineID int, addr1, addr2 uint64, flavour api.AssemblyFlavour) (api.AsmInstructions, error)
- func (d *Debugger) EvalVariableInScope(scope api.EvalScope, symbol string, cfg proc.LoadConfig) (*api.Variable, error)
- func (d *Debugger) ExamineMemory(address uintptr, length int) ([]byte, error)
- func (d *Debugger) FindBreakpoint(id int) *api.Breakpoint
- func (d *Debugger) FindBreakpointByName(name string) *api.Breakpoint
- func (d *Debugger) FindLocation(scope api.EvalScope, locStr string, includeNonExecutableLines bool) ([]api.Location, error)
- func (d *Debugger) FindThread(id int) (*api.Thread, error)
- func (d *Debugger) FunctionArguments(scope api.EvalScope, cfg proc.LoadConfig) ([]api.Variable, error)
- func (d *Debugger) FunctionReturnLocations(fnName string) ([]uint64, error)
- func (d *Debugger) Functions(filter string) ([]string, error)
- func (d *Debugger) GetVersion(out *api.GetVersionOut) error
- func (d *Debugger) Goroutines(start, count int) ([]*api.Goroutine, int, error)
- func (d *Debugger) LastModified() time.Time
- func (d *Debugger) Launch(processArgs []string, wd string) (*proc.Target, error)
- func (d *Debugger) ListDynamicLibraries() []api.Image
- func (d *Debugger) ListPackagesBuildInfo(includeFiles bool) []api.PackageBuildInfo
- func (d *Debugger) LocalVariables(scope api.EvalScope, cfg proc.LoadConfig) ([]api.Variable, error)
- func (d *Debugger) PackageVariables(threadID int, filter string, cfg proc.LoadConfig) ([]api.Variable, error)
- func (d *Debugger) ProcessPid() int
- func (d *Debugger) Recorded() (recorded bool, tracedir string)
- func (d *Debugger) Registers(threadID int, scope *api.EvalScope, floatingPoint bool) (api.Registers, error)
- func (d *Debugger) Restart(rerecord bool, pos string, resetArgs bool, newArgs []string) ([]api.DiscardedBreakpoint, error)
- func (d *Debugger) SetVariableInScope(scope api.EvalScope, symbol, value string) error
- func (d *Debugger) Sources(filter string) ([]string, error)
- func (d *Debugger) Stacktrace(goroutineID, depth int, opts api.StacktraceOptions, cfg *proc.LoadConfig) ([]api.Stackframe, error)
- func (d *Debugger) State(nowait bool) (*api.DebuggerState, error)
- func (d *Debugger) StopRecording() error
- func (d *Debugger) Threads() ([]*api.Thread, error)
- func (d *Debugger) Types(filter string) ([]string, error)
Constants ¶
This section is empty.
Variables ¶
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") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
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 }
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 ¶
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.
func New ¶
New creates a new Debugger. ProcessArgs specify the commandline arguments for the new process.
func (*Debugger) AmendBreakpoint ¶
func (d *Debugger) AmendBreakpoint(amend *api.Breakpoint) error
AmendBreakpoint will update the breakpoint with the matching ID.
func (*Debugger) Breakpoints ¶
func (d *Debugger) Breakpoints() []*api.Breakpoint
Breakpoints returns the list of current breakpoints.
func (*Debugger) CancelNext ¶
CancelNext will clear internal breakpoints, thus cancelling the 'next', 'step' or 'stepout' operation.
func (*Debugger) Checkpoint ¶
Checkpoint will set a checkpoint specified by the locspec.
func (*Debugger) Checkpoints ¶
func (d *Debugger) Checkpoints() ([]api.Checkpoint, error)
Checkpoints will return a list of checkpoints.
func (*Debugger) ClearBreakpoint ¶
func (d *Debugger) ClearBreakpoint(requestedBp *api.Breakpoint) (*api.Breakpoint, error)
ClearBreakpoint clears a breakpoint.
func (*Debugger) ClearCheckpoint ¶
ClearCheckpoint will clear the checkpoint of the given ID.
func (*Debugger) Command ¶
func (d *Debugger) Command(command *api.DebuggerCommand) (*api.DebuggerState, error)
Command handles commands which control the debugger lifecycle
func (*Debugger) CreateBreakpoint ¶
func (d *Debugger) CreateBreakpoint(requestedBp *api.Breakpoint) (*api.Breakpoint, error)
CreateBreakpoint creates a breakpoint.
func (*Debugger) Detach ¶
Detach detaches from the target process. If `kill` is true we will kill the process after detaching.
func (*Debugger) Disassemble ¶
func (d *Debugger) Disassemble(goroutineID int, addr1, addr2 uint64, flavour api.AssemblyFlavour) (api.AsmInstructions, error)
Disassemble code between startPC and endPC. if endPC == 0 it will find the function containing startPC and disassemble the whole function.
func (*Debugger) EvalVariableInScope ¶
func (d *Debugger) EvalVariableInScope(scope api.EvalScope, symbol string, cfg proc.LoadConfig) (*api.Variable, error)
EvalVariableInScope will attempt to evaluate the variable represented by 'symbol' in the scope provided.
func (*Debugger) ExamineMemory ¶
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 (*Debugger) FindBreakpoint ¶
func (d *Debugger) FindBreakpoint(id int) *api.Breakpoint
FindBreakpoint returns the breakpoint specified by 'id'.
func (*Debugger) FindBreakpointByName ¶
func (d *Debugger) FindBreakpointByName(name string) *api.Breakpoint
FindBreakpointByName returns the breakpoint specified by 'name'
func (*Debugger) FindLocation ¶
func (d *Debugger) FindLocation(scope api.EvalScope, locStr string, includeNonExecutableLines bool) ([]api.Location, error)
FindLocation will find the location specified by 'locStr'.
func (*Debugger) FindThread ¶
FindThread returns the thread for the given 'id'.
func (*Debugger) FunctionArguments ¶
func (d *Debugger) FunctionArguments(scope api.EvalScope, cfg proc.LoadConfig) ([]api.Variable, error)
FunctionArguments returns the arguments to the current function.
func (*Debugger) FunctionReturnLocations ¶
FunctionReturnLocations returns all return locations for the given function, a list of addresses corresponding to 'ret' or 'call runtime.deferreturn'.
func (*Debugger) GetVersion ¶
func (d *Debugger) GetVersion(out *api.GetVersionOut) error
func (*Debugger) Goroutines ¶
Goroutines will return a list of goroutines in the target process.
func (*Debugger) LastModified ¶
LastModified returns the time that the process' executable was last modified.
func (*Debugger) ListDynamicLibraries ¶
ListDynamicLibraries returns a list of loaded dynamic libraries.
func (*Debugger) ListPackagesBuildInfo ¶
func (d *Debugger) ListPackagesBuildInfo(includeFiles bool) []api.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 (*Debugger) LocalVariables ¶
LocalVariables returns a list of the local variables.
func (*Debugger) PackageVariables ¶
func (d *Debugger) PackageVariables(threadID int, filter string, cfg proc.LoadConfig) ([]api.Variable, error)
PackageVariables returns a list of package variables for the thread, optionally regexp filtered using regexp described in 'filter'.
func (*Debugger) ProcessPid ¶
ProcessPid returns the PID of the process the debugger is debugging.
func (*Debugger) Registers ¶
func (d *Debugger) Registers(threadID int, scope *api.EvalScope, floatingPoint bool) (api.Registers, error)
Registers returns string representation of the CPU registers.
func (*Debugger) Restart ¶
func (d *Debugger) Restart(rerecord bool, pos string, resetArgs bool, newArgs []string) ([]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 (*Debugger) SetVariableInScope ¶
SetVariableInScope will set the value of the variable represented by 'symbol' to the value given, in the given scope.
func (*Debugger) Stacktrace ¶
func (d *Debugger) Stacktrace(goroutineID, depth int, opts api.StacktraceOptions, cfg *proc.LoadConfig) ([]api.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.
func (*Debugger) State ¶
func (d *Debugger) State(nowait bool) (*api.DebuggerState, error)
State returns the current state of the debugger.
func (*Debugger) StopRecording ¶
StopRecording stops a recording (if one is in progress)