Crashpad is an open-source library initially developed by Google as a successor to the Google Breakpad library. It is used in popular software such as Google Chrome, and by companies such as Slack and Spotify.
For existing users of Crashpad, Backtrace has plug-and-play support. It has a robust architecture designed to allow for a high degree of customizability and stability even in the face of most obscure of software crashes.
For new users, Backtrace has prepared an enhanced fork of Crashpad, allowing easier integration with the service and additional functionality (for example, HTTPS submissions on Android).
Initial Integration
If you are a Windows and Visual Studio user, please review the Backtrace Visual Studio Extension Guide to simplify the integration of Crashpad into your new application. If you are a Windows and Visual Studio user with an existing application, you can use manual instructions in the Visual Studio section of that guide for a step-by-step guide to integrating with Visual Studio.
Advanced instructions are available at the Crashpad home page if you can't find what you're looking for or prefer to build Crashpad from source. Backtrace's fork of Crashpad is available on Github, which contains easy CMake build instructions and also hosts daily binary builds for Android, Linux, Windows, Mac and more. If you would like additional assistance, please don't hesitate to contact support@backtrace.io.
Update your application
Once Crashpad has been integrated into your application, using CMake or using prebuilt binaries, you'll need to specify the right options to StartHandler
to start it up, as you can see in the example app code for Windows, MacOS, Android and Linux.
Set the URL parameter
Change the url
parameter to StartHandler
. Your Backtrace Project Setting > Integration Guide > Crashpad will suggest the URL to use. Generally, it will be similar to
https://submit.backtrace.io/<instanceSubdomain>/<submissionToken>/minidump
Optional annotations
The annotations
map can be used to set additional attributes. Attributes allow you to embed relevant context into each crash report and can be any data point of your choosing. Examples include version
, directx.version
, graphics.card
, etc. More information on attributes can be found in the product guide.
File attachments
You can attach files to crash data (i.e. log files). To do so, add string formatted as such to the arguments
parameter of the StartHandler
function:
std::vector<std::string> arguments;
arguments.push_back(
"--attachment=FILE_PATH"
);
For example:
std::vector<std::string> arguments;
arguments.push_back(
"--attachment=C:/my_app/app_2018-02-30.log"
);
Crash handler parameter
handler
is a path to an external program responsible for generating and uploading dumps. This is the recommended for uploading crashes. On Windows, look for bin/crashpad_handler.exe
, which is suitable as a default crash handler. See below for a complete example.
handler
is executed once the application crashes, so it should be available under the specified path during its execution. That means that the handler should be bundled with the application if it's delivered to the end-users, and that its path should be relative or dynamically generated.
Example code
See Windows, macOS, Android and Linux for self-contained example code.
Manage Symbols
Symbols are required to determine source-code mapping of incoming crashes, including function name, source file, and line number. In order for Backtrace to effectively group and analyze your incoming crashes, you must upload application debug symbols.
To learn more about how to upload and manage symbols with Backtrace, please see the symbolication guide.
Visual Studio
If you are a Windows and Visual Studio user, please review the Backtrace Visual Studio Extension Guide to simplify the integration of Crashpad into your application.
Note: The instructions below are accurate, but please consider the extension to minimize the chance of configuration errors.
Obtain Crashpad
You can build Crashpad from source or download Backtrace-provided versions of the library.
Note for Windows (x86): The Visual C++ Redistributable for Visual Studio 2015 might be required if you have a new OS installation and don't have an IDE installed. Make sure to install the following runtime redistributable files for BacktraceCrashpadWindows.dll
:
KERNEL32.dll MSVCP140.dll VCRUNTIME140.dll api-ms-win-crt-runtime-l1-1-0.dll api-ms-win-crt-string-l1-1-0.dll api-ms-win-crt-heap-l1-1-0.dll api-ms-win-crt-stdio-l1-1-0.dll api-ms-win-crt-time-l1-1-0.dll api-ms-win-crt-filesystem-l1-1-0.dll ADVAPI32.dll
Build from source
It is always possible to build Crashpad from source. In order to do this, please see the Backtrace fork build guide. Backtrace added CMake build scripts, making it easier to build than the original Google fork. If you want to build the Google fork regardless, you can find the instructions here.
Download built libraries
Backtrace provides builds of Crashpad. It is recommended to use the stable version. The latest stable releases of Backtrace's Crashpad fork are available here and the Backtrace fork nightly builds can be found here.
Integrate Crashpad
Once you have built Crashpad or downloaded the pre-built libraries, you will now need to integrate the library into your application. The library is statically linked into your project, so you will not need to distribute any additional projects.
There are two versions of Crashpad
provided in the Backtrace archive.
lib_mt
contains the Crashpad libraries built with the /MT
switch for static linking. lib_md
contains the Crashpad libraries built with the /MD
switch for dynamic linking.
Use the appropriate version for your application.
Integrate into your build process
This section outlines how to import the Crashpad
library into your Visual Studio project.
Add the header files
First, you'll need to add the Crashpad directory in the include path for your application. The header files for Crashpad in the provided .zip
file are in the include directory.
Go to the project configuration menu (Project
Properties
VC++ Directories
) and set Include Directories
to point to the include
and include\mini_chromium
folders of the extracted archive, as shown below.

