Documentation
¶
Index ¶
- func IsPclntabMagic(v uint32) bool
- func ScanForPclntab(data []byte) int
- type Binary
- type ELFBinary
- func (b *ELFBinary) Arch() string
- func (b *ELFBinary) Close() error
- func (b *ELFBinary) DynSymbols() map[uint64]string
- func (b *ELFBinary) FindGopclntab() ([]byte, uint64, error)
- func (b *ELFBinary) Format() string
- func (b *ELFBinary) GoVersion() string
- func (b *ELFBinary) ImageBase() uint64
- func (b *ELFBinary) Path() string
- func (b *ELFBinary) Section(name string) ([]byte, error)
- func (b *ELFBinary) SectionVA(name string) (uint64, error)
- func (b *ELFBinary) Size() int64
- func (b *ELFBinary) TextSectionRange() (uint64, uint64, error)
- func (b *ELFBinary) TypeLinks() ([]byte, uint64, error)
- type PEBinary
- func (b *PEBinary) Arch() string
- func (b *PEBinary) Close() error
- func (b *PEBinary) FindGopclntab() ([]byte, uint64, error)
- func (b *PEBinary) Format() string
- func (b *PEBinary) GoVersion() string
- func (b *PEBinary) ImageBase() uint64
- func (b *PEBinary) Path() string
- func (b *PEBinary) Section(name string) ([]byte, error)
- func (b *PEBinary) SectionVA(name string) (uint64, error)
- func (b *PEBinary) Size() int64
- func (b *PEBinary) TextSectionRange() (uint64, uint64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsPclntabMagic ¶
IsPclntabMagic returns true if the 4-byte value matches any known pclntab magic.
func ScanForPclntab ¶
ScanForPclntab searches data for a gopclntab magic at any 4-byte aligned offset. Returns the offset within data, or -1 if not found. Validates that the header looks like a real pclntab (pad bytes zero, valid ptrSize).
Types ¶
type Binary ¶
type Binary interface {
// Section returns raw bytes for the named section.
Section(name string) ([]byte, error)
// SectionVA returns the virtual address of a section.
SectionVA(name string) (uint64, error)
// TextSectionRange returns (startVA, endVA) for the executable text section.
TextSectionRange() (uint64, uint64, error)
// ImageBase returns the preferred load address.
ImageBase() uint64
// GoVersion returns the embedded Go version string if detectable.
GoVersion() string
// Format returns "PE" or "ELF".
Format() string
// Arch returns the architecture string.
Arch() string
// Size returns the file size in bytes.
Size() int64
// Path returns the file path.
Path() string
// FindGopclntab searches all sections for gopclntab magic bytes.
// Needed for PE binaries where gopclntab may not be in its own section.
FindGopclntab() ([]byte, uint64, error)
// Close releases file resources.
Close() error
}
Binary is the platform-agnostic interface over PE and ELF files.
type ELFBinary ¶
type ELFBinary struct {
// contains filtered or unexported fields
}
ELFBinary implements Binary for Linux ELF files.
func (*ELFBinary) DynSymbols ¶
DynSymbols returns name->addr map of dynamic symbols (for PLT resolution).
Click to show internal directories.
Click to hide internal directories.