objfile

package
v0.0.0-...-cf91c28 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2019 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Location

type Location struct {
	// Function from where the call was done.
	Function string
	// File where the function is.
	File string
	// Stack is a call stack that stops at function. Using "/" to separate functions.
	Stack string
}

Location identifies a place in the code. It is used to aggregate data. It does not have the uint64 address or the file line because this would lead to high cardinality and, for instance, different points of the same function would be counted in different entries. OTOH the stack trace is considered a key field, to know where the call comes from.

func (*Location) String

func (loc *Location) String() string

String returns a JSON describing the location.

type NilObjFileError

type NilObjFileError struct{}

NilObjFileError when obj file is not initialized.

func (NilObjFileError) Error

func (e NilObjFileError) Error() string

Error string.

type NoAddrError

type NoAddrError struct{}

NoAddrError when there's no address.

func (NoAddrError) Error

func (e NoAddrError) Error() string

Error string.

type NoArgs0Error

type NoArgs0Error struct{}

NoArgs0Error when program name can't be found.

func (NoArgs0Error) Error

func (e NoArgs0Error) Error() string

Error string.

type NoFrame0Error

type NoFrame0Error struct{}

NoFrame0Error when there's not even one frame in sample.

func (NoFrame0Error) Error

func (e NoFrame0Error) Error() string

Error string.

type ObjFile

type ObjFile struct {
	// contains filtered or unexported fields
}

ObjFile is an object file representation, used to resolve addresses.

func New

func New() (*ObjFile, error)

New returns a global object allowing to resolve addresses to locations. This is a slingleton, and reports data only for self, the current program identified by os.Args[0]. When testing, go test tools do not embed symbols by default, you need to explicitly use `go test -o filename` else this will fail and not be able to get the info.

func (*ObjFile) Name

func (bof *ObjFile) Name() string

Name of the binary file.

func (*ObjFile) Resolve

func (bof *ObjFile) Resolve(contains string, addrs []uint64) (*Location, error)

Resolve returns the leaf source line for a location.

type Resolver

type Resolver interface {
	// Name of the resolver. Typically, binary file name.
	Name() string
	// Resolve some addresses to a location.
	// The contains string is used to find the leaf on which to aggregate data.
	// The addrs should be ordered with the leaf in first positions, and callers after.
	Resolve(contains string, addrs []uint64) (*Location, error)
}

Resolver resolves addresses to locations.

Jump to

Keyboard shortcuts

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