1
0
mirror of synced 2024-11-28 09:30:51 +01:00

impr: Reset back all signals when a fatal error occurred

This commit is contained in:
WerWolv 2023-05-21 17:33:33 +02:00
parent 446e0751a6
commit 0563a59b1b

View File

@ -58,7 +58,10 @@ namespace hex {
} }
// Reset the signal handler to the default handler // Reset the signal handler to the default handler
std::signal(signalNumber, SIG_DFL); std::signal(SIGSEGV, SIG_DFL);
std::signal(SIGILL, SIG_DFL);
std::signal(SIGABRT, SIG_DFL);
std::signal(SIGFPE, SIG_DFL);
// Print stack trace // Print stack trace
for (const auto &stackFrame : stacktrace::getStackTrace()) { for (const auto &stackFrame : stacktrace::getStackTrace()) {
@ -196,12 +199,12 @@ namespace hex {
#define HANDLE_SIGNAL(name) \ #define HANDLE_SIGNAL(name) \
std::signal(name, [](int signalNumber){ \ std::signal(name, [](int signalNumber){ \
signalHandler(signalNumber, #name); \ signalHandler(signalNumber, #name); \
}); })
HANDLE_SIGNAL(SIGSEGV) HANDLE_SIGNAL(SIGSEGV);
HANDLE_SIGNAL(SIGILL) HANDLE_SIGNAL(SIGILL);
HANDLE_SIGNAL(SIGABRT) HANDLE_SIGNAL(SIGABRT);
HANDLE_SIGNAL(SIGFPE) HANDLE_SIGNAL(SIGFPE);
#undef HANDLE_SIGNAL #undef HANDLE_SIGNAL
} }