diff --git a/lib/exceptionhandler/exceptionhandler.c b/lib/exceptionhandler/exceptionhandler.c index 8e512e9e0..a8c59083a 100644 --- a/lib/exceptionhandler/exceptionhandler.c +++ b/lib/exceptionhandler/exceptionhandler.c @@ -335,10 +335,6 @@ static void setFatalSignalHandler(SigActionHandler signalHandler) if (oldAction[SIGSYS].sa_handler != SIG_IGN) sigaction(SIGSYS, &new_handler, NULL); - sigaction(SIGTRAP, NULL, &oldAction[SIGTRAP]); - if (oldAction[SIGTRAP].sa_handler != SIG_IGN) - sigaction(SIGTRAP, &new_handler, NULL); - sigaction(SIGXCPU, NULL, &oldAction[SIGXCPU]); if (oldAction[SIGXCPU].sa_handler != SIG_IGN) sigaction(SIGXCPU, &new_handler, NULL); @@ -346,6 +342,10 @@ static void setFatalSignalHandler(SigActionHandler signalHandler) sigaction(SIGXFSZ, NULL, &oldAction[SIGXFSZ]); if (oldAction[SIGXFSZ].sa_handler != SIG_IGN) sigaction(SIGXFSZ, &new_handler, NULL); + + // ignore SIGTRAP + new_handler.sa_handler = SIG_IGN; + sigaction(SIGTRAP, &new_handler, &oldAction[SIGTRAP]); #endif // _XOPEN_UNIX } diff --git a/lib/framework/debug.h b/lib/framework/debug.h index 8de255258..3de6a3d7c 100644 --- a/lib/framework/debug.h +++ b/lib/framework/debug.h @@ -32,6 +32,7 @@ #endif #include +#include #include "macros.h" #include "types.h" @@ -60,7 +61,7 @@ extern bool assertEnabled; (void)_debug(LOG_ERROR, function, __VA_ARGS__), \ (void)_debug(LOG_ERROR, function, "Assert in Warzone: %s (%s), last script event: '%s'", \ location_description, expr_string, last_called_script_event), \ - ( assertEnabled ? assert(expr) : (void)0 )\ + ( assertEnabled ? (void)raise(SIGTRAP) : (void)0 )\ ) /**