Skip to content

Commit

Permalink
Merge pull request #82163 from naelstrof/master
Browse files Browse the repository at this point in the history
Made signal handling more uniform during crashes.
  • Loading branch information
akien-mga committed Oct 5, 2023
2 parents b9bf46d + b49e9c9 commit d8ab953
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 d8ab953

Please sign in to comment.