Documentation
¶
Index ¶
- Constants
- Variables
- type ELFNotesHdr
- type LinuxCoreTimeval
- type LinuxNTFile
- type LinuxNTFileEntry
- type LinuxNTFileHdr
- type LinuxPrPsInfo
- type LinuxPrStatus
- type LinuxSiginfo
- type Note
- type OffsetReaderAt
- type Process
- func (p *Process) BinInfo() *proc.BinaryInfo
- func (p *Process) Breakpoints() *proc.BreakpointMap
- func (p *Process) CheckAndClearManualStopRequest() bool
- func (p *Process) Checkpoint(string) (int, error)
- func (p *Process) Checkpoints() ([]proc.Checkpoint, error)
- func (p *Process) ClearBreakpoint(addr uint64) (*proc.Breakpoint, error)
- func (p *Process) ClearCheckpoint(int) error
- func (p *Process) ClearInternalBreakpoints() error
- func (p *Process) Common() *proc.CommonProcess
- func (p *Process) ContinueOnce() (proc.Thread, error)
- func (p *Process) CurrentThread() proc.Thread
- func (p *Process) Detach(bool) error
- func (p *Process) Direction(proc.Direction) error
- func (p *Process) EntryPoint() (uint64, error)
- func (p *Process) FindThread(threadID int) (proc.Thread, bool)
- func (p *Process) Pid() int
- func (p *Process) Recorded() (bool, string)
- func (p *Process) RequestManualStop() error
- func (p *Process) Restart(string) error
- func (p *Process) ResumeNotify(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 SplicedMemory
- 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(proc.Registers) error
- func (t *Thread) SetCurrentBreakpoint(adjustPC bool) error
- func (t *Thread) SetDX(uint64) error
- func (t *Thread) SetPC(uint64) error
- func (t *Thread) SetSP(uint64) error
- func (t *Thread) StepInstruction() error
- func (t *Thread) ThreadID() int
- func (t *Thread) WriteMemory(addr uintptr, data []byte) (int, error)
Constants ¶
const NT_AUXV elf.NType = 0x6
NT_AUXV is the note type for notes containing a copy of the Auxv array
const NT_FILE elf.NType = 0x46494c45 // "FILE".
NT_FILE is file mapping information, e.g. program text mappings. Desc is a LinuxNTFile.
const NT_X86_XSTATE elf.NType = 0x202 // Note type for notes containing X86 XSAVE area.
NT_X86_XSTATE is other registers, including AVX and such.
Variables ¶
var ( // ErrWriteCore is returned when attempting to write to the core // process memory. ErrWriteCore = errors.New("can not write to core process") // ErrShortRead is returned on a short read. ErrShortRead = errors.New("short read") // ErrContinueCore is returned when trying to continue execution of a core process. ErrContinueCore = errors.New("can not continue execution of core process") // ErrChangeRegisterCore is returned when trying to change register values for core files. ErrChangeRegisterCore = errors.New("can not change register values of core process") )
var ErrUnrecognizedFormat = errors.New("unrecognized core format")
ErrUnrecognizedFormat is returned when the core file is not recognized as any of the supported formats.
Functions ¶
This section is empty.
Types ¶
type ELFNotesHdr ¶
ELFNotesHdr is the ELF Notes header. Same size on 64 and 32-bit machines.
type LinuxCoreTimeval ¶
Copied from golang.org/x/sys/unix.Timeval since it's not available on all systems.
type LinuxNTFile ¶
type LinuxNTFile struct {
LinuxNTFileHdr
// contains filtered or unexported fields
}
LinuxNTFile contains information on mapped files.
type LinuxNTFileEntry ¶
LinuxNTFileEntry is an entry of an NT_FILE note.
type LinuxNTFileHdr ¶
LinuxNTFileHdr is a header struct for NTFile.
type LinuxPrPsInfo ¶
type LinuxPrPsInfo struct {
State uint8
Sname int8
Zomb uint8
Nice int8
Flag uint64
Uid, Gid uint32
Pid, Ppid, Pgrp, Sid int32
Fname [16]uint8
Args [80]uint8
// contains filtered or unexported fields
}
LinuxPrPsInfo has various structures from the ELF spec and the Linux kernel. AMD64 specific primarily because of unix.PtraceRegs, but also because some of the fields are word sized. See http://lxr.free-electrons.com/source/include/uapi/linux/elfcore.h
type LinuxPrStatus ¶
type LinuxPrStatus struct {
Siginfo LinuxSiginfo
Cursig uint16
Sigpend uint64
Sighold uint64
Pid, Ppid, Pgrp, Sid int32
Utime, Stime, CUtime, CStime LinuxCoreTimeval
Reg linutil.AMD64PtraceRegs
Fpvalid int32
// contains filtered or unexported fields
}
LinuxPrStatus is a copy of the prstatus kernel struct.
type LinuxSiginfo ¶
LinuxSiginfo is a copy of the siginfo kernel struct.
type Note ¶
Note is a note from the PT_NOTE prog. Relevant types: - NT_FILE: File mapping information, e.g. program text mappings. Desc is a LinuxNTFile. - NT_PRPSINFO: Information about a process, including PID and signal. Desc is a LinuxPrPsInfo. - NT_PRSTATUS: Information about a thread, including base registers, state, etc. Desc is a LinuxPrStatus. - NT_FPREGSET (Not implemented): x87 floating point registers. - NT_X86_XSTATE: Other registers, including AVX and such.
type OffsetReaderAt ¶
type OffsetReaderAt struct {
// contains filtered or unexported fields
}
OffsetReaderAt wraps a ReaderAt into a MemoryReader, subtracting a fixed offset from the address. This is useful to represent a mapping in an address space. For example, if program text is mapped in at 0x400000, an OffsetReaderAt with offset 0x400000 can be wrapped around file.Open(program) to return the results of a read in that part of the address space.
func (*OffsetReaderAt) ReadMemory ¶
func (r *OffsetReaderAt) ReadMemory(buf []byte, addr uintptr) (n int, err error)
ReadMemory will read the memory at addr-offset.
type Process ¶
Process represents a core file.
func OpenCore ¶
OpenCore will open the core file and return a Process struct. If the DWARF information cannot be found in the binary, Delve will look for external debug files in the directories passed in.
func (*Process) BinInfo ¶
func (p *Process) BinInfo() *proc.BinaryInfo
BinInfo will return the binary info.
func (*Process) Breakpoints ¶
func (p *Process) Breakpoints() *proc.BreakpointMap
Breakpoints will return all breakpoints for the process.
func (*Process) CheckAndClearManualStopRequest ¶
CheckAndClearManualStopRequest will always return false and have no effect since there are no manual stop requests as there is no controlling execution of a core file.
func (*Process) Checkpoint ¶
Checkpoint for core files returns an error, there is no execution of a core file.
func (*Process) Checkpoints ¶
func (p *Process) Checkpoints() ([]proc.Checkpoint, error)
Checkpoints returns nil on core files, you cannot set checkpoints when debugging core files.
func (*Process) ClearBreakpoint ¶
func (p *Process) ClearBreakpoint(addr uint64) (*proc.Breakpoint, error)
ClearBreakpoint will always return an error as you cannot set or clear breakpoints on core files.
func (*Process) ClearCheckpoint ¶
ClearCheckpoint clears a checkpoint, but will only return an error for core files.
func (*Process) ClearInternalBreakpoints ¶
ClearInternalBreakpoints will always return nil and have no effect since you cannot set breakpoints on core files.
func (*Process) Common ¶ added in v1.1.0
func (p *Process) Common() *proc.CommonProcess
Common returns common information across Process implementations.
func (*Process) ContinueOnce ¶
ContinueOnce will always return an error because you cannot control execution of a core file.
func (*Process) CurrentThread ¶
CurrentThread returns the current active thread.
func (*Process) Detach ¶
Detach will always return nil and have no effect as you cannot detach from a core file and have it continue execution or exit.
func (*Process) Direction ¶
Direction will only return an error as you cannot continue a core process.
func (*Process) EntryPoint ¶ added in v1.2.0
EntryPoint will return the entry point address for this core file.
func (*Process) FindThread ¶
FindThread will return the thread with the corresponding thread ID.
func (*Process) Recorded ¶
Recorded returns whether this is a live or recorded process. Always returns true for core files.
func (*Process) RequestManualStop ¶
RequestManualStop will return nil and have no effect as you cannot control execution of a core file.
func (*Process) Restart ¶
Restart will only return an error for core files, as they are not executing.
func (*Process) ResumeNotify ¶
func (p *Process) ResumeNotify(chan<- struct{})
ResumeNotify is a no-op on core files as we cannot control execution.
func (*Process) SelectedGoroutine ¶
SelectedGoroutine returns the current active and selected goroutine.
func (*Process) SetBreakpoint ¶
func (p *Process) SetBreakpoint(addr uint64, kind proc.BreakpointKind, cond ast.Expr) (*proc.Breakpoint, error)
SetBreakpoint will always return an error for core files as you cannot write memory or control execution.
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 always return an error as you cannot control execution of a core file.
func (*Process) SwitchGoroutine ¶
SwitchGoroutine will change the selected and active goroutine.
func (*Process) SwitchThread ¶
SwitchThread will change the selected and active thread.
func (*Process) ThreadList ¶
ThreadList will return a list of all threads currently in the process.
type SplicedMemory ¶
type SplicedMemory struct {
// contains filtered or unexported fields
}
A SplicedMemory represents a memory space formed from multiple regions, each of which may override previously regions. For example, in the following core, the program text was loaded at 0x400000: Start End Page Offset 0x0000000000400000 0x000000000044f000 0x0000000000000000 but then it's partially overwritten with an RW mapping whose data is stored in the core file: Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000004000 0x000000000049a000 0x0000000000000000
0x0000000000002000 0x0000000000002000 RW 1000
This can be represented in a SplicedMemory by adding the original region, then putting the RW mapping on top of it.
func (*SplicedMemory) Add ¶
func (r *SplicedMemory) Add(reader proc.MemoryReader, off, length uintptr)
Add adds a new region to the SplicedMemory, which may override existing regions.
func (*SplicedMemory) ReadMemory ¶
func (r *SplicedMemory) ReadMemory(buf []byte, addr uintptr) (n int, err error)
ReadMemory implements MemoryReader.ReadMemory.
type Thread ¶
type Thread struct {
// contains filtered or unexported fields
}
Thread represents a thread in the core file being debugged.
func (*Thread) BinInfo ¶
func (t *Thread) BinInfo() *proc.BinaryInfo
BinInfo returns information about the binary.
func (*Thread) Breakpoint ¶
func (t *Thread) Breakpoint() proc.BreakpointState
Breakpoint returns the current breakpoint this thread is stopped at. For core files this always returns an empty BreakpointState struct, as there are no breakpoints when debugging core files.
func (*Thread) Common ¶ added in v1.1.0
func (t *Thread) Common() *proc.CommonThread
Common returns a struct containing common information across thread implementations.
func (*Thread) Location ¶
Location returns the location of this thread based on the value of the instruction pointer register.
func (*Thread) ReadMemory ¶
ReadMemory will return memory from the core file at the specified location and put the read memory into `data`, returning the length read, and returning an error if the length read is shorter than the length of the `data` buffer.
func (*Thread) RestoreRegisters ¶ added in v1.1.0
RestoreRegisters will only return an error for core files, you cannot change register values for core files.
func (*Thread) SetCurrentBreakpoint ¶
SetCurrentBreakpoint will always just return nil for core files, as there are no breakpoints in core files.
func (*Thread) SetDX ¶ added in v1.1.0
SetDX will always return an error, you cannot change register values when debugging core files.
func (*Thread) SetPC ¶ added in v1.1.0
SetPC will always return an error, you cannot change register values when debugging core files.
func (*Thread) SetSP ¶ added in v1.1.0
SetSP will always return an error, you cannot change register values when debugging core files.
func (*Thread) StepInstruction ¶
StepInstruction will only return an error for core files, you cannot execute a core file.