reader

package
v1.23.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: MIT Imports: 5 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTypeNotFound = errors.New("no type entry found, use 'types' for a list of valid types")

Functions

func InlineStack added in v1.1.0

func InlineStack(root *godwarf.Tree, pc uint64) []*godwarf.Tree

InlineStack returns the stack of inlined calls for the specified function and PC address. If pc is 0 then all inlined calls will be returned.

Types

type Reader

type Reader struct {
	*dwarf.Reader
	// contains filtered or unexported fields
}

func New

func New(data *dwarf.Data) *Reader

New returns a reader for the specified dwarf data.

func (*Reader) AddrFor

func (reader *Reader) AddrFor(name string, staticBase uint64, ptrSize int) (uint64, error)

AddrFor returns the address for the named entry.

func (*Reader) FindEntryNamed

func (reader *Reader) FindEntryNamed(name string, member bool) (*dwarf.Entry, error)

FindEntryNamed finds the entry for 'name'.

func (*Reader) InstructionsForEntry

func (reader *Reader) InstructionsForEntry(entry *dwarf.Entry) ([]byte, error)

func (*Reader) InstructionsForEntryNamed

func (reader *Reader) InstructionsForEntryNamed(name string, member bool) ([]byte, error)

func (*Reader) NextCompileUnit

func (reader *Reader) NextCompileUnit() (*dwarf.Entry, error)

func (*Reader) NextMemberVariable

func (reader *Reader) NextMemberVariable() (*dwarf.Entry, error)

NextMemberVariable moves the reader to the next debug entry that describes a member variable and returns the entry.

func (*Reader) NextPackageVariable

func (reader *Reader) NextPackageVariable() (*dwarf.Entry, error)

NextPackageVariable moves the reader to the next debug entry that describes a package variable. Any TagVariable entry that is not inside a sub program entry and is marked external is considered a package variable.

func (*Reader) NextType

func (reader *Reader) NextType() (*dwarf.Entry, error)

func (*Reader) Seek

func (reader *Reader) Seek(off dwarf.Offset)

Seek moves the reader to an arbitrary offset.

func (*Reader) SeekToEntry

func (reader *Reader) SeekToEntry(entry *dwarf.Entry) error

SeekToEntry moves the reader to an arbitrary entry.

func (*Reader) SeekToType

func (reader *Reader) SeekToType(entry *dwarf.Entry, resolveTypedefs bool, resolvePointerTypes bool) (*dwarf.Entry, error)

SeekToType moves the reader to the type specified by the entry, optionally resolving typedefs and pointer types. If the reader is set to a struct type the NextMemberVariable call can be used to walk all member data.

func (*Reader) SeekToTypeNamed

func (reader *Reader) SeekToTypeNamed(name string) (*dwarf.Entry, error)

SeekToTypeNamed moves the reader to the type specified by the name. If the reader is set to a struct type the NextMemberVariable call can be used to walk all member data.

type Variable added in v1.4.1

type Variable struct {
	*godwarf.Tree
	// Depth represents the depth of the lexical block in which this variable
	// was declared, relative to a root scope (e.g. a function) passed to
	// Variables(). The depth is used to figure out if a variable is shadowed at
	// a particular pc by another one with the same name declared in an inner
	// block.
	Depth int
}

func Variables added in v1.0.0

func Variables(root *godwarf.Tree, pc uint64, line int, flags VariablesFlags) []Variable

Variables returns a list of variables contained inside 'root'.

If the VariablesOnlyVisible flag is set, only variables visible at 'pc' will be returned. If the VariablesSkipInlinedSubroutines is set, variables from inlined subroutines will be skipped.

type VariablesFlags added in v1.5.0

type VariablesFlags uint8

VariablesFlags specifies some configuration flags for the Variables function.

const (
	VariablesOnlyVisible VariablesFlags = 1 << iota
	VariablesSkipInlinedSubroutines
	VariablesTrustDeclLine
	VariablesNoDeclLineCheck
	VariablesOnlyCaptured
)

Jump to

Keyboard shortcuts

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