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
This commit is contained in:
mmentovai 2006-12-07 20:46:54 +00:00
parent 94f07040ce
commit 283fd39248
9 changed files with 22230 additions and 21566 deletions

View file

@ -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;