aboutsummaryrefslogtreecommitdiff
path: root/src/processor/testdata/test_app.cc
diff options
context:
space:
mode:
authormmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e>2006-12-07 20:46:54 +0000
committermmentovai <mmentovai@4c0a9323-5329-0410-9bdc-e9ce6186880e>2006-12-07 20:46:54 +0000
commit283fd392482f82d2d45921cd5f1d3a0d7368f52e (patch)
tree0b06da43f2b19f8da996e1dbf67e40f42ac1a6ce /src/processor/testdata/test_app.cc
parentTest data update following PDBSourceLineWriter change (#91). r=bryner (diff)
downloadbreakpad-283fd392482f82d2d45921cd5f1d3a0d7368f52e.tar.xz
Allow exception handler callbacks more flexibility (#81). r=bryner
- Provide an optional filter callback that gets triggered before attempting to write a dump, to give client code a chance to refuse handling early in the process. - Allow exceptions that are unhandled by Airbag (due to filter callback or dump callback return value, or failure to write a dump) to be passed to the previous handler or to the system. - In order to pass exceptions unhandled by the topmost Airbag handler to lower handlers, fix up the stacking of ExceptionHandler objects, and give each ExceptionHandler object its own thread (like the Mac implementation) to avoid deadlock. - Provide a dump_path argument to callbacks, as requested by developers and already implemented in the Mac handler. - Avoid calling c_str in exception handler code (#90). http://groups.google.com/group/airbag-dev/browse_thread/thread/4771825ced38a84c git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@79 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/processor/testdata/test_app.cc')
-rw-r--r--src/processor/testdata/test_app.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/processor/testdata/test_app.cc b/src/processor/testdata/test_app.cc
index da0ac197..e352e638 100644
--- a/src/processor/testdata/test_app.cc
+++ b/src/processor/testdata/test_app.cc
@@ -37,22 +37,29 @@
#include "client/windows/handler/exception_handler.h"
-void callback(const std::wstring &id, void *context, bool succeeded) {
+namespace {
+
+static bool callback(const wchar_t *dump_path, const wchar_t *id,
+ void *context, bool succeeded) {
if (succeeded) {
- printf("dump guid is %ws\n", id.c_str());
+ printf("dump guid is %ws\n", id);
} else {
printf("dump failed\n");
}
- exit(1);
+ fflush(stdout);
+
+ return succeeded;
}
-void CrashFunction() {
+static void CrashFunction() {
int *i = reinterpret_cast<int*>(0x45);
*i = 5; // crash!
}
+} // namespace
+
int main(int argc, char **argv) {
- google_airbag::ExceptionHandler eh(L".", callback, NULL, true);
+ google_airbag::ExceptionHandler eh(L".", NULL, callback, NULL, true);
CrashFunction();
printf("did not crash?\n");
return 0;