Documentation ¶
Index ¶
- Constants
- func Attach(pid int, debugInfoDirs []string) (*proc.Target, error)
- func Launch(cmd []string, wd string, foreground bool, debugInfoDirs []string) (*proc.Target, error)
- func PtraceAttach(pid int) error
- func PtraceCont(tid, sig int) error
- func PtraceDetach(tid, sig int) error
- func PtraceGetRegset(tid int) (regset linutil.AMD64Xstate, 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) 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) EntryPoint() (uint64, error)
- func (dbp *Process) FindBreakpoint(pc uint64, adjustPC bool) (*proc.Breakpoint, bool)
- func (dbp *Process) FindThread(threadID int) (proc.Thread, bool)
- 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) SetSelectedGoroutine(g *proc.G)
- func (dbp *Process) SwitchGoroutine(g *proc.G) 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 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) ClearBreakpoint(bp *proc.Breakpoint) error
- func (t *Thread) Common() *proc.CommonThread
- func (t *Thread) Continue() error
- func (t *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.Registers) error
- func (t *Thread) SetCurrentBreakpoint(adjustPC bool) 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 (t *Thread) StepInstruction() (err error)
- func (t *Thread) Stopped() bool
- func (t *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 Attach ¶
Attach to an existing process with the given PID. Once attached, if the DWARF information cannot be found in the binary, Delve will look for external debug files in the directories passed in.
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. If the DWARF information cannot be found in the binary, Delve will look for external debug files in the directories passed in.
func PtraceAttach ¶
PtraceAttach executes the sys.PtraceAttach call.
func PtraceGetRegset ¶
func PtraceGetRegset(tid int) (regset linutil.AMD64Xstate, 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 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
BinInfo will return the binary info struct associated with this process.
func (*Process) Breakpoints ¶
func (dbp *Process) Breakpoints() *proc.BreakpointMap
Breakpoints returns a list of breakpoints currently set.
func (*Process) CheckAndClearManualStopRequest ¶
CheckAndClearManualStopRequest checks if a manual stop has been requested, and then clears that state.
func (*Process) Checkpoint ¶
Checkpoint will always return an error on the native proc backend, only supported for recorded traces.
func (*Process) Checkpoints ¶
func (dbp *Process) Checkpoints() ([]proc.Checkpoint, error)
Checkpoints will always return an error on the native proc backend, only supported for recorded traces.
func (*Process) ClearBreakpoint ¶
func (dbp *Process) ClearBreakpoint(addr uint64) (*proc.Breakpoint, error)
ClearBreakpoint clears the breakpoint at addr.
func (*Process) ClearCheckpoint ¶
ClearCheckpoint will always return an error on the native proc backend, only supported in recorded traces.
func (*Process) ClearInternalBreakpoints ¶
ClearInternalBreakpoints will clear all non-user set breakpoints. These breakpoints are set for internal operations such as 'next'.
func (*Process) ContinueOnce ¶
ContinueOnce will continue the target until it stops. This could be the result of a breakpoint or signal.
func (*Process) CurrentThread ¶
CurrentThread returns the current selected, active thread.
func (*Process) Direction ¶
Direction will always return an error in the native proc backend, only for recorded traces.
func (*Process) EntryPoint ¶ added in v1.2.0
EntryPoint will return the process entry point address, useful for debugging PIEs.
func (*Process) FindBreakpoint ¶
FindBreakpoint finds the breakpoint for the given pc.
func (*Process) FindThread ¶
FindThread attempts to find the thread with the specified ID.
func (*Process) RequestManualStop ¶
RequestManualStop sets the `halt` flag and sends SIGSTOP to all threads.
func (*Process) Restart ¶
Restart will always return an error in the native proc backend, only for recorded traces.
func (*Process) ResumeNotify ¶
func (dbp *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 selected, active goroutine.
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) 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) 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 ¶
ThreadList returns a list of threads in the process.
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 (t *Thread) BinInfo() *proc.BinaryInfo
BinInfo returns information on the binary.
func (*Thread) Breakpoint ¶
func (t *Thread) Breakpoint() *proc.BreakpointState
Breakpoint returns the current breakpoint that is active on this thread.
func (*Thread) ClearBreakpoint ¶
func (t *Thread) ClearBreakpoint(bp *proc.Breakpoint) error
ClearBreakpoint clears the specified breakpoint.
func (*Thread) Common ¶ added in v1.1.0
func (t *Thread) Common() *proc.CommonThread
Common returns information common across Process implementations.
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
RestoreRegisters will set the value of the CPU registers to those passed in via 'savedRegs'.
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