Skip to content

Files

Latest commit

6ca5752 · Feb 10, 2015

History

History
This branch is 44078 commits behind msys2/MINGW-packages:master.

mingw-w64-breakpad-svn

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Jan 14, 2015
Feb 10, 2015
Jan 14, 2015
Jan 14, 2015
Getting Started with Breakpad
=============================

Run the sample executable crash_generation_app.exe click Menu->Server->Start.
This is now the 'Server'.

Run the executable AGAIN (a second instance). This is now the 'Client'.  You
should see a message like "Client connected" in the Server.  In the Client,
click Menu->Client->Deref Zero

The client should crash, and you should see a message like "Client requested
dump" in the server.

In c:\dumps you now have a .dmp file.  You can inspect that with
minidump_stackwalk or open in it WinDbg.

Integrating BreakPad into your application
==========================================

See http://code.google.com/p/google-breakpad/wiki/WindowsClientIntegration

In your main() function (or equivalent), before your program does any real work,
add the following:

#include <google_breakpad/client/windows/handler/exception_handler.h>

int main() {
   ...

   static wstring prod = get_myapp_name();
   static wstring ver = get_myapp_version();
   static wstring subver = get_myapp_subversion();

   static int google_custom_count = 3;
   static google_breakpad::CustomInfoEntry google_custom_entries[] = {
     google_breakpad::CustomInfoEntry(L"prod", prod.c_str()),
     google_breakpad::CustomInfoEntry(L"ver", ver.c_str()),
     google_breakpad::CustomInfoEntry(L"subver", subver.c_str()),
   };

   google_breakpad::CustomClientInfo custom_info = {google_custom_entries,
     google_custom_count};

   google_breakpad::ExceptionHandler * google_pad = new
     google_breakpad::ExceptionHandler(
       L"C:\\dumps\\", // dump path
       NULL, // filter callback
       NULL, // MinidumpCallback,
       NULL, // callback context
       google_breakpad::ExceptionHandler::HANDLER_ALL, // handler types
       MiniDumpNormal, // or for a larger dump: MiniDumpWithFullMemory
       NULL, // pipe name
       &custom_info); // custom info

    ...
 }

If you define MinidumpCallback, the signature is like so: bool
MinidumpCallback(const wchar_t* dump_path, const wchar_t* minidump_id, void*
context, EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion, bool
succeeded);

The callback is the point where you could spawn another program that tells the
user that the program has crashed etc.

The above code will generate dumps in the c:\dumps folder.  MAKE SURE the folder
is created first.