|
GettingStartedWithBreakpad
Getting Started With Breakpad.
Featured IntroductionBreakpad is a library and tool suite that allows you to distribute an application to users with compiler-provided debugging information removed, record crashes in compact "minidump" files, send them back to your server, and produce C and C++ stack traces from these minidumps. Breakpad can also write minidumps on request for programs that have not crashed. Breakpad is currently used by Google Chrome, Firefox, Google Picasa, Camino, Google Earth, and other projects.
Breakpad has three main components:
The minidump file formatThe minidump file format is similar to core files but was developed by Microsoft for its crash-uploading facility. A minidump file contains:
Breakpad uses Windows minidump files on all platforms, instead of the traditional core files, for several reasons:
Overview/Life of a minidumpA minidump is generated via calls into the Breakpad library. By default, initializing Breakpad installs an exception/signal handler that writes a minidump to disk at exception time. On Windows, this is done via SetUnhandledExceptionFilter(); on OS X, this is done by creating a thread that waits on the Mach exception port; and on Linux, this is done by installing a signal handler for various exceptions like SIGILL, SIGSEGV etc. Once the minidump is generated, each platform has a slightly different way of uploading the crash dump. On Windows & Linux, a separate library of functions is provided that can be called into to do the upload. On OS X, a separate process is spawned that prompts the user for permission, if configured to do so, and sends the file. TerminologyIn-process vs. out-of-process exception handling - it's generally considered that writing the minidump from within the crashed process is unsafe - key process data structures could be corrupted, or the stack on which the exception handler runs could have been overwritten, etc. All 3 platforms support what's known as "out-of-process" exception handling. Integration overviewBreakpad Code OverviewAll the client-side code is found by visiting the Google Project at http://code.google.com/p/google-breakpad. The following directory structure is present in the src directory:
(Among other directories) Build process specifics(symbol generation)This applies to all platforms. Inside src/tools/{platform}/dump_syms is a tool that can read debugging information for each platform (e.g. for OS X/Linux, DWARF and STABS, and for Windows, PDB files) and generate a Breakpad symbol file. This tool should be run on your binary before it's stripped(in the case of OS X/Linux) and the symbol files need to be stored somewhere that the minidump processor can find. There is another tool, symupload, that can be used to upload symbol files if you have written a server that can accept them. |