Documentation
¶
Overview ¶
Package linutil contains functions and data structures used by both the linux implementation of the native backend and the core backend to deal with structures used by the linux kernel.
Index ¶
- Variables
- func ElfUpdateSharedObjects(p proc.Process) error
- func EntryPointFromAuxv(auxv []byte, ptrSize int) uint64
- type AMD64PtraceRegs
- type AMD64Registers
- func (r *AMD64Registers) BP() uint64
- func (r *AMD64Registers) Copy() (proc.Registers, error)
- func (r *AMD64Registers) GAddr() (uint64, bool)
- func (r *AMD64Registers) LR() uint64
- func (r *AMD64Registers) PC() uint64
- func (r *AMD64Registers) SP() uint64
- func (r *AMD64Registers) SetReg(regNum uint64, reg *op.DwarfRegister) (bool, error)
- func (r *AMD64Registers) Slice(floatingPoint bool) ([]proc.Register, error)
- func (r *AMD64Registers) TLS() uint64
- type ARM64PtraceFpRegs
- type ARM64PtraceRegs
- type ARM64Registers
- func (r *ARM64Registers) BP() uint64
- func (r *ARM64Registers) Copy() (proc.Registers, error)
- func (r *ARM64Registers) GAddr() (uint64, bool)
- func (r *ARM64Registers) LR() uint64
- func (r *ARM64Registers) PC() uint64
- func (r *ARM64Registers) SP() uint64
- func (r *ARM64Registers) SetReg(regNum uint64, reg *op.DwarfRegister) (fpchanged bool, err error)
- func (r *ARM64Registers) Slice(floatingPoint bool) ([]proc.Register, error)
- func (r *ARM64Registers) TLS() uint64
- type I386PtraceRegs
- type I386Registers
- func (r *I386Registers) BP() uint64
- func (r *I386Registers) CX() uint64
- func (r *I386Registers) Copy() (proc.Registers, error)
- func (r *I386Registers) GAddr() (uint64, bool)
- func (r *I386Registers) LR() uint64
- func (r *I386Registers) PC() uint64
- func (r *I386Registers) SP() uint64
- func (r *I386Registers) Slice(floatingPoint bool) ([]proc.Register, error)
- func (r *I386Registers) TLS() uint64
- type LOONG64PtraceFpRegs
- type LOONG64PtraceRegs
- type LOONG64Registers
- func (r *LOONG64Registers) BP() uint64
- func (r *LOONG64Registers) Copy() (proc.Registers, error)
- func (r *LOONG64Registers) GAddr() (uint64, bool)
- func (r *LOONG64Registers) LR() uint64
- func (r *LOONG64Registers) PC() uint64
- func (r *LOONG64Registers) SP() uint64
- func (r *LOONG64Registers) SetReg(regNum uint64, reg *op.DwarfRegister) (fpchanged bool, err error)
- func (r *LOONG64Registers) Slice(floatingPoint bool) ([]proc.Register, error)
- func (r *LOONG64Registers) TLS() uint64
- type PPC64LEPtraceFpRegs
- type PPC64LEPtraceRegs
- type PPC64LERegisters
- func (r *PPC64LERegisters) BP() uint64
- func (r *PPC64LERegisters) Copy() (proc.Registers, error)
- func (r *PPC64LERegisters) GAddr() (uint64, bool)
- func (r *PPC64LERegisters) LR() uint64
- func (r *PPC64LERegisters) PC() uint64
- func (r *PPC64LERegisters) SP() uint64
- func (r *PPC64LERegisters) SetReg(regNum uint64, reg *op.DwarfRegister) (fpchanged bool, err error)
- func (r *PPC64LERegisters) Slice(floatingPoint bool) ([]proc.Register, error)
- func (r *PPC64LERegisters) TLS() uint64
- type RISCV64PtraceFpRegs
- type RISCV64PtraceRegs
- type RISCV64Registers
- func (r *RISCV64Registers) BP() uint64
- func (r *RISCV64Registers) Copy() (proc.Registers, error)
- func (r *RISCV64Registers) GAddr() (uint64, bool)
- func (r *RISCV64Registers) GetReg(regNum uint64) (uint64, error)
- func (r *RISCV64Registers) LR() uint64
- func (r *RISCV64Registers) PC() uint64
- func (r *RISCV64Registers) SP() uint64
- func (r *RISCV64Registers) SetReg(regNum uint64, reg *op.DwarfRegister) (fpchanged bool, err error)
- func (r *RISCV64Registers) Slice(floatingPoint bool) ([]proc.Register, error)
- func (r *RISCV64Registers) TLS() uint64
Constants ¶
This section is empty.
Variables ¶
var ErrTooManyLibraries = errors.New("number of loaded libraries exceeds maximum")
Functions ¶
func ElfUpdateSharedObjects ¶ added in v1.3.0
ElfUpdateSharedObjects reads the list of dynamic libraries loaded by the dynamic linker from the .dynamic section and uses it to update p.BinInfo(). See the SysV ABI for a description of how the .dynamic section works: https://www.sco.com/developers/gabi/latest/contents.html
func EntryPointFromAuxv ¶ added in v1.4.1
EntryPointFromAuxv searches the elf auxiliary vector for the entry point address. For a description of the auxiliary vector (auxv) format see: System V Application Binary Interface, AMD64 Architecture Processor Supplement, section 3.4.3. System V Application Binary Interface, Intel386 Architecture Processor Supplement (fourth edition), section 3-28.
Types ¶
type AMD64PtraceRegs ¶
type AMD64PtraceRegs 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
}
AMD64PtraceRegs is the struct used by the linux kernel to return the general purpose registers for AMD64 CPUs.
type AMD64Registers ¶
type AMD64Registers struct {
Regs *AMD64PtraceRegs
Fpregs []proc.Register
Fpregset *amd64util.AMD64Xstate
// contains filtered or unexported fields
}
AMD64Registers implements the proc.Registers interface for the native/linux backend and core/linux backends, on AMD64.
func NewAMD64Registers ¶ added in v1.4.1
func NewAMD64Registers(regs *AMD64PtraceRegs, loadFpRegs func(*AMD64Registers) error) *AMD64Registers
func (*AMD64Registers) BP ¶
func (r *AMD64Registers) BP() uint64
func (*AMD64Registers) Copy ¶
func (r *AMD64Registers) Copy() (proc.Registers, error)
Copy returns a copy of these registers that is guaranteed not to change.
func (*AMD64Registers) GAddr ¶
func (r *AMD64Registers) GAddr() (uint64, bool)
GAddr returns the address of the G variable if it is known, 0 and false otherwise.
func (*AMD64Registers) LR ¶ added in v1.9.0
func (r *AMD64Registers) LR() uint64
LR returns the link register.
func (*AMD64Registers) PC ¶
func (r *AMD64Registers) PC() uint64
PC returns the value of RIP register.
func (*AMD64Registers) SP ¶
func (r *AMD64Registers) SP() uint64
SP returns the value of RSP register.
func (*AMD64Registers) SetReg ¶ added in v1.6.1
func (r *AMD64Registers) SetReg(regNum uint64, reg *op.DwarfRegister) (bool, error)
func (*AMD64Registers) Slice ¶
func (r *AMD64Registers) Slice(floatingPoint bool) ([]proc.Register, error)
Slice returns the registers as a list of (name, value) pairs.
func (*AMD64Registers) TLS ¶
func (r *AMD64Registers) TLS() uint64
TLS returns the address of the thread local storage memory segment.
type ARM64PtraceFpRegs ¶ added in v1.4.1
func (*ARM64PtraceFpRegs) Byte ¶ added in v1.4.1
func (fpregs *ARM64PtraceFpRegs) Byte() []byte
func (*ARM64PtraceFpRegs) Decode ¶ added in v1.4.1
func (fpregs *ARM64PtraceFpRegs) Decode() (regs []proc.Register)
type ARM64PtraceRegs ¶ added in v1.4.0
ARM64PtraceRegs is the struct used by the linux kernel to return the general purpose registers for ARM64 CPUs. copy from sys/unix/ztypes_linux_arm64.go:735
type ARM64Registers ¶ added in v1.4.0
type ARM64Registers struct {
Regs *ARM64PtraceRegs // general-purpose registers
Fpregs []proc.Register // Formatted floating point registers
Fpregset []byte // holding all floating point register values
// contains filtered or unexported fields
}
ARM64Registers is a wrapper for sys.PtraceRegs.
func NewARM64Registers ¶ added in v1.4.1
func NewARM64Registers(regs *ARM64PtraceRegs, iscgo bool, tpidr_el0 uint64, loadFpRegs func(*ARM64Registers) error) *ARM64Registers
func (*ARM64Registers) BP ¶ added in v1.4.0
func (r *ARM64Registers) BP() uint64
func (*ARM64Registers) Copy ¶ added in v1.4.0
func (r *ARM64Registers) Copy() (proc.Registers, error)
Copy returns a copy of these registers that is guaranteed not to change.
func (*ARM64Registers) GAddr ¶ added in v1.4.0
func (r *ARM64Registers) GAddr() (uint64, bool)
GAddr returns the address of the G variable if it is known, 0 and false otherwise.
func (*ARM64Registers) LR ¶ added in v1.9.0
func (r *ARM64Registers) LR() uint64
LR returns the link register.
func (*ARM64Registers) PC ¶ added in v1.4.0
func (r *ARM64Registers) PC() uint64
PC returns the value of RIP register.
func (*ARM64Registers) SP ¶ added in v1.4.0
func (r *ARM64Registers) SP() uint64
SP returns the value of RSP register.
func (*ARM64Registers) SetReg ¶ added in v1.9.0
func (r *ARM64Registers) SetReg(regNum uint64, reg *op.DwarfRegister) (fpchanged bool, err error)
func (*ARM64Registers) Slice ¶ added in v1.4.0
func (r *ARM64Registers) Slice(floatingPoint bool) ([]proc.Register, error)
Slice returns the registers as a list of (name, value) pairs.
func (*ARM64Registers) TLS ¶ added in v1.4.0
func (r *ARM64Registers) TLS() uint64
TLS returns the address of the thread local storage memory segment.
type I386PtraceRegs ¶ added in v1.4.1
type I386PtraceRegs struct {
Ebx int32
Ecx int32
Edx int32
Esi int32
Edi int32
Ebp int32
Eax int32
Xds int32
Xes int32
Xfs int32
Xgs int32
Orig_eax int32
Eip int32
Xcs int32
Eflags int32
Esp int32
Xss int32
}
I386PtraceRegs is the struct used by the linux kernel to return the general purpose registers for I386 CPUs.
type I386Registers ¶ added in v1.4.1
type I386Registers struct {
Regs *I386PtraceRegs
Fpregs []proc.Register
Fpregset *amd64util.AMD64Xstate
Tls uint64
// contains filtered or unexported fields
}
I386Registers implements the proc.Registers interface for the native/linux backend and core/linux backends, on I386.
func NewI386Registers ¶ added in v1.4.1
func NewI386Registers(regs *I386PtraceRegs, loadFpRegs func(*I386Registers) error) *I386Registers
func (*I386Registers) BP ¶ added in v1.4.1
func (r *I386Registers) BP() uint64
func (*I386Registers) CX ¶ added in v1.4.1
func (r *I386Registers) CX() uint64
CX returns the value of ECX register.
func (*I386Registers) Copy ¶ added in v1.4.1
func (r *I386Registers) Copy() (proc.Registers, error)
Copy returns a copy of these registers that is guaranteed not to change.
func (*I386Registers) GAddr ¶ added in v1.4.1
func (r *I386Registers) GAddr() (uint64, bool)
GAddr returns the address of the G variable if it is known, 0 and false otherwise.
func (*I386Registers) LR ¶ added in v1.9.0
func (r *I386Registers) LR() uint64
LR returns the link register.
func (*I386Registers) PC ¶ added in v1.4.1
func (r *I386Registers) PC() uint64
PC returns the value of EIP register.
func (*I386Registers) SP ¶ added in v1.4.1
func (r *I386Registers) SP() uint64
SP returns the value of ESP register.
func (*I386Registers) Slice ¶ added in v1.4.1
func (r *I386Registers) Slice(floatingPoint bool) ([]proc.Register, error)
Slice returns the registers as a list of (name, value) pairs.
func (*I386Registers) TLS ¶ added in v1.4.1
func (r *I386Registers) TLS() uint64
TLS returns the address of the thread local storage memory segment.
type LOONG64PtraceFpRegs ¶ added in v1.24.1
LOONG64PtraceFpRegs refers to the definition of struct user_fp_state in kernel ptrace.h
func (*LOONG64PtraceFpRegs) Byte ¶ added in v1.24.1
func (fpregs *LOONG64PtraceFpRegs) Byte() []byte
func (*LOONG64PtraceFpRegs) Decode ¶ added in v1.24.1
func (fpregs *LOONG64PtraceFpRegs) Decode() (regs []proc.Register)
type LOONG64PtraceRegs ¶ added in v1.24.1
type LOONG64PtraceRegs struct {
Regs [32]uint64
Orig_a0 uint64
Era uint64
Badv uint64
Reserved [10]uint64
}
LOONG64PtraceRegs is the struct used by the linux kernel to return the GPR for LoongArch64 CPUs. refer to sys/unix/ztype_linux_loong64.go
type LOONG64Registers ¶ added in v1.24.1
type LOONG64Registers struct {
Regs *LOONG64PtraceRegs // general-purpose registers
Fpregs []proc.Register // Formatted floating point registers
Fpregset []byte // holding all floating point register values
// contains filtered or unexported fields
}
LOONG64Registers is a wrapper for sys.PtraceRegs.
func NewLOONG64Registers ¶ added in v1.24.1
func NewLOONG64Registers(regs *LOONG64PtraceRegs, iscgo bool, tp_tls uint64, loadFpRegs func(*LOONG64Registers) error) *LOONG64Registers
func (*LOONG64Registers) BP ¶ added in v1.24.1
func (r *LOONG64Registers) BP() uint64
BP returns the value of FP register
func (*LOONG64Registers) Copy ¶ added in v1.24.1
func (r *LOONG64Registers) Copy() (proc.Registers, error)
Copy returns a copy of these registers that is guaranteed not to change.
func (*LOONG64Registers) GAddr ¶ added in v1.24.1
func (r *LOONG64Registers) GAddr() (uint64, bool)
GAddr returns the address of the G variable if it is known, 0 and false otherwise.
func (*LOONG64Registers) LR ¶ added in v1.24.1
func (r *LOONG64Registers) LR() uint64
LR returns the link register.
func (*LOONG64Registers) PC ¶ added in v1.24.1
func (r *LOONG64Registers) PC() uint64
PC returns the value of PC register.
func (*LOONG64Registers) SP ¶ added in v1.24.1
func (r *LOONG64Registers) SP() uint64
SP returns the value of SP register.
func (*LOONG64Registers) SetReg ¶ added in v1.24.1
func (r *LOONG64Registers) SetReg(regNum uint64, reg *op.DwarfRegister) (fpchanged bool, err error)
func (*LOONG64Registers) Slice ¶ added in v1.24.1
func (r *LOONG64Registers) Slice(floatingPoint bool) ([]proc.Register, error)
Slice returns the registers as a list of (name, value) pairs.
func (*LOONG64Registers) TLS ¶ added in v1.24.1
func (r *LOONG64Registers) TLS() uint64
TLS returns the address of the thread local storage memory segment.
type PPC64LEPtraceFpRegs ¶ added in v1.21.1
type PPC64LEPtraceFpRegs struct {
Fp []byte
}
func (*PPC64LEPtraceFpRegs) Decode ¶ added in v1.21.1
func (fpregs *PPC64LEPtraceFpRegs) Decode() (regs []proc.Register)
type PPC64LEPtraceRegs ¶ added in v1.21.1
type PPC64LEPtraceRegs struct {
Gpr [32]uint64 // 32 general-purpose registers, each 64 bits wide
Nip uint64
Msr uint64
Orig_gpr3 uint64
Ctr uint64
Link uint64 // Link register -- LLDB dwarf_lr_ppc64le = 65
Xer uint64 // Fixed point exception register -- LLDB dwarf_xer_ppc64le = 76
Ccr uint64
Softe uint64
Trap uint64
Dar uint64
Dsisr uint64
Result uint64
}
PPC64LEPtraceRegs is the struct used by the linux kernel to return the general purpose registers for PPC64LE CPUs. Copied from src/syscall/ztypes_linux_ppc64le.go#L518-L532
type PPC64LERegisters ¶ added in v1.21.1
type PPC64LERegisters struct {
Regs *PPC64LEPtraceRegs
Fpregs []proc.Register //Formatted floating point registers
Fpregset []byte //holding all floating point register values
// contains filtered or unexported fields
}
PPC64LERegisters implements the proc.Registers interface for the native/linux backend and core/linux backends, on PPC64LE.
func NewPPC64LERegisters ¶ added in v1.21.1
func NewPPC64LERegisters(regs *PPC64LEPtraceRegs, loadFpRegs func(*PPC64LERegisters) error) *PPC64LERegisters
func (*PPC64LERegisters) BP ¶ added in v1.21.1
func (r *PPC64LERegisters) BP() uint64
func (*PPC64LERegisters) Copy ¶ added in v1.21.1
func (r *PPC64LERegisters) Copy() (proc.Registers, error)
Copy returns a copy of these registers that is guaranteed not to change.
func (*PPC64LERegisters) GAddr ¶ added in v1.21.1
func (r *PPC64LERegisters) GAddr() (uint64, bool)
GAddr returns the address of the G variable
func (*PPC64LERegisters) LR ¶ added in v1.21.1
func (r *PPC64LERegisters) LR() uint64
LR The Link Register is a 64-bit register. It can be used to provide the branch target address for the Branch Conditional to Link Register instruction, and it holds the return address after Branch instructions for which LK=1 and after System Call Vectored instructions. Extracted from the 2.3.2 section of the PowerISA Book 3.1
func (*PPC64LERegisters) PC ¶ added in v1.21.1
func (r *PPC64LERegisters) PC() uint64
PC returns the value of the NIP register Also called the IAR/Instruction Address Register or NIP/Next Instruction Pointer
func (*PPC64LERegisters) SP ¶ added in v1.21.1
func (r *PPC64LERegisters) SP() uint64
SP returns the value of Stack frame pointer stored in Gpr[1].
func (*PPC64LERegisters) SetReg ¶ added in v1.21.1
func (r *PPC64LERegisters) SetReg(regNum uint64, reg *op.DwarfRegister) (fpchanged bool, err error)
func (*PPC64LERegisters) Slice ¶ added in v1.21.1
func (r *PPC64LERegisters) Slice(floatingPoint bool) ([]proc.Register, error)
Slice returns the registers as a list of (name, value) pairs.
func (*PPC64LERegisters) TLS ¶ added in v1.21.1
func (r *PPC64LERegisters) TLS() uint64
TLS returns the value of the thread pointer stored in Gpr[13]
type RISCV64PtraceFpRegs ¶ added in v1.24.0
RISCV64PtraceFpRegs is refer to the definition of struct __riscv_d_ext_state in the kernel ptrace.h
func (*RISCV64PtraceFpRegs) Byte ¶ added in v1.24.0
func (fpregs *RISCV64PtraceFpRegs) Byte() []byte
func (*RISCV64PtraceFpRegs) Decode ¶ added in v1.24.0
func (fpregs *RISCV64PtraceFpRegs) Decode() (regs []proc.Register)
type RISCV64PtraceRegs ¶ added in v1.24.0
type RISCV64PtraceRegs struct {
Pc uint64
Ra uint64
Sp uint64
Gp uint64
Tp uint64
T0 uint64
T1 uint64
T2 uint64
S0 uint64
S1 uint64
A0 uint64
A1 uint64
A2 uint64
A3 uint64
A4 uint64
A5 uint64
A6 uint64
A7 uint64
S2 uint64
S3 uint64
S4 uint64
S5 uint64
S6 uint64
S7 uint64
S8 uint64
S9 uint64
S10 uint64
S11 uint64
T3 uint64
T4 uint64
T5 uint64
T6 uint64
}
RISCV64PtraceRegs is the struct used by the linux kernel to return the general purpose registers for RISC-V CPUs.
type RISCV64Registers ¶ added in v1.24.0
type RISCV64Registers struct {
Regs *RISCV64PtraceRegs // general-purpose registers & pc
Fpregs []proc.Register // Formatted floating-point registers
Fpregset []byte // holding all floating-point register values
// contains filtered or unexported fields
}
RISCV64Registers implements the proc.Registers interface.
func NewRISCV64Registers ¶ added in v1.24.0
func NewRISCV64Registers(regs *RISCV64PtraceRegs, iscgo bool, tp_tls uint64, loadFpRegs func(*RISCV64Registers) error) *RISCV64Registers
func (*RISCV64Registers) BP ¶ added in v1.24.0
func (r *RISCV64Registers) BP() uint64
BP returns the value of FP register
func (*RISCV64Registers) Copy ¶ added in v1.24.0
func (r *RISCV64Registers) Copy() (proc.Registers, error)
Copy returns a copy of these registers that is guaranteed not to change.
func (*RISCV64Registers) GAddr ¶ added in v1.24.0
func (r *RISCV64Registers) GAddr() (uint64, bool)
GAddr returns the address of the G variable if it is known, 0 and false otherwise.
func (*RISCV64Registers) GetReg ¶ added in v1.24.0
func (r *RISCV64Registers) GetReg(regNum uint64) (uint64, error)
func (*RISCV64Registers) LR ¶ added in v1.24.0
func (r *RISCV64Registers) LR() uint64
LR returns the link register.
func (*RISCV64Registers) PC ¶ added in v1.24.0
func (r *RISCV64Registers) PC() uint64
PC returns the value of PC register.
func (*RISCV64Registers) SP ¶ added in v1.24.0
func (r *RISCV64Registers) SP() uint64
SP returns the value of SP register.
func (*RISCV64Registers) SetReg ¶ added in v1.24.0
func (r *RISCV64Registers) SetReg(regNum uint64, reg *op.DwarfRegister) (fpchanged bool, err error)
func (*RISCV64Registers) Slice ¶ added in v1.24.0
func (r *RISCV64Registers) Slice(floatingPoint bool) ([]proc.Register, error)
Slice returns the registers as a list of (name, value) pairs.
func (*RISCV64Registers) TLS ¶ added in v1.24.0
func (r *RISCV64Registers) TLS() uint64
TLS returns the address of the thread local storage memory segment.