From 63a83659c826ea6ab569610c97187cc626def256 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Thu, 15 Nov 2018 20:41:19 +0100 Subject: [PATCH] disable signal handlers in release --- alib2common/src/debug/sigHandler.cpp | 41 ++++++++++++++++------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/alib2common/src/debug/sigHandler.cpp b/alib2common/src/debug/sigHandler.cpp index 7ba1605402..bd4e4672be 100644 --- a/alib2common/src/debug/sigHandler.cpp +++ b/alib2common/src/debug/sigHandler.cpp @@ -12,27 +12,32 @@ namespace ext { -void SigHandler::handler(int signal) { - switch(signal) { - case SIGSEGV: - common::Streams::out << "Segmentation fault" << std::endl; - break; - case SIGINT: - common::Streams::out << "Interrupted" << std::endl; - break; - default: - common::Streams::out << "Unknown signal" << std::endl; - break; - } - #ifdef DEBUG +#ifdef DEBUG + void SigHandler::handler(int signal) { + switch(signal) { + case SIGSEGV: + common::Streams::out << "Segmentation fault" << std::endl; + break; + case SIGINT: + common::Streams::out << "Interrupted" << std::endl; + break; + default: + common::Streams::out << "Unknown signal" << std::endl; + break; + } common::Streams::out << ext::simpleStacktrace() << std::endl; - #endif - exit(1); -} + exit(1); + } +#else + void SigHandler::handler ( int ) { + } +#endif SigHandler::SigHandler() { - signal(SIGSEGV, SigHandler::handler); - signal(SIGINT, SigHandler::handler); + #ifdef DEBUG + signal(SIGSEGV, SigHandler::handler); + signal(SIGINT, SigHandler::handler); + #endif } SigHandler SigHandler::HANDLER; -- GitLab