aboutsummaryrefslogtreecommitdiff
path: root/src/common/Debugging/WheatyExceptionReport.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2018-03-10 15:15:41 +0100
committerShauren <shauren.trinity@gmail.com>2018-03-10 15:51:57 +0100
commit901eed782851340a1ef8b5d2e763efc24970407a (patch)
treee46d22de7d5d20407cb5c25fbf5b9474eb357b04 /src/common/Debugging/WheatyExceptionReport.cpp
parent5947c54d685dc7a6ca36201a88aceed357d9271a (diff)
Core/CrashHandler: Fixed generating crash logs from CRT debug assertions
(cherry picked from commit abdf6479ddbf42c8b53cb943c54203211ceb0691)
Diffstat (limited to 'src/common/Debugging/WheatyExceptionReport.cpp')
-rw-r--r--src/common/Debugging/WheatyExceptionReport.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/common/Debugging/WheatyExceptionReport.cpp b/src/common/Debugging/WheatyExceptionReport.cpp
index 61992c9b487..f1adbb8505c 100644
--- a/src/common/Debugging/WheatyExceptionReport.cpp
+++ b/src/common/Debugging/WheatyExceptionReport.cpp
@@ -58,6 +58,7 @@ inline LPTSTR ErrorMessage(DWORD dw)
TCHAR WheatyExceptionReport::m_szLogFileName[MAX_PATH];
TCHAR WheatyExceptionReport::m_szDumpFileName[MAX_PATH];
LPTOP_LEVEL_EXCEPTION_FILTER WheatyExceptionReport::m_previousFilter;
+_invalid_parameter_handler WheatyExceptionReport::m_previousCrtHandler;
HANDLE WheatyExceptionReport::m_hReportFile;
HANDLE WheatyExceptionReport::m_hDumpFile;
HANDLE WheatyExceptionReport::m_hProcess;
@@ -78,6 +79,7 @@ WheatyExceptionReport::WheatyExceptionReport() // Constructor
{
// Install the unhandled exception filter function
m_previousFilter = SetUnhandledExceptionFilter(WheatyUnhandledExceptionFilter);
+ m_previousCrtHandler = _set_invalid_parameter_handler(WheatyCrtHandler);
m_hProcess = GetCurrentProcess();
stackOverflowException = false;
alreadyCrashed = false;
@@ -98,6 +100,8 @@ WheatyExceptionReport::~WheatyExceptionReport()
{
if (m_previousFilter)
SetUnhandledExceptionFilter(m_previousFilter);
+ if (m_previousCrtHandler)
+ _set_invalid_parameter_handler(m_previousCrtHandler);
ClearSymbols();
}
@@ -186,6 +190,11 @@ PEXCEPTION_POINTERS pExceptionInfo)
return EXCEPTION_EXECUTE_HANDLER/*EXCEPTION_CONTINUE_SEARCH*/;
}
+void __cdecl WheatyExceptionReport::WheatyCrtHandler(wchar_t const* /*expression*/, wchar_t const* /*function*/, wchar_t const* /*file*/, unsigned int /*line*/, uintptr_t /*pReserved*/)
+{
+ RaiseException(EXCEPTION_ACCESS_VIOLATION, 0, 0, nullptr);
+}
+
BOOL WheatyExceptionReport::_GetProcessorName(TCHAR* sProcessorName, DWORD maxcount)
{
if (!sProcessorName)