Documentation
¶
Index ¶
- Variables
- func Record(cmd []string, wd string, quiet bool) (tracedir string, err error)
- type ErrBackendUnavailable
- type ErrMalformedRRGdbCommand
- type ErrPerfEventParanoid
- type GdbMalformedThreadIDError
- type GdbProtocolError
- type Process
- func LLDBAttach(pid int, path string, debugInfoDirs []string) (*Process, error)
- func LLDBLaunch(cmd []string, wd string, foreground bool, debugInfoDirs []string) (*Process, error)
- func New(process *os.Process) *Process
- func RecordAndReplay(cmd []string, wd string, quiet bool, debugInfoDirs []string) (p *Process, tracedir string, err error)
- func Replay(tracedir string, quiet, deleteOnDetach bool, debugInfoDirs []string) (*Process, error)
- func (p *Process) BinInfo() *proc.BinaryInfo
- func (p *Process) Breakpoints() *proc.BreakpointMap
- func (p *Process) CheckAndClearManualStopRequest() bool
- func (p *Process) Checkpoint(where string) (int, error)
- func (p *Process) Checkpoints() ([]proc.Checkpoint, error)
- func (p *Process) ClearBreakpoint(addr uint64) (*proc.Breakpoint, error)
- func (p *Process) ClearCheckpoint(id int) error
- func (p *Process) ClearInternalBreakpoints() error
- func (p *Process) Common() *proc.CommonProcess
- func (p *Process) Connect(conn net.Conn, path string, pid int, debugInfoDirs []string) error
- func (p *Process) ContinueOnce() (proc.Thread, error)
- func (p *Process) CurrentThread() proc.Thread
- func (p *Process) Detach(kill bool) error
- func (p *Process) Dial(addr string, path string, pid int, debugInfoDirs []string) error
- func (p *Process) Direction(dir proc.Direction) error
- func (p *Process) EntryPoint() (uint64, error)
- func (p *Process) FindBreakpoint(pc uint64) (*proc.Breakpoint, bool)
- func (p *Process) FindThread(threadID int) (proc.Thread, bool)
- func (p *Process) Listen(listener net.Listener, path string, pid int, debugInfoDirs []string) error
- func (p *Process) Pid() int
- func (p *Process) Recorded() (bool, string)
- func (p *Process) RequestManualStop() error
- func (p *Process) Restart(pos string) error
- func (p *Process) ResumeNotify(ch chan<- struct{})
- func (p *Process) SelectedGoroutine() *proc.G
- func (p *Process) SetBreakpoint(addr uint64, kind proc.BreakpointKind, cond ast.Expr) (*proc.Breakpoint, error)
- func (p *Process) SetSelectedGoroutine(g *proc.G)
- func (p *Process) StepInstruction() error
- func (p *Process) SwitchGoroutine(gid int) error
- func (p *Process) SwitchThread(tid int) error
- func (p *Process) ThreadList() []proc.Thread
- func (p *Process) Valid() (bool, error)
- func (p *Process) When() (string, error)
- type Thread
- func (t *Thread) Arch() proc.Arch
- func (t *Thread) BinInfo() *proc.BinaryInfo
- func (t *Thread) Blocked() bool
- func (t *Thread) Breakpoint() proc.BreakpointState
- func (t *Thread) Common() *proc.CommonThread
- func (t *Thread) Location() (*proc.Location, error)
- func (t *Thread) ReadMemory(data []byte, addr uintptr) (n int, err error)
- func (t *Thread) Registers(floatingPoint bool) (proc.Registers, error)
- func (t *Thread) RestoreRegisters(savedRegs proc.Registers) error
- func (t *Thread) SetCurrentBreakpoint(adjustPC bool) error
- func (t *Thread) SetDX(dx uint64) error
- func (t *Thread) SetPC(pc uint64) error
- func (t *Thread) SetSP(sp uint64) error
- func (t *Thread) StepInstruction() error
- func (t *Thread) ThreadID() int
- func (t *Thread) WriteMemory(addr uintptr, data []byte) (written int, err error)
Constants ¶
This section is empty.
Variables ¶
var ErrDirChange = errors.New("direction change with internal breakpoints")
ErrDirChange is returned when trying to change execution direction while there are still internal breakpoints set.
var ErrTooManyAttempts = errors.New("too many transmit attempts")
var ErrUnsupportedOS = errors.New("lldb backend not supported on Windows")
ErrUnsupportedOS is returned when trying to use the lldb backend on Windows.
Functions ¶
Types ¶
type ErrBackendUnavailable ¶ added in v1.1.0
type ErrBackendUnavailable struct{}
ErrBackendUnavailable is returned when the stub program can not be found.
func (*ErrBackendUnavailable) Error ¶ added in v1.1.0
func (err *ErrBackendUnavailable) Error() string
type ErrMalformedRRGdbCommand ¶
type ErrMalformedRRGdbCommand struct {
// contains filtered or unexported fields
}
func (*ErrMalformedRRGdbCommand) Error ¶
func (err *ErrMalformedRRGdbCommand) Error() string
type ErrPerfEventParanoid ¶ added in v1.1.0
type ErrPerfEventParanoid struct {
// contains filtered or unexported fields
}
ErrPerfEventParanoid is the error returned by Reply and Record if /proc/sys/kernel/perf_event_paranoid is greater than 1.
func (ErrPerfEventParanoid) Error ¶ added in v1.1.0
func (err ErrPerfEventParanoid) Error() string
type GdbMalformedThreadIDError ¶
type GdbMalformedThreadIDError struct {
// contains filtered or unexported fields
}
GdbMalformedThreadIDError is returned when a the stub responds with a thread ID that does not conform with the Gdb Remote Serial Protocol specification.
func (*GdbMalformedThreadIDError) Error ¶
func (err *GdbMalformedThreadIDError) Error() string
type GdbProtocolError ¶
type GdbProtocolError struct {
// contains filtered or unexported fields
}
GdbProtocolError is an error response (Exx) of Gdb Remote Serial Protocol or an "unsupported command" response (empty packet).
func (*GdbProtocolError) Error ¶
func (err *GdbProtocolError) Error() string
type Process ¶
type Process struct {
// contains filtered or unexported fields
}
Process implements proc.Process using a connection to a debugger stub that understands Gdb Remote Serial Protocol.
func LLDBAttach ¶
LLDBAttach starts an instance of lldb-server and connects to it, asking it to attach to the specified pid. Path is path to the target's executable, path only needs to be specified for some stubs that do not provide an automated way of determining it (for example debugserver).
func LLDBLaunch ¶
LLDBLaunch starts an instance of lldb-server and connects to it, asking it to launch the specified target program with the specified arguments (cmd) on the specified directory wd.
func New ¶
New creates a new Process instance. If process is not nil it is the stub's process and will be killed after Detach. Use Listen, Dial or Connect to complete connection.
func RecordAndReplay ¶
func RecordAndReplay(cmd []string, wd string, quiet bool, debugInfoDirs []string) (p *Process, tracedir string, err error)
RecordAndReplay acts like calling Record and then Replay.
func Replay ¶
Replay starts an instance of rr in replay mode, with the specified trace directory, and connects to it.
func (*Process) BinInfo ¶
func (p *Process) BinInfo() *proc.BinaryInfo
BinInfo returns information on the binary.
func (*Process) Breakpoints ¶
func (p *Process) Breakpoints() *proc.BreakpointMap
Breakpoints returns the list of breakpoints currently set.
func (*Process) CheckAndClearManualStopRequest ¶
CheckAndClearManualStopRequest will check for a manual stop and then clear that state.
func (*Process) Checkpoint ¶
Checkpoint creates a checkpoint from which you can restart the program.
func (*Process) Checkpoints ¶
func (p *Process) Checkpoints() ([]proc.Checkpoint, error)
Checkpoints returns a list of all checkpoints set.
func (*Process) ClearBreakpoint ¶
func (p *Process) ClearBreakpoint(addr uint64) (*proc.Breakpoint, error)
ClearBreakpoint clears a breakpoint at the given address.
func (*Process) ClearCheckpoint ¶
ClearCheckpoint clears the checkpoint for the given ID.
func (*Process) ClearInternalBreakpoints ¶
ClearInternalBreakpoints clear all internal use breakpoints like those set by 'next'.
func (*Process) Common ¶ added in v1.1.0
func (p *Process) Common() *proc.CommonProcess
Common returns common information across Process implementations.
func (*Process) Connect ¶
Connect connects to a stub and performs a handshake.
Path and pid are, respectively, the path to the executable of the target program and the PID of the target process, both are optional, however some stubs do not provide ways to determine path and pid automatically and Connect will be unable to function without knowing them.
func (*Process) ContinueOnce ¶
ContinueOnce will continue execution of the process until a breakpoint is hit or signal is received.
func (*Process) CurrentThread ¶
CurrentThread returns the current active selected thread.
func (*Process) Detach ¶
Detach will detach from the target process, if 'kill' is true it will also kill the process.
func (*Process) Direction ¶
Direction sets whether to run the program forwards or in reverse execution.
func (*Process) EntryPoint ¶ added in v1.2.0
EntryPoint will return the process entry point address, useful for debugging PIEs.
func (*Process) FindBreakpoint ¶
func (p *Process) FindBreakpoint(pc uint64) (*proc.Breakpoint, bool)
FindBreakpoint returns the breakpoint at the given address.
func (*Process) FindThread ¶
FindThread returns the thread with the given ID.
func (*Process) Recorded ¶
Recorded returns whether or not we are debugging a recorded "traced" program.
func (*Process) RequestManualStop ¶
RequestManualStop will attempt to stop the process without a breakpoint or signal having been recieved.
func (*Process) ResumeNotify ¶
func (p *Process) ResumeNotify(ch chan<- struct{})
ResumeNotify specifies a channel that will be closed the next time ContinueOnce finishes resuming the target.
func (*Process) SelectedGoroutine ¶
SelectedGoroutine returns the current actuve selected goroutine.
func (*Process) SetBreakpoint ¶
func (p *Process) SetBreakpoint(addr uint64, kind proc.BreakpointKind, cond ast.Expr) (*proc.Breakpoint, error)
SetBreakpoint creates a new breakpoint.
func (*Process) SetSelectedGoroutine ¶ added in v1.2.0
SetSelectedGoroutine will set internally the goroutine that should be the default for any command executed, the goroutine being actively followed.
func (*Process) StepInstruction ¶
StepInstruction will step exactly one CPU instruction.
func (*Process) SwitchGoroutine ¶
SwitchGoroutine will change the internal selected goroutine.
func (*Process) SwitchThread ¶
SwitchThread will change the internal selected thread.
func (*Process) ThreadList ¶
ThreadList returns all threads in the process.
type Thread ¶
type Thread struct {
ID int
CurrentBreakpoint proc.BreakpointState
// contains filtered or unexported fields
}
Thread represents an operating system thread.
func (*Thread) BinInfo ¶
func (t *Thread) BinInfo() *proc.BinaryInfo
BinInfo will return information on the binary being debugged.
func (*Thread) Breakpoint ¶
func (t *Thread) Breakpoint() proc.BreakpointState
Breakpoint returns the current active breakpoint for this thread.
func (*Thread) Common ¶ added in v1.1.0
func (t *Thread) Common() *proc.CommonThread
Common returns common information across Process implementations.
func (*Thread) ReadMemory ¶
ReadMemory will read into 'data' memory at the address provided.
func (*Thread) RestoreRegisters ¶ added in v1.1.0
RestoreRegisters will set the CPU registers the value of those provided.
func (*Thread) SetCurrentBreakpoint ¶
SetCurrentBreakpoint will find and set the threads current breakpoint.
func (*Thread) SetDX ¶ added in v1.1.0
SetDX will set the value of the DX register to the given value.
func (*Thread) SetPC ¶ added in v1.1.0
SetPC will set the value of the PC register to the given value.
func (*Thread) SetSP ¶ added in v1.1.0
SetSP will set the value of the SP register to the given value.
func (*Thread) StepInstruction ¶
StepInstruction will step exactly 1 CPU instruction.