Documentation ¶
Index ¶
- Variables
- type Addr
- type AddrCoverage
- type AddrPos
- type AddrSourceType
- type AddrSpace
- type AddrType
- type CoveragePart
- type DisasmMeta
- type DwarfMeta
- type ErrAddrCoverageConflict
- type File
- type FuncType
- type Function
- type GoPclntabMeta
- type KnownAddr
- func (f *KnownAddr) BuildSymbolCoverage()
- func (f *KnownAddr) InsertDisasm(entry uint64, size uint64, fn *Function, meta DisasmMeta)
- func (f *KnownAddr) InsertSymbol(entry uint64, size uint64, p *Package, typ AddrType, meta SymbolMeta) *Addr
- func (f *KnownAddr) InsertTextFromDWARF(entry uint64, size uint64, fn *Function, meta DwarfMeta)
- func (f *KnownAddr) InsertTextFromPclnTab(entry uint64, size uint64, fn *Function, meta GoPclntabMeta)
- func (f *KnownAddr) SymbolCovHas(entry uint64, size uint64) (AddrType, bool)
- type Package
- func (p *Package) AddFuncIfNotExists(path string, fn *Function) bool
- func (p *Package) AddSymbol(addr uint64, size uint64, typ AddrType, name string, ap *Addr)
- func (p *Package) AssignPackageSize()
- func (p *Package) GetDisasmAddrSpace() AddrSpace
- func (p *Package) GetFunctionSizeRecursive() uint64
- func (p *Package) GetFunctions() []*Function
- func (p *Package) GetPackageCoverage() AddrCoverage
- func (p *Package) Merge(rp *Package)
- type PackageMap
- type PackageType
- type PclnSymbolSize
- type Section
- type Symbol
- type SymbolMeta
Constants ¶
This section is empty.
Variables ¶
View Source
var FileMarshalerCompact = json.MarshalFuncV2[File](func(encoder *jsontext.Encoder, file File, options json.Options) error { utils.Must(encoder.WriteToken(jsontext.ObjectStart)) utils.Must(json.MarshalEncode(encoder, "file_path", options)) utils.Must(json.MarshalEncode(encoder, file.FilePath, options)) utils.Must(json.MarshalEncode(encoder, "size", options)) utils.Must(json.MarshalEncode(encoder, file.FullSize(), options)) utils.Must(json.MarshalEncode(encoder, "pcln_size", options)) utils.Must(json.MarshalEncode(encoder, file.PclnSize(), options)) utils.Must(encoder.WriteToken(jsontext.ObjectEnd)) return nil })
Functions ¶
This section is empty.
Types ¶
type Addr ¶
type Addr struct { *AddrPos Pkg *Package // package can be nil for cgo symbols Function *Function // for symbol source it will be a nil SourceType AddrSourceType Meta any }
type AddrCoverage ¶
type AddrCoverage []*CoveragePart
AddrCoverage is a list of AddrPos, describe the coverage of the address space
func MergeAndCleanCoverage ¶ added in v0.2.4
func MergeAndCleanCoverage(coves []AddrCoverage) (AddrCoverage, error)
MergeAndCleanCoverage merge multiple AddrCoverage
type AddrSourceType ¶
type AddrSourceType = string
const ( AddrSourceGoPclntab AddrSourceType = "pclntab" AddrSourceSymbol AddrSourceType = "symbol" AddrSourceDisasm AddrSourceType = "disasm" AddrSourceDwarf AddrSourceType = "dwarf" )
type AddrSpace ¶
AddrSpace is a map of address to Addr
func MergeAddrSpace ¶
func (AddrSpace) ToDirtyCoverage ¶
func (a AddrSpace) ToDirtyCoverage() AddrCoverage
ToDirtyCoverage get the coverage of the current address space
type CoveragePart ¶
func (*CoveragePart) String ¶ added in v0.2.4
func (c *CoveragePart) String() string
type DisasmMeta ¶ added in v0.2.4
type DisasmMeta struct {
Value string
}
type ErrAddrCoverageConflict ¶
type ErrAddrCoverageConflict struct { Addr uint64 Pos1 *CoveragePart Pos2 *CoveragePart }
func (*ErrAddrCoverageConflict) Error ¶
func (e *ErrAddrCoverageConflict) Error() string
type File ¶
type Function ¶
type Function struct { Name string `json:"name"` Addr uint64 `json:"addr"` CodeSize uint64 `json:"code_size"` Type FuncType `json:"type"` Receiver string `json:"receiver"` // only for methods PclnSize PclnSymbolSize `json:"pcln_size"` File *File `json:"-"` // contains filtered or unexported fields }
type GoPclntabMeta ¶
type KnownAddr ¶
type KnownAddr struct { Text AddrSpace Symbol AddrSpace SymbolCoverage AddrCoverage }
func NewKnownAddr ¶
func NewKnownAddr() *KnownAddr
func (*KnownAddr) BuildSymbolCoverage ¶
func (f *KnownAddr) BuildSymbolCoverage()
func (*KnownAddr) InsertDisasm ¶
func (f *KnownAddr) InsertDisasm(entry uint64, size uint64, fn *Function, meta DisasmMeta)
func (*KnownAddr) InsertSymbol ¶
func (*KnownAddr) InsertTextFromDWARF ¶ added in v1.2.0
func (*KnownAddr) InsertTextFromPclnTab ¶ added in v1.2.0
func (f *KnownAddr) InsertTextFromPclnTab(entry uint64, size uint64, fn *Function, meta GoPclntabMeta)
type Package ¶
type Package struct { Name string `json:"name"` Type PackageType `json:"type"` SubPackages PackageMap `json:"subPackages"` Files []*File `json:"files"` Size uint64 `json:"size"` // late filled // should not be used to calculate size, // since linker can create overlapped symbols. // relies on coverage. Symbols []*Symbol `json:"symbols"` // should have at least one of them, for cgo pesudo package all nil GorePkg *gore.Package `json:"-"` DebugMod *debug.Module `json:"-"` DwarfEntry *dwarf.Entry `json:"-"` // contains filtered or unexported fields }
func NewPackage ¶
func NewPackage() *Package
func (*Package) AddFuncIfNotExists ¶ added in v1.2.0
func (*Package) AssignPackageSize ¶ added in v0.2.4
func (p *Package) AssignPackageSize()
func (*Package) GetDisasmAddrSpace ¶ added in v0.2.4
func (*Package) GetFunctionSizeRecursive ¶ added in v0.2.4
func (*Package) GetFunctions ¶
func (*Package) GetPackageCoverage ¶ added in v0.2.4
func (p *Package) GetPackageCoverage() AddrCoverage
type PackageMap ¶
type PackageType ¶
type PackageType = string
const ( PackageTypeMain PackageType = "main" PackageTypeStd PackageType = "std" PackageTypeVendor PackageType = "vendor" PackageTypeGenerated PackageType = "generated" PackageTypeUnknown PackageType = "unknown" PackageTypeCGO PackageType = "cgo" )
type PclnSymbolSize ¶ added in v0.4.0
type PclnSymbolSize struct { Name uint64 `json:"name"` // the function name size PCFile uint64 `json:"pcfile"` // the file name tab size PCSP uint64 `json:"pcsp"` // the pc to stack pointer table size PCLN uint64 `json:"pcln"` // the pc to line number table size Header uint64 `json:"header"` // the header size FuncData uint64 `json:"funcdata"` // the funcdata size PCData map[string]int `json:"pcdata"` // the pcdata size }
PclnSymbolSize represents a pcln symbol sizes
func NewEmptyPclnSymbolSize ¶ added in v1.2.0
func NewEmptyPclnSymbolSize() PclnSymbolSize
func NewPclnSymbolSize ¶ added in v0.4.0
func NewPclnSymbolSize(s *gosym.Func) PclnSymbolSize
func (*PclnSymbolSize) Size ¶ added in v0.4.0
func (p *PclnSymbolSize) Size() uint64
type Section ¶
type Section struct { Name string `json:"name"` Size uint64 `json:"size"` FileSize uint64 `json:"file_size"` KnownSize uint64 `json:"known_size"` Offset uint64 `json:"offset"` End uint64 `json:"end"` Addr uint64 `json:"addr"` AddrEnd uint64 `json:"addr_end"` OnlyInMemory bool `json:"only_in_memory"` Debug bool `json:"debug"` }
type Symbol ¶ added in v0.2.4
type Symbol struct { Name string `json:"name"` Addr uint64 `json:"addr"` Size uint64 `json:"size"` Type AddrType `json:"type"` }
type SymbolMeta ¶
Click to show internal directories.
Click to hide internal directories.