Skip to content

Commit

Permalink
Made signal handling more uniform. Fixes #82102
Browse files Browse the repository at this point in the history
  • Loading branch information
naelstrof committed Sep 23, 2023
1 parent c12d635 commit b49e9c9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions platform/linuxbsd/crash_handler_linuxbsd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
#include <stdlib.h>

static void handle_crash(int sig) {
signal(SIGSEGV, SIG_DFL);
signal(SIGFPE, SIG_DFL);
signal(SIGILL, SIG_DFL);

if (OS::get_singleton() == nullptr) {
abort();
}
Expand Down Expand Up @@ -156,9 +160,9 @@ void CrashHandler::disable() {
}

#ifdef CRASH_HANDLER_ENABLED
signal(SIGSEGV, nullptr);
signal(SIGFPE, nullptr);
signal(SIGILL, nullptr);
signal(SIGSEGV, SIG_DFL);
signal(SIGFPE, SIG_DFL);
signal(SIGILL, SIG_DFL);
#endif

disabled = true;
Expand Down
10 changes: 7 additions & 3 deletions platform/macos/crash_handler_macos.mm
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ static uint64_t load_address() {
}

static void handle_crash(int sig) {
signal(SIGSEGV, SIG_DFL);
signal(SIGFPE, SIG_DFL);
signal(SIGILL, SIG_DFL);

if (OS::get_singleton() == nullptr) {
abort();
}
Expand Down Expand Up @@ -186,9 +190,9 @@ static void handle_crash(int sig) {
}

#ifdef CRASH_HANDLER_ENABLED
signal(SIGSEGV, nullptr);
signal(SIGFPE, nullptr);
signal(SIGILL, nullptr);
signal(SIGSEGV, SIG_DFL);
signal(SIGFPE, SIG_DFL);
signal(SIGILL, SIG_DFL);
#endif

disabled = true;
Expand Down

0 comments on commit b49e9c9

Please sign in to comment.