Raygun for C++ using Breakpad

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 add the client-side source (src/client/) for your platform to your project.

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 your application symbols for Breakpad

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.

Documentation missing?

If we don't have documentation about your desired topic, send us a message and we'll create it for you.