Handle exceptions raised inside the access violation exception filter which we use for various emulation tasks.

This was what made the MTVU shutdown issue undebuggable.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5150 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
sudonim1@gmail.com 2012-04-07 15:35:53 +00:00
parent b3f8c59cf4
commit 6666180802
1 changed files with 16 additions and 2 deletions

View File

@ -19,8 +19,7 @@
#include <winnt.h>
int SysPageFaultExceptionFilter( EXCEPTION_POINTERS* eps )
static int DoSysPageFaultExceptionFilter( EXCEPTION_POINTERS* eps )
{
if( eps->ExceptionRecord->ExceptionCode != EXCEPTION_ACCESS_VIOLATION )
return EXCEPTION_CONTINUE_SEARCH;
@ -33,6 +32,21 @@ int SysPageFaultExceptionFilter( EXCEPTION_POINTERS* eps )
return Source_PageFault->WasHandled() ? EXCEPTION_CONTINUE_EXECUTION : EXCEPTION_CONTINUE_SEARCH;
}
int SysPageFaultExceptionFilter( EXCEPTION_POINTERS* eps )
{
// Prevent recursive exception filtering by catching the exception from the filter here.
// In the event that the filter causes an access violation (happened during shutdown
// because Source_PageFault was deallocated), this will allow the debugger to catch the
// exception.
// TODO: find a reliable way to debug the filter itself, I've come up with a few ways that
// work but I don't fully understand why some do and some don't.
__try {
return DoSysPageFaultExceptionFilter(eps);
} __except (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {
return EXCEPTION_CONTINUE_SEARCH;
}
}
void _platform_InstallSignalHandler()
{
// NOP on Win32 systems -- we use __try{} __except{} instead.