impr: Reset back all signals when a fatal error occurred
This commit is contained in:
parent
446e0751a6
commit
0563a59b1b
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user