elf

package
v0.0.0-...-0fcddf3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoBuildIDSection = fmt.Errorf("build ID section not found")
View Source
var ErrNoSymbols = errors.New("no symbol section")

ErrNoSymbols is returned by File.Symbols and File.DynamicSymbols if there is no such section in the File.

Functions

This section is empty.

Types

type BuildId

type BuildId struct {
	Id  string
	Typ string
}

func GNUBuildId

func GNUBuildId(s string) BuildId

func GoBuildId

func GoBuildId(s string) BuildId

func (*BuildId) Empty

func (b *BuildId) Empty() bool

func (*BuildId) GNU

func (b *BuildId) GNU() bool

type FlatSymbolIndex

type FlatSymbolIndex struct {
	Links  []elf.SectionHeader
	Names  []Name
	Values gosym.PCIndex
}

type GoTable

type GoTable struct {
	Index gosym2.FlatFuncIndex
	File  *MMapedElfFile
	// contains filtered or unexported fields
}

func (*GoTable) Cleanup

func (g *GoTable) Cleanup()

func (*GoTable) DebugInfo

func (g *GoTable) DebugInfo() SymTabDebugInfo

func (*GoTable) IsDead

func (g *GoTable) IsDead() bool

func (*GoTable) Refresh

func (g *GoTable) Refresh()

func (*GoTable) Resolve

func (g *GoTable) Resolve(addr uint64) string

func (*GoTable) SetFallback

func (g *GoTable) SetFallback(fallback Table)

func (*GoTable) Size

func (g *GoTable) Size() int

type MMapedElfFile

type MMapedElfFile struct {
	elf.FileHeader
	Sections []elf.SectionHeader
	Progs    []elf.ProgHeader
	// contains filtered or unexported fields
}

func NewMMapedElfFile

func NewMMapedElfFile(fpath string) (*MMapedElfFile, error)

func (*MMapedElfFile) BuildId

func (f *MMapedElfFile) BuildId() (BuildId, error)

func (*MMapedElfFile) Close

func (f *MMapedElfFile) Close()

func (*MMapedElfFile) FilePath

func (f *MMapedElfFile) FilePath() string

func (*MMapedElfFile) GNUBuildId

func (f *MMapedElfFile) GNUBuildId() (BuildId, error)

func (*MMapedElfFile) GetSectionData

func (f *MMapedElfFile) GetSectionData(name string) (*SectionData, error)

func (*MMapedElfFile) GoBuildId

func (f *MMapedElfFile) GoBuildId() (BuildId, error)

func (*MMapedElfFile) NewGoTable

func (f *MMapedElfFile) NewGoTable(fallback Table) (*GoTable, error)

func (*MMapedElfFile) NewSymbolTable

func (f *MMapedElfFile) NewSymbolTable(opt *SymbolOptions) (*SymbolTable, error)

func (*MMapedElfFile) Section

func (f *MMapedElfFile) Section(name string) *elf.SectionHeader

func (*MMapedElfFile) SectionData

func (f *MMapedElfFile) SectionData(s *elf.SectionHeader) ([]byte, error)

type Name

type Name uint32

func NewName

func NewName(NameIndex uint32, linkIndex SectionLinkIndex) Name

func (*Name) LinkIndex

func (n *Name) LinkIndex() SectionLinkIndex

func (*Name) NameIndex

func (n *Name) NameIndex() uint32

type SectionData

type SectionData struct {
	Header elf.SectionHeader
	Data   []byte
}

type SectionLinkIndex

type SectionLinkIndex uint8

type SymTabDebugInfo

type SymTabDebugInfo struct {
	Name          string `river:"name,attr,optional"`
	Size          int    `river:"symbol_count,attr,optional"`
	File          string `river:"file,attr,optional"`
	LastUsedRound int    `river:"last_used_round,attr,optional"`
}

type SymbolIndex

type SymbolIndex struct {
	Name  Name
	Value uint64
}

type SymbolOptions

type SymbolOptions struct {
	DemangleOpts []demangle.Option
	// ignore symbols from FilterFrom to FilterTo
	FilterFrom uint64
	FilterTo   uint64
}

type SymbolTable

type SymbolTable struct {
	Index FlatSymbolIndex
	File  *MMapedElfFile
	// contains filtered or unexported fields
}

func (*SymbolTable) Cleanup

func (st *SymbolTable) Cleanup()

func (*SymbolTable) DebugInfo

func (st *SymbolTable) DebugInfo() SymTabDebugInfo

func (*SymbolTable) DebugString

func (st *SymbolTable) DebugString() string

func (*SymbolTable) IsDead

func (st *SymbolTable) IsDead() bool

func (*SymbolTable) Refresh

func (st *SymbolTable) Refresh()

func (*SymbolTable) Resolve

func (st *SymbolTable) Resolve(addr uint64) string

func (*SymbolTable) Size

func (st *SymbolTable) Size() int

type Table

type Table interface {
	Resolve(addr uint64) string
	Size() int
	Cleanup()
}

type TestSym

type TestSym struct {
	Name  string
	Start uint64
}

func GetELFSymbolsFromSymtab

func GetELFSymbolsFromSymtab(elfFile *elf.File) []TestSym

func GetGoSymbols

func GetGoSymbols(file string, patchGo20Magic bool) ([]TestSym, error)

Jump to

Keyboard shortcuts

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