binutils

package
v0.0.0-...-45c0a9f Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotELF     = errors.New("file is not an ELF")
	ErrNoSymbols  = errors.New("no symbol section")
	ErrFileClosed = errors.New("file is closed")
)

Functions

func ComputeBinaryHash

func ComputeBinaryHash(f *os.File) (string, error)

ComputeBinaryHash generates a cache key using xxHash (fastest non-crypto hash). It samples file content + file size.

func ComputeFullHash

func ComputeFullHash(path string) (string, error)

ComputeFullHash computes a full SHA1 hash of the file. This is slower but provides a cryptographically strong hash.

func FindSymbols

func FindSymbols(symbols []elf.Symbol, target SymbolSearch, filter func(*elf.Symbol) bool) ([]*elf.Symbol, error)

func MatchSymbol

func MatchSymbol(symName string, targetSymbols []SymbolSearch) bool

Types

type Elf

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

func NewElf

func NewElf(ctx context.Context, exe string, root string, isContainer bool) (*Elf, error)

NewElf creates a new Elf instance Returns ErrNotELF if the file is not an ELF Remember to call Close() when done

func (*Elf) CalculateUprobeAddresses

func (p *Elf) CalculateUprobeAddresses(ctx context.Context, symbols []elf.Symbol) []elf.Symbol

CalculateUprobeAddresses calculates the loaded address of a symbol (needed for uprobes)

func (*Elf) Close

func (e *Elf) Close() error

func (*Elf) ContainsAnySymbols

func (p *Elf) ContainsAnySymbols(ctx context.Context, targetSymbols []SymbolSearch, typ ...elf.SectionType) (bool, error)

func (*Elf) Elf

func (p *Elf) Elf(ctx context.Context) (*elf.File, error)

func (*Elf) GetSections

func (p *Elf) GetSections(ctx context.Context) []*elf.Section

func (*Elf) Hash

func (e *Elf) Hash(ctx context.Context) (string, error)

func (*Elf) Ldd

func (p *Elf) Ldd(ctx context.Context) ([]string, error)

func (*Elf) Mtime

func (e *Elf) Mtime() time.Time

func (*Elf) Path

func (e *Elf) Path() string

func (*Elf) SearchString

func (e *Elf) SearchString(searchStr string, strategy MatchStrategy) (string, error)

func (*Elf) SearchSymbols

func (p *Elf) SearchSymbols(ctx context.Context, targets []SymbolSearch, sectionTypes ...elf.SectionType) ([]elf.Symbol, error)

type MatchStrategy

type MatchStrategy int

enum for symbol match strategy

const (
	MatchStrategyExact MatchStrategy = iota
	MatchStrategyPrefix
	MatchStrategySuffix
	MatchStrategyContains
)

type SymbolSearch

type SymbolSearch struct {
	Name string
	MatchStrategy
}

func (*SymbolSearch) Bytes

func (s *SymbolSearch) Bytes() []byte

Jump to

Keyboard shortcuts

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