Display "debug message" for exceptions (in addition to SIGABRT).

This commit is contained in:
Gunnar Beutner 2013-02-01 19:11:15 +01:00
parent 8a469e190f
commit 05d0dc5683
2 changed files with 17 additions and 5 deletions

View File

@ -298,6 +298,18 @@ void Application::SigIntHandler(int signum)
sigaction(SIGINT, &sa, NULL); sigaction(SIGINT, &sa, NULL);
} }
/**
* Displays a message that tells users what to do when they encounter a bug.
*/
void Application::DisplayBugMessage(void)
{
std::cerr << "***" << std::endl
<< "*** This would indicate a bug in Icinga 2. Please submit a bug report at https://dev.icinga.org/ and include" << std::endl
<< "*** this stack trace as well as any other information that might be useful in order to reproduce this problem." << std::endl
<< "***" << std::endl
<< std::endl;
}
/** /**
* Signal handler for SIGABRT. Helps with debugging assert()s. * Signal handler for SIGABRT. Helps with debugging assert()s.
* *
@ -311,11 +323,7 @@ void Application::SigAbrtHandler(int signum)
Utility::PrintStacktrace(std::cerr, 1); Utility::PrintStacktrace(std::cerr, 1);
std::cerr << "***" << std::endl DisplayBugMessage();
<< "*** This would indicate a bug in Icinga 2. Please submit a bug report at https://dev.icinga.org/ and include" << std::endl
<< "*** this stack trace as well as any other information that might be useful in order to reproduce this problem." << std::endl
<< "***" << std::endl
<< std::endl;
} }
#else /* _WIN32 */ #else /* _WIN32 */
/** /**
@ -358,6 +366,8 @@ void Application::ExceptionHandler(void)
Utility::PrintStacktrace(std::cerr, 1); Utility::PrintStacktrace(std::cerr, 1);
DisplayBugMessage();
#ifndef _WIN32 #ifndef _WIN32
struct sigaction sa; struct sigaction sa;
memset(&sa, 0, sizeof(sa)); memset(&sa, 0, sizeof(sa));

View File

@ -96,6 +96,8 @@ private:
static BOOL WINAPI CtrlHandler(DWORD type); static BOOL WINAPI CtrlHandler(DWORD type);
#endif /* _WIN32 */ #endif /* _WIN32 */
static void DisplayBugMessage(void);
static void ExceptionHandler(void); static void ExceptionHandler(void);
static void TimeWatchThreadProc(void); static void TimeWatchThreadProc(void);