Documentation ¶
Index ¶
- Constants
- func PtraceAttach(pid int) error
- func PtraceCont(tid, sig int) error
- func PtraceDetach(tid, sig int) error
- func PtraceGetRegset(tid int) (regset proc.LinuxX86Xstate, err error)
- func PtracePeekUser(tid int, off uintptr) (uintptr, error)
- func PtracePokeUser(tid int, off, addr uintptr) error
- func PtraceSingleStep(tid int) error
- type OSProcessDetails
- type OSSpecificDetails
- type Process
- func (dbp *Process) BinInfo() *proc.BinaryInfo
- func (dbp *Process) Breakpoints() *proc.BreakpointMap
- func (dbp *Process) CheckAndClearManualStopRequest() bool
- func (dbp *Process) Checkpoint(string) (int, error)
- func (dbp *Process) Checkpoints() ([]proc.Checkpoint, error)
- func (dbp *Process) ClearBreakpoint(addr uint64) (*proc.Breakpoint, error)
- func (dbp *Process) ClearCheckpoint(int) error
- func (dbp *Process) ClearInternalBreakpoints() error
- func (dbp *Process) Common() *proc.CommonProcess
- func (dbp *Process) ContinueOnce() (proc.Thread, error)
- func (dbp *Process) CurrentThread() proc.Thread
- func (dbp *Process) Detach(kill bool) (err error)
- func (dbp *Process) Direction(proc.Direction) error
- func (dbp *Process) FindBreakpoint(pc uint64) (*proc.Breakpoint, bool)
- func (dbp *Process) FindThread(threadID int) (proc.Thread, bool)
- func (dbp *Process) LoadInformation(path string) error
- func (dbp *Process) Pid() int
- func (dbp *Process) Recorded() (bool, string)
- func (dbp *Process) RequestManualStop() error
- func (dbp *Process) Restart(string) error
- func (dbp *Process) ResumeNotify(ch chan<- struct{})
- func (dbp *Process) SelectedGoroutine() *proc.G
- func (dbp *Process) SetBreakpoint(addr uint64, kind proc.BreakpointKind, cond ast.Expr) (*proc.Breakpoint, error)
- func (dbp *Process) StepInstruction() (err error)
- func (dbp *Process) SwitchGoroutine(gid int) error
- func (dbp *Process) SwitchThread(tid int) error
- func (dbp *Process) ThreadList() []proc.Thread
- func (dbp *Process) Valid() (bool, error)
- func (dbp *Process) When() (string, error)
- type Regs
- type Thread
- func (thread *Thread) Arch() proc.Arch
- func (thread *Thread) BinInfo() *proc.BinaryInfo
- func (t *Thread) Blocked() bool
- func (th *Thread) Breakpoint() proc.BreakpointState
- func (thread *Thread) ClearBreakpoint(bp *proc.Breakpoint) error
- func (thread *Thread) Common() *proc.CommonThread
- func (thread *Thread) Continue() error
- func (thread *Thread) Location() (*proc.Location, error)
- func (t *Thread) PC() (uint64, 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.SavedRegisters) error
- func (thread *Thread) SetCurrentBreakpoint() error
- func (thread *Thread) SetDX(dx uint64) (err error)
- func (thread *Thread) SetPC(pc uint64) error
- func (thread *Thread) SetSP(sp uint64) (err error)
- func (thread *Thread) StepInstruction() (err error)
- func (t *Thread) Stopped() bool
- func (th *Thread) ThreadID() int
- func (t *Thread) WriteMemory(addr uintptr, data []byte) (written int, err error)
- type WaitStatus
Constants ¶
const ( StatusSleeping = 'S' StatusRunning = 'R' StatusTraceStop = 't' StatusZombie = 'Z' // Kernel 2.6 has TraceStop as T // TODO(derekparker) Since this means something different based on the // version of the kernel ('T' is job control stop on modern 3.x+ kernels) we // may want to differentiate at some point. StatusTraceStopT = 'T' )
Process statuses
Variables ¶
This section is empty.
Functions ¶
func PtraceAttach ¶
PtraceAttach executes the sys.PtraceAttach call.
func PtraceGetRegset ¶
func PtraceGetRegset(tid int) (regset proc.LinuxX86Xstate, err error)
PtraceGetRegset returns floating point registers of the specified thread using PTRACE. See amd64_linux_fetch_inferior_registers in gdb/amd64-linux-nat.c.html and amd64_supply_xsave in gdb/amd64-tdep.c.html and Section 13.1 (and following) of Intel® 64 and IA-32 Architectures Software Developer’s Manual, Volume 1: Basic Architecture
func PtracePeekUser ¶
PtracePeekUser execute ptrace PTRACE_PEEK_USER.
func PtracePokeUser ¶
PtracePokeUser execute ptrace PTRACE_POKE_USER.
func PtraceSingleStep ¶
PtraceSingleStep executes ptrace PTRACE_SINGLE_STEP.
Types ¶
type OSProcessDetails ¶
type OSProcessDetails struct {
// contains filtered or unexported fields
}
OSProcessDetails contains Linux specific process details.
type OSSpecificDetails ¶
type OSSpecificDetails struct {
// contains filtered or unexported fields
}
OSSpecificDetails hold Linux specific process details.
type Process ¶
type Process struct {
// contains filtered or unexported fields
}
Process represents all of the information the debugger is holding onto regarding the process we are debugging.
func Launch ¶
Launch creates and begins debugging a new process. First entry in `cmd` is the program to run, and then rest are the arguments to be supplied to that process. `wd` is working directory of the program.
func New ¶
New returns an initialized Process struct. Before returning, it will also launch a goroutine in order to handle ptrace(2) functions. For more information, see the documentation on `handlePtraceFuncs`.
func (*Process) BinInfo ¶
func (dbp *Process) BinInfo() *proc.BinaryInfo
func (*Process) Breakpoints ¶
func (dbp *Process) Breakpoints() *proc.BreakpointMap
func (*Process) CheckAndClearManualStopRequest ¶
func (*Process) Checkpoints ¶
func (dbp *Process) Checkpoints() ([]proc.Checkpoint, error)
func (*Process) ClearBreakpoint ¶
func (dbp *Process) ClearBreakpoint(addr uint64) (*proc.Breakpoint, error)
ClearBreakpoint clears the breakpoint at addr.
func (*Process) ClearCheckpoint ¶
func (*Process) ClearInternalBreakpoints ¶
func (*Process) Common ¶ added in v1.1.0
func (dbp *Process) Common() *proc.CommonProcess
func (*Process) CurrentThread ¶
func (*Process) FindBreakpoint ¶
func (dbp *Process) FindBreakpoint(pc uint64) (*proc.Breakpoint, bool)
FindBreakpoint finds the breakpoint for the given pc.
func (*Process) LoadInformation ¶
LoadInformation finds the executable and then uses it to parse the following information: * Dwarf .debug_frame section * Dwarf .debug_line section * Go symbol table.
func (*Process) RequestManualStop ¶
RequestManualStop sets the `halt` flag and sends SIGSTOP to all threads.
func (*Process) ResumeNotify ¶
func (dbp *Process) ResumeNotify(ch chan<- struct{})
func (*Process) SelectedGoroutine ¶
func (*Process) SetBreakpoint ¶
func (dbp *Process) SetBreakpoint(addr uint64, kind proc.BreakpointKind, cond ast.Expr) (*proc.Breakpoint, error)
SetBreakpoint sets a breakpoint at addr, and stores it in the process wide break point table.
func (*Process) StepInstruction ¶
StepInstruction will continue the current thread for exactly one instruction. This method affects only the thread associated with the selected goroutine. All other threads will remain stopped.
func (*Process) SwitchGoroutine ¶
SwitchGoroutine changes from current thread to the thread running the specified goroutine.
func (*Process) SwitchThread ¶
SwitchThread changes from current thread to the thread specified by `tid`.
func (*Process) ThreadList ¶
type Regs ¶
type Regs struct {
// contains filtered or unexported fields
}
Regs is a wrapper for sys.PtraceRegs.
func (*Regs) Save ¶ added in v1.1.0
func (r *Regs) Save() proc.SavedRegisters
type Thread ¶
type Thread struct { ID int // Thread ID or mach port Status *WaitStatus // Status returned from last wait call CurrentBreakpoint proc.BreakpointState // Breakpoint thread is currently stopped at // contains filtered or unexported fields }
Thread represents a single thread in the traced process ID represents the thread id or port, Process holds a reference to the Process struct that contains info on the process as a whole, and Status represents the last result of a `wait` call on this thread.
func (*Thread) BinInfo ¶
func (thread *Thread) BinInfo() *proc.BinaryInfo
func (*Thread) Breakpoint ¶
func (th *Thread) Breakpoint() proc.BreakpointState
func (*Thread) ClearBreakpoint ¶
func (thread *Thread) ClearBreakpoint(bp *proc.Breakpoint) error
ClearBreakpoint clears the specified breakpoint.
func (*Thread) Common ¶ added in v1.1.0
func (thread *Thread) Common() *proc.CommonThread
func (*Thread) Continue ¶
Continue the execution of this thread.
If we are currently at a breakpoint, we'll clear it first and then resume execution. Thread will continue until it hits a breakpoint or is signaled.
func (*Thread) Location ¶
Location returns the threads location, including the file:line of the corresponding source code, the function we're in and the current instruction address.
func (*Thread) ReadMemory ¶
func (*Thread) RestoreRegisters ¶ added in v1.1.0
func (t *Thread) RestoreRegisters(savedRegs proc.SavedRegisters) error
func (*Thread) SetCurrentBreakpoint ¶
SetCurrentBreakpoint sets the current breakpoint that this thread is stopped at as CurrentBreakpoint on the thread struct.
func (*Thread) StepInstruction ¶
StepInstruction steps a single instruction.
Executes exactly one instruction and then returns. If the thread is at a breakpoint, we first clear it, execute the instruction, and then replace the breakpoint. Otherwise we simply execute the next instruction.
type WaitStatus ¶
type WaitStatus sys.WaitStatus