diff options
author | hansl@google.com <hansl@google.com@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2010-05-13 21:00:43 +0000 |
---|---|---|
committer | hansl@google.com <hansl@google.com@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2010-05-13 21:00:43 +0000 |
commit | bcf885c8079b1742bfd93de722afceb26237ce4f (patch) | |
tree | fe9e624dfbc969e41f8008f4dddd2a7aabe7750a /src/client/windows/handler/exception_handler.cc | |
parent | Moved exception_handler_test to the more aptly named exception_handler_death_... (diff) | |
download | breakpad-bcf885c8079b1742bfd93de722afceb26237ce4f.tar.xz |
Added a death test for the pure virtual function call.
Added a test for the minidump generated by a pure virtual function call.
Changed the pure virtual function call handler so that it creates a minidump with Exception info and a stack.
Review URL: http://codereview.chromium.org/2050013
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@597 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client/windows/handler/exception_handler.cc')
-rw-r--r-- | src/client/windows/handler/exception_handler.cc | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/client/windows/handler/exception_handler.cc b/src/client/windows/handler/exception_handler.cc index a877b2f1..d27ddcc1 100644 --- a/src/client/windows/handler/exception_handler.cc +++ b/src/client/windows/handler/exception_handler.cc @@ -550,6 +550,8 @@ void ExceptionHandler::HandleInvalidParameter(const wchar_t* expression, // static void ExceptionHandler::HandlePureVirtualCall() { + // This is an pure virtual funciton call, not an exception. It's safe to + // play with sprintf here. AutoExceptionHandler auto_exception_handler; ExceptionHandler* current_handler = auto_exception_handler.get_handler(); @@ -557,6 +559,26 @@ void ExceptionHandler::HandlePureVirtualCall() { memset(&assertion, 0, sizeof(assertion)); assertion.type = MD_ASSERTION_INFO_TYPE_PURE_VIRTUAL_CALL; + // Make up an exception record for the current thread and CPU context + // to make it possible for the crash processor to classify these + // as do regular crashes, and to make it humane for developers to + // analyze them. + EXCEPTION_RECORD exception_record = {}; + CONTEXT exception_context = {}; + EXCEPTION_POINTERS exception_ptrs = { &exception_record, &exception_context }; + RtlCaptureContext(&exception_context); + exception_record.ExceptionCode = STATUS_NONCONTINUABLE_EXCEPTION; + + // We store pointers to the the expression and function strings, + // and the line as exception parameters to make them easy to + // access by the developer on the far side. + exception_record.NumberParameters = 3; + exception_record.ExceptionInformation[0] = + reinterpret_cast<ULONG_PTR>(&assertion.expression); + exception_record.ExceptionInformation[1] = + reinterpret_cast<ULONG_PTR>(&assertion.file); + exception_record.ExceptionInformation[2] = assertion.line; + bool success = false; // In case of out-of-process dump generation, directly call // WriteMinidumpWithException since there is no separate thread running. @@ -564,10 +586,11 @@ void ExceptionHandler::HandlePureVirtualCall() { if (current_handler->IsOutOfProcess()) { success = current_handler->WriteMinidumpWithException( GetCurrentThreadId(), - NULL, + &exception_ptrs, &assertion); } else { - success = current_handler->WriteMinidumpOnHandlerThread(NULL, &assertion); + success = current_handler->WriteMinidumpOnHandlerThread(&exception_ptrs, + &assertion); } if (!success) { |