68 lines
2.3 KiB
Plaintext
68 lines
2.3 KiB
Plaintext
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 https://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.
|