Documentation ¶
Overview ¶
Package breakpad supplies two interfaces: Supplier and SymbolTable. The SymbolTable has one provided implementation, which parses the Breakpad symbol file format, documented here:
<http://code.google.com/p/google-breakpad/wiki/SymbolFiles>.
There is no provided Supplier implementation as most clients will likely use on-disk files. However, an interface is provided for those that need to RPC to a backend to get symbol file data.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseAddress ¶
ParseAddress converts a hex string in either 0xABC123 or just ABC123 form into an integer.
Types ¶
type AnnotatedFrame ¶
type AnnotatedFrame struct { Address uint64 Module SupplierRequest }
AnnotatedFrame is one stack frame that also has information about the module in which the instruction resides.
type AnnotatedFrameService ¶
type AnnotatedFrameService interface { // Returns a callstack of AnnotatedFrames for a given metadata key in // the specified crash report. GetAnnotatedFrames(ctx context.Context, reportID, key string) ([]AnnotatedFrame, error) }
AnnotatedFrameService is an interface to a backend that can provide AnnotatedFrames for a given crash report identifier and crash key. The crash key is some field in the crash report that contains a stack that is to be returned.
type ModuleInfoService ¶
type ModuleInfoService interface { // Returns a list of modules a specific product and version. GetModulesForProduct(ctx context.Context, product, version string) ([]SupplierRequest, error) }
ModuleInfoService is an interface that describes a way to look up module information for a specific product and version.
type Supplier ¶
type Supplier interface { // FilterAvailableModules allows Supplier to filter down a list of input modules // if it has apriori knowledge of which SymbolTables it can return. This // potentially eliminates unnecessary queries to a backend. If the Supplier does // not have this feature, just return the input slice. FilterAvailableModules(ctx context.Context, modules []SupplierRequest) []SupplierRequest // TableForModule queries the Supplier for a given SymbolTable asynchronously. // Returns a channel on which the caller can receive the response. TableForModule(ctx context.Context, request SupplierRequest) <-chan SupplierResponse }
Supplier is an interface that can take a SymbolRequest and furnish a SymbolTable in response, via a SupplierResponse.
type SupplierRequest ¶
type SupplierRequest struct { // The debug file name of a code module for which symbol information is requested. ModuleName string // The unique identifier for a version of the named module. Identifier string }
SupplierRequest is sent to a Supplier to get a SymbolTable, via a SupplierResponse.
type SupplierResponse ¶
type SupplierResponse struct { // Error is set if the SupplierRequest could not be serviced successuflly. Error error // The table found in response to the SupplierRequest. Table SymbolTable }
SupplierResponse is returned by a Supplier in response to a SupplierRequest.
type Symbol ¶
type Symbol struct { // The function's unmangled name. Never empty. Function string // The file in which the function was implemented. Can be empty. File string // The 1-based line at which an instruction occurred. Can be 0 for no line // information. Line int }
Symbol stores the name of and potentially debug information about a function or instruction in a SymbolTable.
type SymbolTable ¶
type SymbolTable interface { // ModuleName returns the debug file name for which this is a symbol table. ModuleName() string // Identifier returns the unique debug identifier for this module. Identifier() string // String returns a huamn-friendly representation of the module. String() string // SymbolForAddress takes a program counter address, relative to the base // address of the module, and returns the Symbol to which it relates. If // the address is not within the module or a symbol cannot be found, returns // nil. SymbolForAddress(address uint64) *Symbol }
SymbolTable provides a way to query information about a code module and to lookup symbols by addresses in the module.
func NewBreakpadSymbolTable ¶
func NewBreakpadSymbolTable(data string) (SymbolTable, error)
NewBreakpadSymbolTable takes the data of a Breakpad symbol file, parses it, and returns a SymbolTable. If the data was malformed or could not be parsed, returns an error.