Installation

Get C++ error and crash reporting with Raygun using Google Breakpad.

Breakpad 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.

See the Git repository for more information on Google Breakpad

Setup instructions

Clone the GitHub repository https://github.com/google/breakpad and link the following directories for your platform to your project:

breakpad/src/client/{platform}

breakpad/src/client/*.h

breakpad/src/client/*.cc

breakpad/src/common/{platform}

breakpad/src/common/*.h

breakpad/src/common/*.cc

You’ll then need to enable Breakpad in your application by instantiating the ExceptionHandler object and passing it the directory path (_dump_path_) where minidump files will be written to.

#include "exception_handler.h"

google_breakpad::ExceptionHandler *pHandler = new google_breakpad::ExceptionHandler(L"_dump_path_", 0, minidump_callback, 0, google_breakpad::ExceptionHandler::HANDLER_ALL, MiniDumpNormal, L"", 0);

The define a callback for when minidumps have been written and use the CrashReportSender class to post minidumps files to Raygun.

#include "crash_report_sender.h"

bool minidump_callback(const wchar_t* dump_path, const wchar_t* minidump_id, void* context, EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion, bool succeeded)

{
  google_breakpad::CrashReportSender sender(L"crash.checkpoint");

  std::wstring filename = L"_dump_path_";
  filename += L"\\";
  filename += minidump_id;
  filename += L".dmp";

  std::map<std::wstring, std::wstring> files;
  files.insert(std::make_pair(filename, filename));

  // At this point you may include custom data to be part of the crash report.
  std::map<std::wstring, std::wstring> userCustomData;
  userCustomData.insert(std::make_pair(L"desc", L"Hello World"));

  sender.SendCrashReport(L"https://api.raygun.com/entries/breakpad?apikey=paste_your_api_key_here", userCustomData, files, 0);

  return true;
}

We recommend raising a test exception from your application right now to test that everything is wired up correctly.

Upload application symbols

We provide the ability to for you to upload your application symbols in the form of PDB files or Breakpad’s SYM files. After you have uploaded the symbols, any minidumps processed will use these symbols for symbolicating their stack trace.

  1. Inside your Raygun dashboard, navigate to the ‘Application settings’ dropdown and select ‘Breakpad center‘:

    Raygun Breakpad center

  2. Drag and drop a “Release” mode PDB or previous generated Breakpad symbol file, or select a file to import to the Breakpad center. You can use the Breakpad tooling as part of your build toolchain to generate the symbol files yourself.

We also provide support for uploading individual SYM files automatically as part of your build or deployment process. This can be done by using cURL. For example:

curl -H "Host: app.raygun.com" -H "Authorization: Basic <token>" --form "SymbolFile=@${PDB or SYM filepath}" https://app.raygun.com/upload/breakpadsymbols/${APP_ID}
  • token should be replaced with a basic auth token which can be created by Base64 encoding your Raygun account credentials in the following format (make sure not to forget the colon between them): username:password. We recommend having a separate user account with a strong password for managing this access.
  • APP_ID is available in the URL of your app in the Raygun dashboard.

Note: At this time we do not support uploading zip files, each SYM file will need to be uploaded separately.