elf

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	USDT_ARG_TYPE_NONE      uint8 = 0
	USDT_ARG_TYPE_CONST     uint8 = 1
	USDT_ARG_TYPE_REG       uint8 = 2
	USDT_ARG_TYPE_REG_DEREF uint8 = 3
	USDT_ARG_TYPE_SIB       uint8 = 4
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Integer added in v1.6.0

type Integer interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

Integer represents all possible integer types. Remove when x/exp/constraints is moved to the standard library.

type RegScanner added in v1.6.0

type RegScanner struct {
	// contains filtered or unexported fields
}

func (*RegScanner) Reset added in v1.6.0

func (sc *RegScanner) Reset() *RegScanner

func (*RegScanner) Scan added in v1.6.0

func (sc *RegScanner) Scan(state fmt.ScanState, _ rune) error

type SafeELFFile

type SafeELFFile struct {
	*elf.File
}

func NewSafeELFFile

func NewSafeELFFile(r io.ReaderAt) (safe *SafeELFFile, err error)

NewSafeELFFile reads an ELF safely.

Any panic during parsing is turned into an error. This is necessary since there are a bunch of unfixed bugs in debug/elf.

https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+debug%2Felf+in%3Atitle

func OpenSafeELFFile

func OpenSafeELFFile(path string) (safe *SafeELFFile, err error)

OpenSafeELFFile reads an ELF from a file.

It works like NewSafeELFFile, with the exception that safe.Close will close the underlying file.

func (*SafeELFFile) Address added in v1.6.0

func (se *SafeELFFile) Address(name string) (uint64, error)

func (*SafeELFFile) Offset

func (se *SafeELFFile) Offset(name string) (uint64, error)

func (*SafeELFFile) OffsetFromAddr added in v1.6.0

func (se *SafeELFFile) OffsetFromAddr(addr uint64) (uint64, error)

func (*SafeELFFile) ProgByVaddr added in v1.6.0

func (se *SafeELFFile) ProgByVaddr(vaddr uint64) *elf.Prog

ProgByVaddr returns elf program header for the specified vaddr.

func (*SafeELFFile) SectionsByName added in v1.6.0

func (se *SafeELFFile) SectionsByName(name string) []*elf.Section

SectionsByName returns all sections in the file with the specified section name.

func (*SafeELFFile) SectionsByType added in v1.6.0

func (se *SafeELFFile) SectionsByType(typ elf.SectionType) []*elf.Section

SectionsByType returns all sections in the file with the specified section type.

func (*SafeELFFile) UsdtTargets added in v1.6.0

func (se *SafeELFFile) UsdtTargets() ([]*UsdtTarget, error)

type UsdtArg added in v1.6.0

type UsdtArg struct {
	ValOff    uint64
	RegOff    uint16
	RegIdxOff uint16
	Shift     uint8
	Scale     uint8
	Type      uint8
	Signed    bool
	Size      int
	Str       string
}

type UsdtArgType added in v1.6.0

type UsdtArgType int

type UsdtSpec added in v1.6.0

type UsdtSpec struct {
	Off      uint64
	Base     uint64
	Sema     uint64
	Provider string
	Name     string
	ArgsStr  string
	ArgsCnt  uint32
	Args     [12]UsdtArg
}

type UsdtTarget added in v1.6.0

type UsdtTarget struct {
	Spec    *UsdtSpec
	IpAbs   uint64
	IpRel   uint64
	SemaOff uint64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL