1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 04:02:42 +01:00

Thread.cpp: Flush log and make thread context dump on exception

This commit is contained in:
Eladash 2023-09-04 19:30:23 +03:00 committed by Elad Ashkenazi
parent 6bc7d7c698
commit 53ba38e98d

View File

@ -1745,6 +1745,28 @@ static LONG exception_handler(PEXCEPTION_POINTERS pExp) noexcept
} }
} }
switch (pExp->ExceptionRecord->ExceptionCode)
{
case EXCEPTION_ACCESS_VIOLATION:
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
case EXCEPTION_DATATYPE_MISALIGNMENT:
case EXCEPTION_ILLEGAL_INSTRUCTION:
case EXCEPTION_IN_PAGE_ERROR:
case EXCEPTION_INT_DIVIDE_BY_ZERO:
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
case EXCEPTION_PRIV_INSTRUCTION:
//case EXCEPTION_STACK_OVERFLOW:
{
sys_log.notice("\n%s", dump_useful_thread_info());
logs::listener::sync_all();
break;
}
default:
{
break;
}
}
return EXCEPTION_CONTINUE_SEARCH; return EXCEPTION_CONTINUE_SEARCH;
} }
@ -1827,6 +1849,9 @@ static LONG exception_filter(PEXCEPTION_POINTERS pExp) noexcept
// TODO: print registers and the callstack // TODO: print registers and the callstack
sys_log.fatal("\n%s", msg);
logs::listener::sync_all();
thread_ctrl::emergency_exit(msg); thread_ctrl::emergency_exit(msg);
} }
@ -1912,12 +1937,12 @@ static void signal_handler(int /*sig*/, siginfo_t* info, void* uct) noexcept
append_thread_name(msg); append_thread_name(msg);
sys_log.fatal("\n%s", msg);
sys_log.notice("\n%s", dump_useful_thread_info());
logs::listener::sync_all();
if (IsDebuggerPresent()) if (IsDebuggerPresent())
{ {
sys_log.fatal("\n%s", msg);
sys_log.notice("\n%s", dump_useful_thread_info());
// Convert to SIGTRAP // Convert to SIGTRAP
raise(SIGTRAP); raise(SIGTRAP);
return; return;
@ -1932,12 +1957,12 @@ static void sigill_handler(int /*sig*/, siginfo_t* info, void* /*uct*/) noexcept
append_thread_name(msg); append_thread_name(msg);
sys_log.fatal("\n%s", msg);
sys_log.notice("\n%s", dump_useful_thread_info());
logs::listener::sync_all();
if (IsDebuggerPresent()) if (IsDebuggerPresent())
{ {
sys_log.fatal("\n%s", msg);
sys_log.notice("\n%s", dump_useful_thread_info());
// Convert to SIGTRAP // Convert to SIGTRAP
raise(SIGTRAP); raise(SIGTRAP);
return; return;