package gosym

Import Path
	debug/gosym (on go.dev)

Dependency Relation
	imports 7 packages, and imported by 0 packages

Involved Source Files pclntab.go Package gosym implements access to the Go symbol and line number tables embedded in Go binaries generated by the gc compilers.
Package-Level Type Names (total 8)
/* sort by: | */
DecodingError represents an error during the decoding of the symbol table. (*DecodingError) Error() string *DecodingError : error
A Func collects information about a single function. End uint64 Entry uint64 FrameSize int LineTable *LineTable // nil for Go 1.3 and later binaries Obj *Obj // nil for Go 1.3 and later binaries Sym *Sym If this symbol is a function symbol, the corresponding Func Sym.GoType uint64 Sym.Name string Sym.Type byte Sym.Value uint64 BaseName returns the symbol name without the package or receiver name. PackageName returns the package part of the symbol name, or the empty string if there is none. ReceiverName returns the receiver type name of this symbol, or the empty string if there is none. A receiver name is only detected in the case that s.Name is fully-specified with a package name. Static reports whether this symbol is static (not visible outside its file). func (*Table).LineToPC(file string, line int) (pc uint64, fn *Func, err error) func (*Table).LookupFunc(name string) *Func func (*Table).PCToFunc(pc uint64) *Func func (*Table).PCToLine(pc uint64) (file string, line int, fn *Func)
A LineTable is a data structure mapping program counters to line numbers. In Go 1.1 and earlier, each function (represented by a [Func]) had its own LineTable, and the line number corresponded to a numbering of all source lines in the program, across all files. That absolute line number would then have to be converted separately to a file name and line number within the file. In Go 1.2, the format of the data changed so that there is a single LineTable for the entire program, shared by all Funcs, and there are no absolute line numbers, just line numbers within specific files. For the most part, LineTable's methods should be treated as an internal detail of the package; callers should use the methods on [Table] instead. Data []byte Line int PC uint64 LineToPC returns the program counter for the given line number, considering only program counters before maxpc. Deprecated: Use Table's LineToPC method instead. PCToLine returns the line number for the given program counter. Deprecated: Use Table's PCToLine method instead. func NewLineTable(data []byte, text uint64) *LineTable func NewTable(symtab []byte, pcln *LineTable) (*Table, error)
An Obj represents a collection of functions in a symbol table. The exact method of division of a binary into separate Objs is an internal detail of the symbol table format. In early versions of Go each source file became a different Obj. In Go 1 and Go 1.1, each package produced one Obj for all Go sources and one Obj per C source file. In Go 1.2, there is a single Obj for the entire program. Funcs is a list of functions in the Obj. In Go 1.1 and earlier, Paths is a list of symbols corresponding to the source file names that produced the Obj. In Go 1.2, Paths is nil. Use the keys of Table.Files to obtain a list of source files. // meta
A Sym represents a single symbol table entry. If this symbol is a function symbol, the corresponding Func GoType uint64 Name string Type byte Value uint64 BaseName returns the symbol name without the package or receiver name. PackageName returns the package part of the symbol name, or the empty string if there is none. ReceiverName returns the receiver type name of this symbol, or the empty string if there is none. A receiver name is only detected in the case that s.Name is fully-specified with a package name. Static reports whether this symbol is static (not visible outside its file). func (*Table).LookupSym(name string) *Sym func (*Table).SymByAddr(addr uint64) *Sym
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. // for Go 1.2 and later all files map to one Obj Funcs []Func // for Go 1.2 and later only one Obj in slice // nil for Go 1.3 and later binaries LineToPC looks up the first program counter on the given line in the named file. It returns [UnknownFileError] or [UnknownLineError] if there is an error looking up this line. LookupFunc returns the text, data, or bss symbol with the given name, or nil if no such symbol is found. LookupSym returns the text, data, or bss symbol with the given name, or nil if no such symbol is found. PCToFunc returns the function containing the program counter pc, or nil if there is no such function. PCToLine looks up line number information for a program counter. If there is no information, it returns fn == nil. SymByAddr returns the text, data, or bss symbol starting at the given address. func NewTable(symtab []byte, pcln *LineTable) (*Table, error)
UnknownFileError represents a failure to find the specific file in the symbol table. ( UnknownFileError) Error() string UnknownFileError : error
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. File string Line int (*UnknownLineError) Error() string *UnknownLineError : error
Package-Level Functions (total 2)
NewLineTable returns a new PC/line table corresponding to the encoded data. Text must be the start address of the corresponding text segment, with the exact value stored in the 'runtime.text' symbol. This value may differ from the start address of the text segment if binary was built with cgo enabled.
NewTable decodes the Go symbol table (the ".gosymtab" section in ELF), returning an in-memory representation. Starting with Go 1.3, the Go symbol table no longer includes symbol data.