diff --git a/hurricane/src/hurricane/Backtrace.cpp b/hurricane/src/hurricane/Backtrace.cpp index 77a0bd61..c91aa02a 100644 --- a/hurricane/src/hurricane/Backtrace.cpp +++ b/hurricane/src/hurricane/Backtrace.cpp @@ -262,7 +262,6 @@ namespace { return; } } - } } @@ -414,6 +413,7 @@ namespace Hurricane { // Class : "Hurricane::Backtrace". + int Backtrace::_callCount = 0; TextTranslator Backtrace::_textTranslator = TextTranslator::toTextTranslator(); const size_t Backtrace::_stackSize = 50; @@ -428,6 +428,18 @@ namespace Hurricane { Backtrace::Backtrace () : _stack() { + if (_callCount > 0) { + _stack.push_back( "[BUG] Backtrace::Backtrace(): An error occurred in the backtace *istself*." ); + _stack.push_back( "" ); + _stack.push_back( " Under RHEL 6, this may be due to a link with a wrong version of ," ); + _stack.push_back( " please check that you have the package" ); + _stack.push_back( " installed." ); + _stack.push_back( "" ); + _stack.push_back( " For other OSs, check for any problems related to BFD." ); + return; + } + ++_callCount; + #if (defined __linux__ || defined __FreeBSD__ || defined __APPLE__) void* rawStack [ _stackSize ]; size_t depth = backtrace ( rawStack, _stackSize ); @@ -498,6 +510,10 @@ namespace Hurricane { } + Backtrace::~Backtrace () + { --_callCount; } + + string Backtrace::htmlWhere () const { ostringstream where; diff --git a/hurricane/src/hurricane/hurricane/Backtrace.h b/hurricane/src/hurricane/hurricane/Backtrace.h index 48045240..8d4178a6 100644 --- a/hurricane/src/hurricane/hurricane/Backtrace.h +++ b/hurricane/src/hurricane/hurricane/Backtrace.h @@ -43,15 +43,17 @@ namespace Hurricane { class Backtrace { public: Backtrace (); + ~Backtrace (); inline std::string where () const; inline std::string textWhere () const; std::string htmlWhere () const; inline std::string _getTypeName () const; inline std::string _getString () const; private: - static TextTranslator _textTranslator; - static const size_t _stackSize; - std::vector _stack; + static int _callCount; + static TextTranslator _textTranslator; + static const size_t _stackSize; + std::vector _stack; };