[icinga-checkins] icinga.org: icinga2/master: Display "debug message" for exceptions ( in addition to SIGABRT).

git at icinga.org git at icinga.org
Fri Feb 1 19:27:42 CET 2013


Module: icinga2
Branch: master
Commit: 05d0dc5683fa5dae1ddfdb51f848b5be8f5a5681
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=05d0dc5683fa5dae1ddfdb51f848b5be8f5a5681

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Fri Feb  1 19:11:15 2013 +0100

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

---

 lib/base/application.cpp |   20 +++++++++++++++-----
 lib/base/application.h   |    2 ++
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/lib/base/application.cpp b/lib/base/application.cpp
index 099750c..2851001 100644
--- a/lib/base/application.cpp
+++ b/lib/base/application.cpp
@@ -299,6 +299,18 @@ void Application::SigIntHandler(int signum)
 }
 
 /**
+ * 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.
  *
  * @param signum The signal number.
@@ -311,11 +323,7 @@ void Application::SigAbrtHandler(int signum)
 
 	Utility::PrintStacktrace(std::cerr, 1);
 
-	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;
+	DisplayBugMessage();
 }
 #else /* _WIN32 */
 /**
@@ -358,6 +366,8 @@ void Application::ExceptionHandler(void)
 
 	Utility::PrintStacktrace(std::cerr, 1);
 
+	DisplayBugMessage();
+
 #ifndef _WIN32
 	struct sigaction sa;
 	memset(&sa, 0, sizeof(sa));
diff --git a/lib/base/application.h b/lib/base/application.h
index 8d06154..da84349 100644
--- a/lib/base/application.h
+++ b/lib/base/application.h
@@ -96,6 +96,8 @@ private:
 	static BOOL WINAPI CtrlHandler(DWORD type);
 #endif /* _WIN32 */
 
+	static void DisplayBugMessage(void);
+
 	static void ExceptionHandler(void);
 
 	static void TimeWatchThreadProc(void);





More information about the icinga-checkins mailing list