From 2f8898a9e8983460b2f61a8b7b167a2c94fb95ac Mon Sep 17 00:00:00 2001 From: Stephane Del Pino <stephane.delpino44@gmail.com> Date: Fri, 11 Jan 2019 08:23:43 +0100 Subject: [PATCH] Change SignalManager behavior in release build Does not pause on error anymore when build type is release. In release mode, debugger did not git more info than the back trace itself. --- src/utils/SignalManager.cpp | 47 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/src/utils/SignalManager.cpp b/src/utils/SignalManager.cpp index cd3c42510..c2e518a47 100644 --- a/src/utils/SignalManager.cpp +++ b/src/utils/SignalManager.cpp @@ -33,23 +33,28 @@ std::string SignalManager::signalName(const int& signal) void SignalManager::pauseForDebug(const int& signal) { - - pout() << "\n======================================\n"; - pout() << rang::style::reset - << rang::fg::reset - << rang::style::bold; - pout() << "to attach gdb to this process run\n"; - pout() << "\tgdb -pid " - << rang::fg::red - << getpid() - << rang::fg::reset - << '\n'; - pout() << "else press Control-C to exit\n"; - pout() << rang::style::reset; - pout() << "======================================\n"; - pout() << std::flush; - - pause(); + if (std::string(PASTIS_BUILD_TYPE) != "Release") { + if ((ConsoleManager::isTerminal(pout()) and + (s_pause_on_error == "auto")) or + (s_pause_on_error == "yes")) { + pout() << "\n======================================\n"; + pout() << rang::style::reset + << rang::fg::reset + << rang::style::bold; + pout() << "to attach gdb to this process run\n"; + pout() << "\tgdb -pid " + << rang::fg::red + << getpid() + << rang::fg::reset + << '\n'; + pout() << "else press Control-C to exit\n"; + pout() << rang::style::reset; + pout() << "======================================\n"; + pout() << std::flush; + + pause(); + } + } std::exit(signal); } @@ -89,13 +94,7 @@ void SignalManager::handler(int signal) BacktraceManager bm; perr() << bm << '\n'; - if ((ConsoleManager::isTerminal(pout()) and - (s_pause_on_error == "auto")) or - (s_pause_on_error == "yes")) { - SignalManager::pauseForDebug(signal); - } else { - std::exit(signal); - } + SignalManager::pauseForDebug(signal); } void SignalManager::init(const bool& enable) -- GitLab