Documentation ¶
Overview ¶
Package gosym implements access to the Go symbol and line number tables embedded in Go binaries generated by the gc compilers.
Index ¶
- type DecodingError
- type Func
- type LineTable
- type Obj
- type Sym
- type Table
- func (t *Table) LineToPC(file string, line int) (pc uint64, fn *Func, err error)
- func (t *Table) LookupFunc(name string) *Func
- func (t *Table) LookupSym(name string) *Sym
- func (t *Table) PCToFunc(pc uint64) *Func
- func (t *Table) PCToLine(pc uint64) (file string, line int, fn *Func)
- func (t *Table) SymByAddr(addr uint64) *Sym
- type UnknownFileError
- type UnknownLineError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DecodingError ¶
type DecodingError struct {
// contains filtered or unexported fields
}
DecodingError represents an error during the decoding of the symbol table.
func (*DecodingError) Error ¶
func (e *DecodingError) Error() string
type Func ¶
type Func struct { Entry uint64 *Sym End uint64 Params []*Sym Locals []*Sym FrameSize int LineTable *LineTable Obj *Obj }
A Func collects information about a single function.
type LineTable ¶
func NewLineTable ¶
NewLineTable returns a new PC/line table corresponding to the encoded data. Text must be the start address of the corresponding text segment.
type Sym ¶
type Sym struct { Value uint64 Type byte Name string GoType uint64 // If this symbol if a function symbol, the corresponding Func Func *Func }
A Sym represents a single symbol table entry.
func (*Sym) PackageName ¶
PackageName returns the package part of the symbol name, or the empty string if there is none.
func (*Sym) ReceiverName ¶
ReceiverName returns the receiver type name of this symbol, or the empty string if there is none.
type Table ¶
Table represents a Go symbol table. It stores all of the symbols decoded from the program and provides methods to translate between symbols, names, and addresses.
func NewTable ¶
NewTable decodes the Go symbol table in data, returning an in-memory representation.
func (*Table) LineToPC ¶
LineToPC looks up the first program counter on the given line in the named file. Returns UnknownPathError or UnknownLineError if there is an error looking up this line.
func (*Table) LookupFunc ¶
LookupFunc returns the text, data, or bss symbol with the given name, or nil if no such symbol is found.
func (*Table) LookupSym ¶
LookupSym returns the text, data, or bss symbol with the given name, or nil if no such symbol is found.
func (*Table) PCToFunc ¶
PCToFunc returns the function containing the program counter pc, or nil if there is no such function.
type UnknownFileError ¶
type UnknownFileError string
UnknownFileError represents a failure to find the specific file in the symbol table.
func (UnknownFileError) Error ¶
func (e UnknownFileError) Error() string
type UnknownLineError ¶
UnknownLineError represents a failure to map a line to a program counter, either because the line is beyond the bounds of the file or because there is no code on the given line.
func (*UnknownLineError) Error ¶
func (e *UnknownLineError) Error() string