diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 4e3596a71..ca47e80ad 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -18,14 +18,14 @@ int handleCritSignal(int signo, void* data) { return 0; // everything went fine } -void handleSegv(int sig) { +void handleUnrecoverableSignal(int sig) { if (g_pHookSystem->m_bCurrentEventPlugin) { longjmp(g_pHookSystem->m_jbHookFaultJumpBuf, 1); return; } - CrashReporter::createAndSaveCrash(); + CrashReporter::createAndSaveCrash(sig); abort(); } @@ -74,7 +74,8 @@ CCompositor::CCompositor() { // register crit signal handler wl_event_loop_add_signal(m_sWLEventLoop, SIGTERM, handleCritSignal, nullptr); - signal(SIGSEGV, handleSegv); + signal(SIGSEGV, handleUnrecoverableSignal); + signal(SIGABRT, handleUnrecoverableSignal); //wl_event_loop_add_signal(m_sWLEventLoop, SIGINT, handleCritSignal, nullptr); m_sWLRBackend = wlr_backend_autocreate(m_sWLDisplay, &m_sWLRSession); diff --git a/src/debug/CrashReporter.cpp b/src/debug/CrashReporter.cpp index 5b8c8a404..683bd9518 100644 --- a/src/debug/CrashReporter.cpp +++ b/src/debug/CrashReporter.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "../plugins/PluginSystem.hpp" @@ -33,7 +34,7 @@ std::string getRandomMessage() { return MESSAGES[distribution(engine)]; } -void CrashReporter::createAndSaveCrash() { +void CrashReporter::createAndSaveCrash(int sig) { // get the backtrace const int PID = getpid(); @@ -43,7 +44,7 @@ void CrashReporter::createAndSaveCrash() { finalCrashReport += "--------------------------------------------\n Hyprland Crash Report\n--------------------------------------------\n"; finalCrashReport += getRandomMessage() + "\n\n"; - finalCrashReport += "Hyprland received signal 11 (SIGSEGV): Segmentation Fault\n\n"; + finalCrashReport += getFormat("Hyprland received signal %d (%s): Segmentation Fault\n\n", sig, strsignal(sig)); if (!g_pPluginSystem->getAllPlugins().empty()) { finalCrashReport += "Hyprland seems to be running with plugins. This crash might not be Hyprland's fault.\nPlugins:\n"; diff --git a/src/debug/CrashReporter.hpp b/src/debug/CrashReporter.hpp index b607a82f6..b6750f10f 100644 --- a/src/debug/CrashReporter.hpp +++ b/src/debug/CrashReporter.hpp @@ -3,5 +3,5 @@ #include "../defines.hpp" namespace CrashReporter { - void createAndSaveCrash(); + void createAndSaveCrash(int sig); }; \ No newline at end of file