Add the libraries
Static Linking
Next, you'll need to add the relevant release path (see the table above) to your Library Directories
(Project
Properties
VC++ Directories
). For example, if I am deploying a 64-bit Windows application, then after downloading the appropriate Crashpad build, the lib_mt
sub-directory is added to Library Directories
.

Once that is done, you'll need to add the actual set of static libraries for Crashpad
. Navigate to your linker input settings (Project
Properties
Linker
Input
), and add client.lib;util.lib;base.lib
as additional dependencies. See the screenshot below for an example.

Remember to use the build of the Crashpad
library that corresponds with your build configuration. For example, if you are building a 32-bit Debug build, then ensure that you are referencing the .lib
files from the 32-bit debug build. If you encounter errors involving ITERATOR_DEBUG_LEVEL
, then there is likely a mismatch between your build configuration and the build of Crashpad
. In order to change the build settings, go to Build
Configuration Manager
then change your Active solution configuration
.
Dynamic Linking
If you are using dynamic linking (the \MD
flag), then make sure to use the lib_md
sub-directory rather than lib_mt
. For example, crashpad\lib_md
rather than crashpad\lib_mt
.

Verify Linker Settings
Static Linking
Last but not least, ensure that you have code generation runtime settings set to a mode compatible with static libraries, such as Multi-threaded (/MT)
. Go to Project
Properties
C/C++
Code Generation
and update the Runtime Library
setting.

Dynamic Linking
If you are using dynamic linking, then ensure that you use the /MD
option instead of /MT
.
Debug builds
If you are building in debug mode, ensure that you use the debug version of the linking compiler switches (/MDd
and /MTd
):

Ensure symbol generation
It is required to upload symbols into Backtrace for intelligent deduplication and classification. This section explains how to enable debug symbols for your application.
Go to Project
Properties
Linker
and update the Generate Debug Info
setting. You'll want to set it to either Generate Debug Information (/DEBUG)
or Generate Debug Information optimized for sharing and publishing (/DEBUG:FULL)
. The /DEBUG
option is recommended if you would like to avoid the possibility of a performance impact.

With this setting, a .pdb
file will be generated for your application in the build output directory. You are able to upload .sym
, .pdb
and archive files containing .pdb
or .sym
files into Backtrace manually or through the command line. It is also possible to hook up Visual Studio to automatically upload symbols as they are generated. You should be able to send crash reports at this point. Make sure that you've uploaded your symbols (click on Symbols
tab under the Project Configuration
page).
For more details, please refer to the symbolication guide.
Send crash reports
Congratulations, now you're ready to integrate Crashpad into your application. In order to do this, you'll need to add the code from the section Example code
above.
Finish
At this point, crashes should be automatically submitted into Backtrace. As crashes generate, refresh the Project
page of the associated project to see faults in real-time.
Additional features of Backtrace fork
Send reports using EXCEPTION_POINTERS in Windows
A new function has been added to the CrashpadClient
class. It's useful, for example, when dealing with vectored exceptions. Additionally, it does not require that the process must end (the exception may be handled).
static void DumpWithoutCrashWithException(EXCEPTION_POINTERS* pointer);
Windows 7, Windows Server 2008 R2, and Windows Server 2012 support (adding TLS 1.1/1.2 support)
The default Crashpad crash handler binary uses WinHttp to upload crashes. On those systems, TLS 1.1 and TLS 1.2 are in the default protocol set, and only TLS 1.0, and SSL 3.0 are available by default, which are not accepted by Backtrace.
This should be fixed by KB 3140245, but you may want to add them to the default list manually via the registry. We suggest doing it in your application installer.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp]
"DefaultSecureProtocols"=dword:00000a00
Additional Documentation
Additional documentation is available at the Crashpad Website. For more information on the crashpad_handler
, please see crashpad_handler.md.
If you're still encountering issues, contact us at support@backtrace.io.