diff options
author | Shauren <shauren.trinity@gmail.com> | 2018-08-29 23:59:24 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2018-08-29 23:59:24 +0200 |
commit | 62db1fb683c13b8dde0cc359564e090e0594658f (patch) | |
tree | 7259cff0f62d61d590e4e1b17bce3751ef3821e4 /src/common/Debugging/WheatyExceptionReport.cpp | |
parent | 704870496f672f628635e45a1cec98a485d86c28 (diff) |
Core/CrashHandler: Include assertion messages in crash reports
Diffstat (limited to 'src/common/Debugging/WheatyExceptionReport.cpp')
-rw-r--r-- | src/common/Debugging/WheatyExceptionReport.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/common/Debugging/WheatyExceptionReport.cpp b/src/common/Debugging/WheatyExceptionReport.cpp index f1adbb8505c..ff8ec2629f1 100644 --- a/src/common/Debugging/WheatyExceptionReport.cpp +++ b/src/common/Debugging/WheatyExceptionReport.cpp @@ -22,6 +22,7 @@ #include "WheatyExceptionReport.h" #include "Common.h" +#include "Errors.h" #include "GitRevision.h" #include <algorithm> @@ -168,8 +169,21 @@ PEXCEPTION_POINTERS pExceptionInfo) info.ExceptionPointers = pExceptionInfo; info.ThreadId = GetCurrentThreadId(); + MINIDUMP_USER_STREAM additionalStream = {}; + MINIDUMP_USER_STREAM_INFORMATION additionalStreamInfo = {}; + + if (pExceptionInfo->ExceptionRecord->ExceptionCode == EXCEPTION_ASSERTION_FAILURE && pExceptionInfo->ExceptionRecord->NumberParameters > 0) + { + additionalStream.Type = CommentStreamA; + additionalStream.Buffer = reinterpret_cast<PVOID>(pExceptionInfo->ExceptionRecord->ExceptionInformation[0]); + additionalStream.BufferSize = strlen(reinterpret_cast<char const*>(pExceptionInfo->ExceptionRecord->ExceptionInformation[0])) + 1; + + additionalStreamInfo.UserStreamArray = &additionalStream; + additionalStreamInfo.UserStreamCount = 1; + } + MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), - m_hDumpFile, MiniDumpWithIndirectlyReferencedMemory, &info, 0, 0); + m_hDumpFile, MiniDumpWithIndirectlyReferencedMemory, &info, &additionalStreamInfo, 0); CloseHandle(m_hDumpFile); } @@ -501,6 +515,11 @@ PEXCEPTION_POINTERS pExceptionInfo) Log(_T("Exception code: %08X %s\r\n"), pExceptionRecord->ExceptionCode, GetExceptionString(pExceptionRecord->ExceptionCode)); + if (pExceptionRecord->ExceptionCode == EXCEPTION_ASSERTION_FAILURE && pExceptionRecord->NumberParameters >= 2) + { + pExceptionRecord->ExceptionAddress = reinterpret_cast<PVOID>(pExceptionRecord->ExceptionInformation[1]); + Log(_T("Assertion message: %s\r\n"), pExceptionRecord->ExceptionInformation[0]); + } // Now print information about where the fault occured TCHAR szFaultingModule[MAX_PATH]; |