Crashpad with File Attachments

Backtrace has some exciting news for engineers who use the Crashpad library to generate and submit minidump files. Not only does Backtrace now provide binaries for Crashpad to be used on Windows (see the August Product Update), but we have added commonly requested capabilities to support submission of file attachments. File attachments will give you fast and easy access to critical contextual information that will help with debugging. Before this release, engineers who use Crashpad to generate and submit dump files have needed to compile and customize the source code to submit crash reports to a solution like Backtrace. Let’s explore these exciting items in more depth.

Crashpad Binaries for Windows

In case you missed it, in late August we released binaries for Crashpad on Windows (64 and 32 bit). By using these binaries, you can save the hours and days of effort you used to spend setting up your environment to compile the library for use in your applications.

The binaries are usable in your debug or release builds, and are provided for the recent stable as well as daily interim builds. This allows you to quickly build your application with the most recent stable release, or try out the latest and greatest new features and bug fixes before they are released to stable. Check out to download what you need.

These binaries include some new features we developed that aren’t yet provided in the master branch, specifically built-in support for attachment and submission of file attachments. This, and other new capabilities, will be developed and fully supported by Backtrace to improve your use of Crashpad. Over time, we anticipate these features being incorporated into the master branch and being fully supported by the Crashpad community.

File Attachments

Built-in support for file attachments has been a common request from our customers. Why? The act of debugging requires detailed observability into the system state at the time the issue occurred. Included in observability are context clues so that the engineer doing the debugging can know what happened and what was going on in the lead-up to the issue. Engineers use a few different techniques to capture this context. Most often, we’ll see system or custom metadata (attributes) set so that engineers can understand things like operating system, chipset, etc. This has been a great tool for our customers, as they are able to query and group by these custom attributes

While attributes have lots of value, there is more context out there, like a log files or config files that explain happened leading up to the crash, and what kind of settings the system had when the crash was initiated.

Sample Code

To provide you with access to additional files, we have implemented a new handler to make file attachments just as simple as setting up any other piece of metadata to come alongside the crash. Here’s what it looks like:
bool StartHandlerForBacktrace(
const base::FilePath& handler,
const base::FilePath& database,
const base::FilePath& metrics_dir,
const std::string& url,
const std::map<std::string, std::string>& annotations,
const std::vector& arguments,
const std::map<std::string, std::string>& file_attachments,
bool restartable,
bool asynchronous_start

This new handler is very similar to StartHandler, with the exception of the file_attachments parameter. file_attachments is a map of attachment namepath, allowing convenient inclusion of file attachments (i.e. the log file) with the crash dump.

The file_attachments parameter can be used as follows:
std::map<std::string, std::string> files = {
{ “2018-09-26.log”, “C:/my_app/app_2018-09-26.log” }

In this case, the application with send an attachment named “2018-09-26.log” and it will get the file from the C:/my_app/app_2018-09-26.log file that exists on the client.

If you do not want to use the custom handler, you can also use the vanilla StartHandler function, and add them to the arguments parameter. To achieve the effect identical to that of the example above, the added parameter would look as follows:

The argument format is –attachment=attachment_NAME=FILE_PATH.

File Attachments in the Console

In Backtrace, the log file will then appear as an attachment alongside the crash.

With support for attachment and submission of file attachments built into the Crashpad library binaries, it’s now even faster and easier to set up your environment for your applications and integrate with Backtrace for crash management and resolution. We continue to listen for ways our users want to use our platform and this is the latest example of a successful customer collaboration.  

By | 2019-11-03T18:24:05+00:00 November 1st, 2018|Announcements, Backtrace, Features|