Documentation
¶
Overview ¶
Package blazesym provides Go bindings for blazesym library.
Index ¶
- type CodeInfo
- type ElfSource
- type ElfSourceOption
- type GsymDataSource
- type GsymFileSource
- type InlinedFn
- type ProcessSource
- type ProcessSourceOption
- type Sym
- type SymbolizeReason
- type Symbolizer
- func (s *Symbolizer) Close()
- func (s *Symbolizer) SymbolizeElfVirtOffsets(addrs []uint64, path string, options ...ElfSourceOption) ([]Sym, error)
- func (s *Symbolizer) SymbolizeGsymDataVirtOffsets(addrs []uint64, data []byte) ([]Sym, error)
- func (s *Symbolizer) SymbolizeGsymFileVirtOffsets(addrs []uint64, path string) ([]Sym, error)
- func (s *Symbolizer) SymbolizeProcessAbsAddrs(addrs []uint64, pid uint32, options ...ProcessSourceOption) ([]Sym, error)
- type SymbolizerOption
- func SymbolizerWithAutoReload(enabled bool) SymbolizerOption
- func SymbolizerWithCodeInfo(enabled bool) SymbolizerOption
- func SymbolizerWithDebugDirs(dirs []string) SymbolizerOption
- func SymbolizerWithDemangle(enabled bool) SymbolizerOption
- func SymbolizerWithInlinedFns(enabled bool) SymbolizerOption
- type SymbolizerOptions
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CodeInfo ¶
type CodeInfo struct {
// The directory in which the source file resides.
Dir string
// The file that defines the symbol.
File string
// The line number of the symbolized instruction in the source code.
Line uint32
// The column number of the symbolized instruction in the source code.
Column uint16
}
CodeInfo describes source code location information for a symbol or inlined function. See: https://docs.rs/blazesym-c/latest/blazesym_c/struct.blaze_symbolize_code_info.html
type ElfSource ¶
type ElfSource struct {
// contains filtered or unexported fields
}
ElfSource describes the parameters to load symbols and debug information from an ELF. See: https://docs.rs/blazesym-c/latest/blazesym_c/struct.blaze_symbolize_src_elf.html
Example ¶
package main
import (
"fmt"
"log"
blazesym "github.com/libbpf/blazesym/go"
)
func main() {
symbolizer, err := blazesym.NewSymbolizer()
if err != nil {
log.Fatalf("error creating symbolizer: %v", err)
}
symbols, err := symbolizer.SymbolizeElfVirtOffsets([]uint64{0x2000200}, "../data/test-stable-addrs-compressed-debug-zlib.bin", blazesym.ElfSourceWithDebugSyms(true))
if err != nil {
log.Fatalf("error symbolizing: %v", err)
}
fmt.Printf("%s @ 0x%x %s\n", symbols[0].Name, symbols[0].Addr, symbols[0].CodeInfo.File)
}
Output: factorial @ 0x2000200 test-stable-addrs.c
type ElfSourceOption ¶
type ElfSourceOption func(*ElfSource)
ElfSourceOption configures ElfSource objects.
func ElfSourceWithDebugSyms ¶
func ElfSourceWithDebugSyms(enabled bool) ElfSourceOption
ElfSourceWithDebugSyms configures whether or not to consult debug symbols to satisfy the request (if present). See: https://docs.rs/blazesym-c/latest/blazesym_c/struct.blaze_symbolize_src_elf.html#structfield.debug_syms
type GsymDataSource ¶
type GsymDataSource struct {
// contains filtered or unexported fields
}
GsymDataSource describes the parameters to load symbols and debug information from “raw” Gsym data. See: https://docs.rs/blazesym-c/latest/blazesym_c/struct.blaze_symbolize_src_gsym_data.html
type GsymFileSource ¶
type GsymFileSource struct {
// contains filtered or unexported fields
}
GsymFileSource describes the parameters to load symbols and debug information from a Gsym file. See: https://docs.rs/blazesym-c/latest/blazesym_c/struct.blaze_symbolize_src_gsym_file.html
type InlinedFn ¶
type InlinedFn struct {
// The symbol name of the inlined function.
Name string
// Source code location information for the call to the function.
CodeInfo *CodeInfo
}
InlinedFn represents an inlined function. See: https://docs.rs/blazesym-c/latest/blazesym_c/struct.blaze_symbolize_inlined_fn.html
type ProcessSource ¶
type ProcessSource struct {
// contains filtered or unexported fields
}
ProcessSource describes the parameters to load symbols and debug information from a process. See: https://docs.rs/blazesym-c/latest/blazesym_c/struct.blaze_symbolize_src_process.html
type ProcessSourceOption ¶
type ProcessSourceOption func(*ProcessSource)
ProcessSourceOption configures ProcessSource objects.
func ProcessSourceWithDebugSyms ¶
func ProcessSourceWithDebugSyms(enabled bool) ProcessSourceOption
ProcessSourceWithDebugSyms configures whether or not to consult debug symbols to satisfy the request (if present). See: https://docs.rs/blazesym-c/latest/blazesym_c/struct.blaze_symbolize_src_process.html#structfield.debug_syms
func ProcessSourceWithPerfMap ¶
func ProcessSourceWithPerfMap(enabled bool) ProcessSourceOption
ProcessSourceWithPerfMap configures whether to incorporate a process' perf map file into the symbolization procedure. See: https://docs.rs/blazesym-c/latest/blazesym_c/struct.blaze_symbolize_src_process.html#structfield.perf_map
func ProcessSourceWithoutMapFiles ¶
func ProcessSourceWithoutMapFiles(enabled bool) ProcessSourceOption
ProcessSourceWithoutMapFiles configures whether to work with /proc/<pid>/map_files/ entries or with symbolic paths mentioned in /proc/<pid>/maps instead. See: https://docs.rs/blazesym-c/latest/blazesym_c/struct.blaze_symbolize_src_process.html#structfield.no_map_files
func ProcessSourceWithoutVDSO ¶
func ProcessSourceWithoutVDSO(enabled bool) ProcessSourceOption
ProcessSourceWithoutVDSO configures whether or not to symbolize addresses in a vDSO (virtual dynamic shared object). See: https://docs.rs/blazesym-c/latest/blazesym_c/struct.blaze_symbolize_src_process.html#structfield.no_vdso
type Sym ¶
type Sym struct {
// The symbol name that an address belongs to.
Name string
// The path to or name of the module containing the symbol.
Module string
// The address at which the symbol is located (i.e., its “start”).
Addr uint64
// The byte offset of the address that got symbolized from the start of the symbol (i.e., from addr).
Offset uint64
// The symbol's size, if available.
Size int64
// Source code location information for the symbol.
CodeInfo *CodeInfo
// Inlined function information, if requested and available.
Inlined []InlinedFn
// On error (i.e., if name is NULL), a reason trying to explain why symbolization failed.
Reason SymbolizeReason
}
Sym is the result of address symbolization by Symbolizer. See: https://docs.rs/blazesym-c/latest/blazesym_c/struct.blaze_sym.html
type SymbolizeReason ¶
type SymbolizeReason int
SymbolizeReason describes the reason why symbolization failed. See: https://docs.rs/blazesym-c/latest/blazesym_c/struct.blaze_symbolize_reason.html
const ( // SymbolizeReasonSuccess means that symbolization was successful. SymbolizeReasonSuccess SymbolizeReason = 0 // SymbolizeReasonUnmapped means that the absolute address was not found // in the corresponding process' virtual memory map. SymbolizeReasonUnmapped SymbolizeReason = 1 // SymbolizeReasonInvalidFileOffset means that the file offset does not map // to a valid piece of code/data. SymbolizeReasonInvalidFileOffset SymbolizeReason = 2 // SymbolizeReasonMissingComponent means that the `/proc/<pid>/maps` entry // corresponding to the address does not have a component (file system path, // object, ...) associated with it. SymbolizeReasonMissingComponent SymbolizeReason = 3 // SymbolizeReasonMissingSyms means that the symbolization source has no // or no relevant symbols. SymbolizeReasonMissingSyms SymbolizeReason = 4 // SymbolizeReasonUnknownAddr means that the address could not be found // in the symbolization source. SymbolizeReasonUnknownAddr SymbolizeReason = 5 // SymbolizeReasonUnsupported means that the address belonged to an entity // that is currently unsupported. SymbolizeReasonUnsupported SymbolizeReason = 6 )
type Symbolizer ¶
type Symbolizer struct {
// contains filtered or unexported fields
}
Symbolizer represents a Blazesym symbolizer.
func NewSymbolizer ¶
func NewSymbolizer(options ...SymbolizerOption) (*Symbolizer, error)
NewSymbolizer creates an instance of a symbolizer. See: https://docs.rs/blazesym-c/latest/blazesym_c/fn.blaze_symbolizer_new.html
func (*Symbolizer) SymbolizeElfVirtOffsets ¶
func (s *Symbolizer) SymbolizeElfVirtOffsets(addrs []uint64, path string, options ...ElfSourceOption) ([]Sym, error)
SymbolizeElfVirtOffsets symbolizes virtual offsets in an ELF file. See: https://docs.rs/blazesym-c/latest/blazesym_c/fn.blaze_symbolize_elf_virt_offsets.html
func (*Symbolizer) SymbolizeGsymDataVirtOffsets ¶
func (s *Symbolizer) SymbolizeGsymDataVirtOffsets(addrs []uint64, data []byte) ([]Sym, error)
SymbolizeGsymDataVirtOffsets symbolizes virtual offsets using “raw” Gsym data. See: https://docs.rs/blazesym-c/latest/blazesym_c/fn.blaze_symbolize_gsym_data_virt_offsets.html
func (*Symbolizer) SymbolizeGsymFileVirtOffsets ¶
func (s *Symbolizer) SymbolizeGsymFileVirtOffsets(addrs []uint64, path string) ([]Sym, error)
SymbolizeGsymFileVirtOffsets symbolizes virtual offsets in a Gsym file. See: https://docs.rs/blazesym-c/latest/blazesym_c/fn.blaze_symbolize_gsym_file_virt_offsets.html
func (*Symbolizer) SymbolizeProcessAbsAddrs ¶
func (s *Symbolizer) SymbolizeProcessAbsAddrs(addrs []uint64, pid uint32, options ...ProcessSourceOption) ([]Sym, error)
SymbolizeProcessAbsAddrs symbolizes a list of process absolute addresses. See: https://docs.rs/blazesym-c/latest/blazesym_c/fn.blaze_symbolize_process_abs_addrs.html
type SymbolizerOption ¶
type SymbolizerOption func(*SymbolizerOptions)
SymbolizerOption configures SymbolizerOptions objects.
func SymbolizerWithAutoReload ¶
func SymbolizerWithAutoReload(enabled bool) SymbolizerOption
SymbolizerWithAutoReload sets whether or not to automatically reload file system based symbolization sources that were updated since the last symbolization operation. See: https://docs.rs/blazesym-c/latest/blazesym_c/struct.blaze_symbolizer_opts.html#structfield.auto_reload
func SymbolizerWithCodeInfo ¶
func SymbolizerWithCodeInfo(enabled bool) SymbolizerOption
SymbolizerWithCodeInfo sets whether to attempt to gather source code location information. See: https://docs.rs/blazesym-c/latest/blazesym_c/struct.blaze_symbolizer_opts.html#structfield.code_info
func SymbolizerWithDebugDirs ¶
func SymbolizerWithDebugDirs(dirs []string) SymbolizerOption
SymbolizerWithDebugDirs sets the array of debug directories to search for split debug information. See: https://docs.rs/blazesym-c/latest/blazesym_c/struct.blaze_symbolizer_opts.html#structfield.debug_dirs
func SymbolizerWithDemangle ¶
func SymbolizerWithDemangle(enabled bool) SymbolizerOption
SymbolizerWithDemangle sets whether or not to transparently demangle symbols. See: https://docs.rs/blazesym-c/latest/blazesym_c/struct.blaze_symbolizer_opts.html#structfield.demangle
func SymbolizerWithInlinedFns ¶
func SymbolizerWithInlinedFns(enabled bool) SymbolizerOption
SymbolizerWithInlinedFns sets whether to report inlined functions as part of symbolization. See: https://docs.rs/blazesym-c/latest/blazesym_c/struct.blaze_symbolizer_opts.html#structfield.inlined_fns
type SymbolizerOptions ¶
type SymbolizerOptions struct {
// contains filtered or unexported fields
}
SymbolizerOptions is options for configuring Symbolizer objects. See: https://docs.rs/blazesym-c/latest/blazesym_c/struct.blaze_symbolizer_opts.html
func (*SymbolizerOptions) Close ¶
func (so *SymbolizerOptions) Close()
Close frees resources associated with SymbolizerOptions.