breakpad

package
v0.0.0-...-d046166 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2020 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package breakpad processes minidump crash reports created by Breakpad.

See https://chromium.googlesource.com/breakpad/breakpad/ for more details about Breakpad.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadSymbols

func DownloadSymbols(url, destDir string, files SymbolFileMap) (created int, err error)

DownloadSymbols downloads url (see GetSymbolsURL) and extracts the symbol files specified in files to destDir. The number of files that were created is returned.

func GetDebugBinaryPath

func GetDebugBinaryPath(buildRoot, path string) string

GetDebugBinaryPath returns the absolute path under buildRoot (e.g. "/build/lumpy") where the debug binary should be located for path (e.g. "/bin/grep").

func GetMinidumpReleaseInfo

func GetMinidumpReleaseInfo(f *os.File) (string, error)

GetMinidumpReleaseInfo returns the contents of /etc/lsb-release if it is present in f, a minidump file. The Linux version of Breakpad includes this information in crashes.

func GetSymbolFilePath

func GetSymbolFilePath(dir, base, id string) string

GetSymbolFilePath returns the path within symbol directory dir where the Breakpad symbol file for the binary with basename base and ModuleInfo.ID id should be located.

func GetSymbolsURL

func GetSymbolsURL(builderPath string) string

GetSymbolsURL returns the Cloud Storage URL of the .tar.xz file containing Breakpad debug symbols for builderPath (e.g. "cave-release/R65-10286.0.0").

func IsMinidump

func IsMinidump(r io.Reader) (bool, error)

IsMinidump returns true if r (which should be at the beginning of a file) is a minidump file.

func ReadCrashReport

func ReadCrashReport(r io.Reader) (pairs map[string]string, dumpOffset, dumpLen int, err error)

ReadCrashReport reads a Chrome OS crash report file written by Chrome. These files are typically parsed by crash-reporter and use a custom format consisting of repeated colon-separated (key, decimal-value-length, value-data) sequences:

<key>:<decimal-value-length>:<value-data><key>:...

Breakpad minidump data is typically included, and the data's offset and length within the reader is returned separately without being loaded into memory. All other key/value pairs are returned via a map.

See https://chromium.googlesource.com/chromium/src/+/master/components/crash/content/app/breakpad_linux.cc for more details.

Types

type ModuleInfo

type ModuleInfo struct {
	// OS identifies the operating system on which the executable or shared library was intended to run.
	OS string
	// Arch indicates the processor architecture the executable or shared library contains machine code for.
	Arch string
	// ID is an opaque sequence of hexadecimal digits that identifies the exact executable or library whose
	// contents the symbol file describes.
	ID string
	// Name contains the base name (the final component of the directory path) of the executable or library.
	Name string
}

ModuleInfo contains data from a Breakpad symbol file's MODULE record. See https://chromium.googlesource.com/breakpad/breakpad/+/master/docs/symbol_files.md#records-1 for details.

func WriteSymbolFile

func WriteSymbolFile(binPath, outDir string) (*ModuleInfo, error)

WriteSymbolFile writes a Breakpad symbols file for binPath, a binary file with debugging symbols, to the Breakpad-expected location within outDir. Breakpad's dump_syms program must be present.

type SymbolFileMap

type SymbolFileMap map[string]string

SymbolFileMap maps from the full paths of binaries (as absolute on-device paths, e.g. "/usr/lib64/libbase-core-395517.so") to the corresponding symbol file IDs wanted by minidump_stackwalk (i.e. breakpad.ModuleInfo.ID).

func WalkMinidump

func WalkMinidump(path, symDir string, w io.Writer) (missing SymbolFileMap, err error)

WalkMinidump writes a human-readable representation of the stack trace contained within the minidump file at path to w. symDir is a directory containing symbol files that will be used to make a best-effort attempt symbolize the trace. Binaries with missing symbol files are returned.

Minidump's minidump_stackwalk program must be present, and symDir should follow the <module>/<ID>/<module>.sym layout directory expected by it, e.g. libc-2.23.so/7219A63C9901FA247C197BCFED143B110/libc-2.23.so.sym.

Jump to

Keyboard shortcuts

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