diff --git a/platform/linuxbsd/crash_handler_linuxbsd.cpp b/platform/linuxbsd/crash_handler_linuxbsd.cpp index 3a245460b47e..3f8f55a1a7d0 100644 --- a/platform/linuxbsd/crash_handler_linuxbsd.cpp +++ b/platform/linuxbsd/crash_handler_linuxbsd.cpp @@ -70,7 +70,28 @@ static void handle_crash(int sig) { // Dump the backtrace to stderr with a message to the user print_error("\n================================================================"); - print_error(vformat("%s: Program crashed with signal %d", __FUNCTION__, sig)); + String signal_description; + switch (sig) { + case SIGTERM: + signal_description = "(SIGTERM) - Terminated"; + break; + case SIGSEGV: + signal_description = "(SIGSEGV) - Segmentation fault"; + break; + case SIGINT: + signal_description = "(SIGINT) - Interrupt"; + break; + case SIGILL: + signal_description = "(SIGILL) - Illegal instruction"; + break; + case SIGABRT: + signal_description = "(SIGABRT) - Abnormal termination condition"; + break; + case SIGFPE: + signal_description = "(SIGFPE) - Floating-point exception"; + break; + } + print_error(vformat("%s: Program crashed with signal %d %s", __FUNCTION__, sig, signal_description)); // Print the engine version just before, so that people are reminded to include the version in backtrace reports. if (String(VERSION_HASH).is_empty()) { diff --git a/platform/macos/crash_handler_macos.mm b/platform/macos/crash_handler_macos.mm index 7f9a88121eda..9de2651c2ed7 100644 --- a/platform/macos/crash_handler_macos.mm +++ b/platform/macos/crash_handler_macos.mm @@ -93,7 +93,28 @@ static void handle_crash(int sig) { // Dump the backtrace to stderr with a message to the user print_error("\n================================================================"); - print_error(vformat("%s: Program crashed with signal %d", __FUNCTION__, sig)); + String signal_description; + switch (sig) { + case SIGTERM: + signal_description = "(SIGTERM) - Terminated"; + break; + case SIGSEGV: + signal_description = "(SIGSEGV) - Segmentation fault"; + break; + case SIGINT: + signal_description = "(SIGINT) - Interrupt"; + break; + case SIGILL: + signal_description = "(SIGILL) - Illegal instruction"; + break; + case SIGABRT: + signal_description = "(SIGABRT) - Abnormal termination condition"; + break; + case SIGFPE: + signal_description = "(SIGFPE) - Floating-point exception"; + break; + } + print_error(vformat("%s: Program crashed with signal %d %s", __FUNCTION__, sig, signal_description)); // Print the engine version just before, so that people are reminded to include the version in backtrace reports. if (String(VERSION_HASH).is_empty()) {