forked from msys2/MINGW-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
breakpad-svn: Install headers and sample
Install windows-specific headers Install sample so correct installation of library and headers can be validated by trying to build it by running make in /mingw(32|64)/share/doc/breakpad/sample
- Loading branch information
1 parent
aa26c35
commit 25ca0de
Showing
3 changed files
with
137 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
CXX=g++ | ||
WINDRES=windres | ||
CXXFLAGS=-DUNICODE -D_UNICODE | ||
LDFLAGS=-mwindows -municode | ||
|
||
OBJS=abstract_class.o crash_generation_app.o resource.o | ||
LIBS=-lbreakpad_client | ||
|
||
all: crash_generation_app.exe | ||
|
||
resource.o: resource.rc small.ico crash_generation_app.ico | ||
$(WINDRES) resource.rc $@ | ||
|
||
crash_generation_app.exe: $(OBJS) | ||
$(CXX) -o $@ $(OBJS) $(LIBS) $(LDFLAGS) | ||
|
||
clean: | ||
${RM} ${OBJS} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
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. |