[icinga-checkins] icinga.org: icinga2/master: Implement support for Exception:: GetLastStackTrace on OS X.

git at icinga.org git at icinga.org
Fri Mar 15 13:44:42 CET 2013


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

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Fri Mar 15 13:44:45 2013 +0100

Implement support for Exception::GetLastStackTrace on OS X.

---

 lib/base/exception.cpp |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/base/exception.cpp b/lib/base/exception.cpp
index 63a811f..1fd586d 100644
--- a/lib/base/exception.cpp
+++ b/lib/base/exception.cpp
@@ -23,7 +23,7 @@ using namespace icinga;
 
 boost::thread_specific_ptr<StackTrace> Exception::m_LastStackTrace;
 
-#if !defined(_WIN32) && !defined(__APPLE__)
+#ifndef _WIN32
 extern "C"
 void __cxa_throw(void *obj, void *pvtinfo, void (*dest)(void *))
 {
@@ -33,6 +33,7 @@ void __cxa_throw(void *obj, void *pvtinfo, void (*dest)(void *))
 	if (real_cxa_throw == 0)
 		real_cxa_throw = (cxa_throw_fn)dlsym(RTLD_NEXT, "__cxa_throw");
 
+#ifndef __APPLE__
 	void *thrown_ptr = obj;
 	const type_info *tinfo = static_cast<type_info *>(pvtinfo);
 	const type_info *boost_exc = &typeid(boost::exception);
@@ -40,20 +41,23 @@ void __cxa_throw(void *obj, void *pvtinfo, void (*dest)(void *))
 	/* Check if the exception is a pointer type. */
 	if (tinfo->__is_pointer_p())
 		thrown_ptr = *(void **)thrown_ptr;
+#endif /* __APPLE__ */
 
 	StackTrace trace;
 	Exception::SetLastStackTrace(trace);
 
+#ifndef __APPLE__
 	/* Check if thrown_ptr inherits from boost::exception. */
 	if (boost_exc->__do_catch(tinfo, &thrown_ptr, 1)) {
 		boost::exception *ex = (boost::exception *)thrown_ptr;
 
 		*ex << StackTraceErrorInfo(trace);
 	}
+#endif /* __APPLE__ */
 
 	real_cxa_throw(obj, pvtinfo, dest);
 }
-#endif /* !_WIN32 && !__APPLE__ */
+#endif /* _WIN32 */
 
 StackTrace *Exception::GetLastStackTrace(void)
 {





More information about the icinga-checkins mailing list