gdbserial

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDirChange = errors.New("direction change with internal breakpoints")
View Source
var ErrTooManyAttempts = errors.New("too many transmit attempts")
View Source
var ErrUnsupportedOS = errors.New("lldb backend not supported on windows")

Functions

func Record

func Record(cmd []string, wd string, quiet bool) (tracedir string, err error)

Record uses rr to record the execution of the specified program and returns the trace directory's path.

Types

type ErrBackendUnavailable

type ErrBackendUnavailable struct {
}

ErrBackendUnavailable is returned when the stub program can not be found.

func (*ErrBackendUnavailable) Error

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

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

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

func LLDBAttach(pid int, path string) (*Process, error)

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

func LLDBLaunch(cmd []string, wd string, foreground bool) (*Process, error)

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

func New(process *os.Process) *Process

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) (p *Process, tracedir string, err error)

RecordAndReplay acts like calling Record and then Replay.

func Replay

func Replay(tracedir string, quiet bool) (*Process, error)

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

func (*Process) Breakpoints

func (p *Process) Breakpoints() *proc.BreakpointMap

func (*Process) CheckAndClearManualStopRequest

func (p *Process) CheckAndClearManualStopRequest() bool

func (*Process) Checkpoint

func (p *Process) Checkpoint(where string) (int, error)

func (*Process) Checkpoints

func (p *Process) Checkpoints() ([]proc.Checkpoint, error)

func (*Process) ClearBreakpoint

func (p *Process) ClearBreakpoint(addr uint64) (*proc.Breakpoint, error)

func (*Process) ClearCheckpoint

func (p *Process) ClearCheckpoint(id int) error

func (*Process) ClearInternalBreakpoints

func (p *Process) ClearInternalBreakpoints() error

func (*Process) Common

func (p *Process) Common() *proc.CommonProcess

func (*Process) Connect

func (p *Process) Connect(conn net.Conn, path string, pid int) error

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

func (p *Process) ContinueOnce() (proc.Thread, error)

func (*Process) CurrentThread

func (p *Process) CurrentThread() proc.Thread

func (*Process) Detach

func (p *Process) Detach(kill bool) error

func (*Process) Dial

func (p *Process) Dial(addr string, path string, pid int) error

Dial attempts to connect to the stub.

func (*Process) Direction

func (p *Process) Direction(dir proc.Direction) error

func (*Process) FindBreakpoint

func (p *Process) FindBreakpoint(pc uint64) (*proc.Breakpoint, bool)

func (*Process) FindThread

func (p *Process) FindThread(threadID int) (proc.Thread, bool)

func (*Process) Listen

func (p *Process) Listen(listener net.Listener, path string, pid int) error

Listen waits for a connection from the stub.

func (*Process) Pid

func (p *Process) Pid() int

func (*Process) Recorded

func (p *Process) Recorded() (bool, string)

func (*Process) RequestManualStop

func (p *Process) RequestManualStop() error

func (*Process) Restart

func (p *Process) Restart(pos string) error

func (*Process) ResumeNotify

func (p *Process) ResumeNotify(ch chan<- struct{})

func (*Process) SelectedGoroutine

func (p *Process) SelectedGoroutine() *proc.G

func (*Process) SetBreakpoint

func (p *Process) SetBreakpoint(addr uint64, kind proc.BreakpointKind, cond ast.Expr) (*proc.Breakpoint, error)

func (*Process) StepInstruction

func (p *Process) StepInstruction() error

func (*Process) SwitchGoroutine

func (p *Process) SwitchGoroutine(gid int) error

func (*Process) SwitchThread

func (p *Process) SwitchThread(tid int) error

func (*Process) ThreadList

func (p *Process) ThreadList() []proc.Thread

func (*Process) Valid

func (p *Process) Valid() (bool, error)

func (*Process) When

func (p *Process) When() (string, error)

type Thread

type Thread struct {
	ID int

	CurrentBreakpoint proc.BreakpointState
	// contains filtered or unexported fields
}

Thread is a thread.

func (*Thread) Arch

func (t *Thread) Arch() proc.Arch

func (*Thread) BinInfo

func (t *Thread) BinInfo() *proc.BinaryInfo

func (*Thread) Blocked

func (t *Thread) Blocked() bool

func (*Thread) Breakpoint

func (t *Thread) Breakpoint() proc.BreakpointState

func (*Thread) Common

func (t *Thread) Common() *proc.CommonThread

func (*Thread) Location

func (t *Thread) Location() (*proc.Location, error)

func (*Thread) ReadMemory

func (t *Thread) ReadMemory(data []byte, addr uintptr) (n int, err error)

func (*Thread) Registers

func (t *Thread) Registers(floatingPoint bool) (proc.Registers, error)

func (*Thread) RestoreRegisters

func (t *Thread) RestoreRegisters(regs proc.SavedRegisters) error

func (*Thread) SetCurrentBreakpoint

func (thread *Thread) SetCurrentBreakpoint() error

func (*Thread) SetDX

func (t *Thread) SetDX(dx uint64) error

func (*Thread) SetPC

func (t *Thread) SetPC(pc uint64) error

func (*Thread) SetSP

func (t *Thread) SetSP(sp uint64) error

func (*Thread) StepInstruction

func (t *Thread) StepInstruction() error

func (*Thread) ThreadID

func (t *Thread) ThreadID() int

func (*Thread) WriteMemory

func (t *Thread) WriteMemory(addr uintptr, data []byte) (written int, err error)

Jump to

Keyboard shortcuts

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