diff options
author | siggi@chromium.org <siggi@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2010-03-26 16:03:58 +0000 |
---|---|---|
committer | siggi@chromium.org <siggi@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2010-03-26 16:03:58 +0000 |
commit | 18dd9d0104d75e970723fcf381df1a6fd23b56c2 (patch) | |
tree | a0963ace82bef8fee62795e15b5ddb1f847c5ba2 /src | |
parent | Add omitted newline to warning message in StabsReader::SymbolString. (diff) | |
download | breakpad-18dd9d0104d75e970723fcf381df1a6fd23b56c2.tar.xz |
Fix HandleInvalidParameter to provide a locally created exception record for the minidump.
Having an exception of interest makes the resultant minidumps look just like
crash dumps, in that the processor can identify the "crashing" tread.
This means such minidumps can be classified by the stack signature, in contrast to the current state of things, in which all such dumps get lumped on a single pile.
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@557 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src')
-rw-r--r-- | src/client/windows/handler/exception_handler.cc | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/client/windows/handler/exception_handler.cc b/src/client/windows/handler/exception_handler.cc index be9e5eb2..0cc7af52 100644 --- a/src/client/windows/handler/exception_handler.cc +++ b/src/client/windows/handler/exception_handler.cc @@ -28,7 +28,6 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <ObjBase.h> - #include <cassert> #include <cstdio> @@ -482,16 +481,37 @@ void ExceptionHandler::HandleInvalidParameter(const wchar_t* expression, assertion.line = line; assertion.type = MD_ASSERTION_INFO_TYPE_INVALID_PARAMETER; + // 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_INVALID_CRUNTIME_PARAMETER; + + // 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. 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) { |