Documentation ¶
Overview ¶
Package proctl provides functions for attaching to and manipulating a process during the debug session.
Index ¶
- type BreakPoint
- type BreakPointExistsError
- type DebuggedProcess
- func (dbp *DebuggedProcess) Break(addr uintptr) (*BreakPoint, error)
- func (dbp *DebuggedProcess) CheckAndClearBP() (func(), error)
- func (dbp *DebuggedProcess) Clear(pc uint64) (*BreakPoint, error)
- func (dbp *DebuggedProcess) Continue() error
- func (dbp *DebuggedProcess) CurrentPC() (uint64, error)
- func (dbp *DebuggedProcess) EvalSymbol(name string) (*Variable, error)
- func (dbp *DebuggedProcess) LoadInformation() error
- func (dbp *DebuggedProcess) Next() error
- func (dbp *DebuggedProcess) PCtoBP(pc uint64) (*BreakPoint, bool)
- func (dbp *DebuggedProcess) Registers() (*syscall.PtraceRegs, error)
- func (dbp *DebuggedProcess) ReturnAddressFromOffset(offset int64) uint64
- func (dbp *DebuggedProcess) Step() (err error)
- type Variable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BreakPoint ¶
Represents a single breakpoint. Stores information on the break point including the byte of data that originally was stored at that address.
type BreakPointExistsError ¶
type BreakPointExistsError struct {
// contains filtered or unexported fields
}
func (BreakPointExistsError) Error ¶
func (bpe BreakPointExistsError) Error() string
type DebuggedProcess ¶
type DebuggedProcess struct { Pid int Regs *syscall.PtraceRegs Process *os.Process ProcessState *syscall.WaitStatus Executable *elf.File Symbols []elf.Symbol GoSymTable *gosym.Table FrameEntries *frame.FrameDescriptionEntries DebugLine *line.DebugLineInfo BreakPoints map[string]*BreakPoint TempBreakPoints map[uint64]*BreakPoint }
Struct representing a debugged process. Holds onto pid, register values, process struct and process state.
func NewDebugProcess ¶
func NewDebugProcess(pid int) (*DebuggedProcess, error)
Returns a new DebuggedProcess struct with sensible defaults.
func (*DebuggedProcess) Break ¶
func (dbp *DebuggedProcess) Break(addr uintptr) (*BreakPoint, error)
Sets a breakpoint in the running process.
func (*DebuggedProcess) CheckAndClearBP ¶
func (dbp *DebuggedProcess) CheckAndClearBP() (func(), error)
func (*DebuggedProcess) Clear ¶
func (dbp *DebuggedProcess) Clear(pc uint64) (*BreakPoint, error)
Clears a breakpoint.
func (*DebuggedProcess) Continue ¶
func (dbp *DebuggedProcess) Continue() error
Continue process until next breakpoint.
func (*DebuggedProcess) CurrentPC ¶
func (dbp *DebuggedProcess) CurrentPC() (uint64, error)
returns current rip, whose content is virtual address (linear address)
func (*DebuggedProcess) EvalSymbol ¶
func (dbp *DebuggedProcess) EvalSymbol(name string) (*Variable, error)
Returns the value of the named symbol.
func (*DebuggedProcess) LoadInformation ¶
func (dbp *DebuggedProcess) LoadInformation() error
Finds the executable from /proc/<pid>/exe and then uses that to parse the following information: * Dwarf .debug_frame section * Dwarf .debug_line section * Go symbol table.
func (*DebuggedProcess) PCtoBP ¶
func (dbp *DebuggedProcess) PCtoBP(pc uint64) (*BreakPoint, bool)
Converts a program counter value into a breakpoint, if one was set for the function containing pc.
func (*DebuggedProcess) Registers ¶
func (dbp *DebuggedProcess) Registers() (*syscall.PtraceRegs, error)
Obtains register values from the debugged process.
func (*DebuggedProcess) ReturnAddressFromOffset ¶
func (dbp *DebuggedProcess) ReturnAddressFromOffset(offset int64) uint64
Takes an offset from RSP and returns the address of the instruction the currect function is going to return to.
func (*DebuggedProcess) Step ¶
func (dbp *DebuggedProcess) Step() (err error)
Steps through process.