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

Binary file not shown.

File diff suppressed because one or more lines are too long

View file

@ -7,19 +7,19 @@ Crash reason: EXCEPTION_ACCESS_VIOLATION
Crash address: 0x45
Thread 0 (crashed)
0 test_app.exe!CrashFunction() [test_app.cc : 51 + 0x3]
eip = 0x0040208e esp = 0x0012feec ebp = 0x0012fef0 ebx = 0x7c80abc1
esi = 0x00000002 edi = 0x00000a28 eax = 0x00000045 ecx = 0x0012fefc
edx = 0x7c90eb94 efl = 0x00010246
1 test_app.exe!main [test_app.cc : 56 + 0x4]
eip = 0x004020df esp = 0x0012fef8 ebp = 0x0012ff70
0 test_app.exe!`anonymous namespace'::CrashFunction [test_app.cc : 56 + 0x3]
eip = 0x00403f6e esp = 0x0012fe8c ebp = 0x0012fe90 ebx = 0x7c80abc1
esi = 0x00000002 edi = 0x00000a28 eax = 0x00000045 ecx = 0x0012fe9c
edx = 0x0042ac60 efl = 0x00010246
1 test_app.exe!main [test_app.cc : 63 + 0x4]
eip = 0x00403ed0 esp = 0x0012fe98 ebp = 0x0012ff70
2 test_app.exe!__tmainCRTStartup [crt0.c : 318 + 0x11]
eip = 0x0040395c esp = 0x0012ff78 ebp = 0x0012ffc0
eip = 0x00405096 esp = 0x0012ff78 ebp = 0x0012ffc0
3 kernel32.dll!BaseProcessStart + 0x22
eip = 0x7c816fd7 esp = 0x0012ffc8 ebp = 0x0012fff0
Loaded modules:
0x00400000 - 0x0042afff test_app.exe ??? (main)
0x00400000 - 0x0042bfff test_app.exe ??? (main)
0x59a60000 - 0x59b00fff dbghelp.dll 5.1.2600.2180
0x76390000 - 0x763acfff imm32.dll 5.1.2600.2180
0x76bf0000 - 0x76bfafff psapi.dll 5.1.2600.2180

File diff suppressed because it is too large Load diff

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;