mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-23 12:21:51 +01:00
Flush emulation logs after exceptions
A lot of logs are incomplete due to being unable to flush inside the signal handler, now we flush after any exceptions so that there is a guarantee of any exceptions being logged as this is crucial for proper debugging.
This commit is contained in:
parent
62ba180550
commit
ea00f1bb82
@ -177,6 +177,7 @@ namespace skyline::kernel::type {
|
||||
__builtin_unreachable();
|
||||
} catch (const std::exception &e) {
|
||||
Logger::Error(e.what());
|
||||
Logger::EmulationContext.Flush();
|
||||
if (id) {
|
||||
signal::BlockSignal({SIGINT});
|
||||
state.process->Kill(false);
|
||||
@ -186,6 +187,7 @@ namespace skyline::kernel::type {
|
||||
} catch (const signal::SignalException &e) {
|
||||
if (e.signal != SIGINT) {
|
||||
Logger::Error(e.what());
|
||||
Logger::EmulationContext.Flush();
|
||||
if (id) {
|
||||
signal::BlockSignal({SIGINT});
|
||||
state.process->Kill(false);
|
||||
|
@ -41,10 +41,14 @@ namespace skyline::nce {
|
||||
} catch (const signal::SignalException &e) {
|
||||
if (e.signal != SIGINT) {
|
||||
Logger::ErrorNoPrefix("{} (SVC: {})\nStack Trace:{}", e.what(), svc.name, state.loader->GetStackTrace(e.frames));
|
||||
Logger::EmulationContext.Flush();
|
||||
|
||||
if (state.thread->id) {
|
||||
signal::BlockSignal({SIGINT});
|
||||
state.process->Kill(false);
|
||||
}
|
||||
} else {
|
||||
Logger::EmulationContext.Flush();
|
||||
}
|
||||
abi::__cxa_end_catch(); // We call this prior to the longjmp to cause the exception object to be destroyed
|
||||
std::longjmp(state.thread->originalCtx, true);
|
||||
@ -60,6 +64,8 @@ namespace skyline::nce {
|
||||
else
|
||||
Logger::ErrorNoPrefix("{} (SVC: 0x{:X})\nStack Trace:{}", e.what(), svcId, state.loader->GetStackTrace());
|
||||
|
||||
Logger::EmulationContext.Flush();
|
||||
|
||||
if (state.thread->id) {
|
||||
signal::BlockSignal({SIGINT});
|
||||
state.process->Kill(false);
|
||||
@ -94,6 +100,7 @@ namespace skyline::nce {
|
||||
cpuContext += fmt::format("\n X{:<2}: 0x{:<16X} X{:<2}: 0x{:X}", index, mctx.regs[index], index + 1, mctx.regs[index + 1]);
|
||||
|
||||
Logger::Error("Thread #{} has crashed due to signal: {}\nStack Trace:{}\nCPU Context:{}", state.thread->id, strsignal(signal), trace, cpuContext);
|
||||
Logger::EmulationContext.Flush();
|
||||
|
||||
if (state.thread->id) {
|
||||
signal::BlockSignal({SIGINT});
|
||||
|
@ -346,11 +346,13 @@ namespace skyline::soc::gm20b {
|
||||
} catch (const signal::SignalException &e) {
|
||||
if (e.signal != SIGINT) {
|
||||
Logger::Error("{}\nStack Trace:{}", e.what(), state.loader->GetStackTrace(e.frames));
|
||||
Logger::EmulationContext.Flush();
|
||||
signal::BlockSignal({SIGINT});
|
||||
state.process->Kill(false);
|
||||
}
|
||||
} catch (const std::exception &e) {
|
||||
Logger::Error(e.what());
|
||||
Logger::EmulationContext.Flush();
|
||||
signal::BlockSignal({SIGINT});
|
||||
state.process->Kill(false);
|
||||
}
|
||||
|
@ -126,11 +126,13 @@ namespace skyline::soc::host1x {
|
||||
} catch (const signal::SignalException &e) {
|
||||
if (e.signal != SIGINT) {
|
||||
Logger::Error("{}\nStack Trace:{}", e.what(), state.loader->GetStackTrace(e.frames));
|
||||
Logger::EmulationContext.Flush();
|
||||
signal::BlockSignal({SIGINT});
|
||||
state.process->Kill(false);
|
||||
}
|
||||
} catch (const std::exception &e) {
|
||||
Logger::Error(e.what());
|
||||
Logger::EmulationContext.Flush();
|
||||
signal::BlockSignal({SIGINT});
|
||||
state.process->Kill(false);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user