1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

Unfatal Segfaults

This commit is contained in:
Eladash 2021-01-27 17:50:39 +02:00 committed by Ivan
parent 53267e283b
commit 28feea0447

View File

@ -1403,7 +1403,6 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) no
// Hack: allocate memory in case the emulator is stopping
const auto hack_alloc = [&]()
{
// If failed the value remains true and std::terminate should be called
g_tls_access_violation_recovered = true;
const auto area = vm::reserve_map(vm::any, addr & -0x10000, 0x10000);
@ -1529,7 +1528,8 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) no
if (sending_error)
{
vm_log.fatal("Unknown error 0x%x while trying to pass page fault.", +sending_error);
vm_log.error("Unknown error 0x%x while trying to pass page fault.", +sending_error);
return false;
}
else
{
@ -1548,7 +1548,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) no
// Reschedule, test cpu state and try recovery if stopped
if (cpu->test_stopped() && !hack_alloc())
{
std::terminate();
return false;
}
return true;
@ -1569,7 +1569,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) no
if (cpu->check_state() && !hack_alloc())
{
std::terminate();
return false;
}
return true;
@ -1606,7 +1606,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) no
if (Emu.IsStopped() && !hack_alloc())
{
std::terminate();
return false;
}
return true;
@ -1676,8 +1676,6 @@ static LONG exception_filter(PEXCEPTION_POINTERS pExp) noexcept
if (thread_ctrl::get_current())
{
fmt::append(msg, "Emu Thread Name: '%s'.\n", thread_ctrl::get_name());
sys_log.notice("\n%s", dump_useful_thread_info());
}
// TODO: Report full thread name if not an emu thread
@ -1739,14 +1737,7 @@ static LONG exception_filter(PEXCEPTION_POINTERS pExp) noexcept
// TODO: print registers and the callstack
sys_log.fatal("\n%s", msg);
if (!IsDebuggerPresent())
{
report_fatal_error(msg);
}
return EXCEPTION_CONTINUE_SEARCH;
thread_ctrl::emergency_exit(msg);
}
const bool s_exception_handler_set = []() -> bool
@ -1810,24 +1801,25 @@ static void signal_handler(int sig, siginfo_t* info, void* uct) noexcept
if (thread_ctrl::get_current())
{
fmt::append(msg, "Emu Thread Name: '%s'.\n", thread_ctrl::get_name());
sys_log.notice("\n%s", dump_useful_thread_info());
}
// TODO: Report full thread name if not an emu thread
fmt::append(msg, "Thread id = %s.\n", std::this_thread::get_id());
if (IsDebuggerPresent())
{
sys_log.fatal("\n%s", msg);
std::fprintf(stderr, "%s\n", msg.c_str());
if (IsDebuggerPresent())
{
sys_log.notice("\n%s", dump_useful_thread_info());
// Convert to SIGTRAP
raise(SIGTRAP);
return;
}
report_fatal_error(msg);
thread_ctrl::emergency_exit(msg);
}
void sigpipe_signaling_handler(int)