Documentation ¶
Index ¶
- Constants
- Variables
- type Core
- type ELFNotesHdr
- type LinuxCoreRegisters
- func (r *LinuxCoreRegisters) BP() uint64
- func (r *LinuxCoreRegisters) CX() uint64
- func (r *LinuxCoreRegisters) GAddr() (uint64, bool)
- func (r *LinuxCoreRegisters) Get(n int) (uint64, error)
- func (r *LinuxCoreRegisters) PC() uint64
- func (r *LinuxCoreRegisters) SP() uint64
- func (r *LinuxCoreRegisters) SetPC(proc.Thread, uint64) error
- func (r *LinuxCoreRegisters) Slice() []proc.Register
- func (r *LinuxCoreRegisters) TLS() uint64
- type LinuxCoreTimeval
- type LinuxNTFile
- type LinuxNTFileEntry
- type LinuxNTFileHdr
- type LinuxPrPsInfo
- type LinuxPrStatus
- type LinuxSiginfo
- type Note
- type OffsetReaderAt
- type Process
- func (p *Process) AllGCache() *[]*proc.G
- func (p *Process) BinInfo() *proc.BinaryInfo
- func (p *Process) Breakpoints() map[uint64]*proc.Breakpoint
- 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) 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) Exited() bool
- func (p *Process) FindThread(threadID int) (proc.Thread, bool)
- func (p *Process) Halt() error
- func (p *Process) Kill() error
- 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) Running() bool
- func (p *Process) SelectedGoroutine() *proc.G
- func (p *Process) SetBreakpoint(addr uint64, kind proc.BreakpointKind, cond ast.Expr) (*proc.Breakpoint, error)
- 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) 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.Breakpoint, bool, error)
- func (t *Thread) Location() (*proc.Location, error)
- func (thread *Thread) ReadMemory(data []byte, addr uintptr) (n int, err error)
- func (t *Thread) Registers(floatingPoint bool) (proc.Registers, error)
- func (t *Thread) StepInstruction() error
- func (t *Thread) ThreadID() int
- func (thread *Thread) WriteMemory(addr uintptr, data []byte) (int, error)
Constants ¶
const NT_FILE elf.NType = 0x46494c45 // "FILE".
Variables ¶
var ErrContinueCore = errors.New("can not continue execution of core process")
var ErrShortRead = errors.New("short read")
var ErrWriteCore = errors.New("can not to core process")
Functions ¶
This section is empty.
Types ¶
type Core ¶
type Core struct { proc.MemoryReader Threads map[int]*LinuxPrStatus Pid int }
type ELFNotesHdr ¶
ELF Notes header. Same size on 64 and 32-bit machines.
type LinuxCoreRegisters ¶
type LinuxCoreRegisters struct { R15 uint64 R14 uint64 R13 uint64 R12 uint64 Rbp uint64 Rbx uint64 R11 uint64 R10 uint64 R9 uint64 R8 uint64 Rax uint64 Rcx uint64 Rdx uint64 Rsi uint64 Rdi uint64 Orig_rax uint64 Rip uint64 Cs uint64 Eflags uint64 Rsp uint64 Ss uint64 Fs_base uint64 Gs_base uint64 Ds uint64 Es uint64 Fs uint64 Gs uint64 }
Copied from golang.org/x/sys/unix.PtraceRegs since it's not available on all systems.
func (*LinuxCoreRegisters) BP ¶
func (r *LinuxCoreRegisters) BP() uint64
func (*LinuxCoreRegisters) CX ¶
func (r *LinuxCoreRegisters) CX() uint64
func (*LinuxCoreRegisters) GAddr ¶
func (r *LinuxCoreRegisters) GAddr() (uint64, bool)
func (*LinuxCoreRegisters) PC ¶
func (r *LinuxCoreRegisters) PC() uint64
func (*LinuxCoreRegisters) SP ¶
func (r *LinuxCoreRegisters) SP() uint64
func (*LinuxCoreRegisters) Slice ¶
func (r *LinuxCoreRegisters) Slice() []proc.Register
func (*LinuxCoreRegisters) TLS ¶
func (r *LinuxCoreRegisters) TLS() uint64
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 }
type LinuxNTFileEntry ¶
type LinuxNTFileHdr ¶
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 }
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 LinuxCoreRegisters Fpvalid int32 // contains filtered or unexported fields }
type LinuxSiginfo ¶
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 (Not implemented): 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)
type Process ¶
type Process struct {
// contains filtered or unexported fields
}
func (*Process) BinInfo ¶
func (p *Process) BinInfo() *proc.BinaryInfo
func (*Process) Breakpoints ¶
func (p *Process) Breakpoints() map[uint64]*proc.Breakpoint
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 (*Process) ClearInternalBreakpoints ¶
func (*Process) CurrentThread ¶
func (*Process) RequestManualStop ¶
func (*Process) SelectedGoroutine ¶
func (*Process) SetBreakpoint ¶
func (p *Process) SetBreakpoint(addr uint64, kind proc.BreakpointKind, cond ast.Expr) (*proc.Breakpoint, error)
func (*Process) StepInstruction ¶
func (*Process) SwitchGoroutine ¶
func (*Process) SwitchThread ¶
func (*Process) ThreadList ¶
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
}
func (*Thread) BinInfo ¶
func (t *Thread) BinInfo() *proc.BinaryInfo
func (*Thread) Breakpoint ¶
func (t *Thread) Breakpoint() (*proc.Breakpoint, bool, error)