debugger

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2018 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoAttachPath = errors.New("must specify executable path on macOS")

ErrNoAttachPath is the error returned when the client tries to attach to a process on macOS using the lldb backend without specifying the path to the target's executable.

Functions

This section is empty.

Types

type AddrLocationSpec

type AddrLocationSpec struct {
	AddrExpr string
}

func (*AddrLocationSpec) Find

func (loc *AddrLocationSpec) Find(d *Debugger, scope *proc.EvalScope, locStr string) ([]api.Location, error)

type AmbiguousLocationError

type AmbiguousLocationError struct {
	Location           string
	CandidatesString   []string
	CandidatesLocation []api.Location
}

func (AmbiguousLocationError) Error

func (ale AmbiguousLocationError) Error() string

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
}

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

func New(config *Config, processArgs []string) (*Debugger, error)

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

func (*Debugger) Attach added in v1.0.0

func (d *Debugger) Attach(pid int, path string) (proc.Process, error)

func (*Debugger) Breakpoints

func (d *Debugger) Breakpoints() []*api.Breakpoint

Breakpoints returns the list of current breakpoints.

func (*Debugger) CancelNext

func (d *Debugger) CancelNext() error

func (*Debugger) Checkpoint added in v1.0.0

func (d *Debugger) Checkpoint(where string) (int, error)

func (*Debugger) Checkpoints added in v1.0.0

func (d *Debugger) Checkpoints() ([]api.Checkpoint, error)

func (*Debugger) ClearBreakpoint

func (d *Debugger) ClearBreakpoint(requestedBp *api.Breakpoint) (*api.Breakpoint, error)

ClearBreakpoint clears a breakpoint.

func (*Debugger) ClearCheckpoint added in v1.0.0

func (d *Debugger) ClearCheckpoint(id int) error

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

func (d *Debugger) Detach(kill bool) error

Detach detaches from the target process. If `kill` is true we will kill the process after detaching.

func (*Debugger) Disassemble

func (d *Debugger) Disassemble(scope api.EvalScope, startPC, endPC 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) 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) ([]api.Location, error)

FindLocation will find the location specified by 'locStr'.

func (*Debugger) FindThread

func (d *Debugger) FindThread(id int) (*api.Thread, error)

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) Functions

func (d *Debugger) Functions(filter string) ([]string, error)

Functions returns a list of functions in the target process.

func (*Debugger) Goroutines

func (d *Debugger) Goroutines() ([]*api.Goroutine, error)

Goroutines will return a list of goroutines in the target process.

func (*Debugger) LastModified

func (d *Debugger) LastModified() time.Time

LastModified returns the time that the process' executable was last modified.

func (*Debugger) Launch added in v1.0.0

func (d *Debugger) Launch(processArgs []string, wd string) (proc.Process, error)

func (*Debugger) LocalVariables

func (d *Debugger) LocalVariables(scope api.EvalScope, cfg proc.LoadConfig) ([]api.Variable, error)

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

func (d *Debugger) ProcessPid() int

ProcessPid returns the PID of the process the debugger is debugging.

func (*Debugger) Recorded added in v1.0.0

func (d *Debugger) Recorded() (recorded bool, tracedir string)

Recorded returns true if the target is a recording.

func (*Debugger) Registers

func (d *Debugger) Registers(threadID int, floatingPoint bool) (api.Registers, error)

Registers returns string representation of the CPU registers.

func (*Debugger) Restart

func (d *Debugger) Restart(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

func (d *Debugger) SetVariableInScope(scope api.EvalScope, symbol, value string) error

SetVariableInScope will set the value of the variable represented by 'symbol' to the value given, in the given scope.

func (*Debugger) Sources

func (d *Debugger) Sources(filter string) ([]string, error)

Sources returns a list of the source files for target binary.

func (*Debugger) Stacktrace

func (d *Debugger) Stacktrace(goroutineID, depth int, 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() (*api.DebuggerState, error)

State returns the current state of the debugger.

func (*Debugger) Threads

func (d *Debugger) Threads() ([]*api.Thread, error)

Threads returns the threads of the target process.

func (*Debugger) Types

func (d *Debugger) Types(filter string) ([]string, error)

type FuncLocationSpec

type FuncLocationSpec struct {
	PackageName           string
	AbsolutePackage       bool
	ReceiverName          string
	PackageOrReceiverName string
	BaseName              string
}

func (*FuncLocationSpec) Match

func (spec *FuncLocationSpec) Match(sym proc.Function) bool

type LineLocationSpec

type LineLocationSpec struct {
	Line int
}

func (*LineLocationSpec) Find

func (loc *LineLocationSpec) Find(d *Debugger, scope *proc.EvalScope, locStr string) ([]api.Location, error)

type LocationSpec

type LocationSpec interface {
	Find(d *Debugger, scope *proc.EvalScope, locStr string) ([]api.Location, error)
}

type NormalLocationSpec

type NormalLocationSpec struct {
	Base       string
	FuncBase   *FuncLocationSpec
	LineOffset int
}

func (*NormalLocationSpec) FileMatch

func (loc *NormalLocationSpec) FileMatch(path string) bool

func (*NormalLocationSpec) Find

func (loc *NormalLocationSpec) Find(d *Debugger, scope *proc.EvalScope, locStr string) ([]api.Location, error)

type OffsetLocationSpec

type OffsetLocationSpec struct {
	Offset int
}

func (*OffsetLocationSpec) Find

func (loc *OffsetLocationSpec) Find(d *Debugger, scope *proc.EvalScope, locStr string) ([]api.Location, error)

type RegexLocationSpec

type RegexLocationSpec struct {
	FuncRegex string
}

func (*RegexLocationSpec) Find

func (loc *RegexLocationSpec) Find(d *Debugger, scope *proc.EvalScope, locStr string) ([]api.Location, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL