diff options
Diffstat (limited to 'indra/llcommon/llerror.h')
-rw-r--r-- | indra/llcommon/llerror.h | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index ffaa464d77..18d11cfa9d 100644 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -193,14 +193,20 @@ namespace LLError */ struct CallSite; + + enum ErrFatalHookResult { ERR_DO_NOT_CRASH, ERR_CRASH }; class LL_COMMON_API Log { public: static bool shouldLog(CallSite&); static std::ostringstream* out(); + static void flush(std::ostringstream* out, char* message); - static void flush(std::ostringstream*, const CallSite&); + + // returns false iff the calling macro should crash + static ErrFatalHookResult flush(std::ostringstream*, const CallSite&); + static std::string demangle(const char* mangled); /// classname<TYPE>() template <typename T> @@ -271,6 +277,7 @@ namespace LLError class LL_COMMON_API NoClassInfo { }; // used to indicate no class info known for logging + //LLCallStacks keeps track of call stacks and output the call stacks to log file //when LLAppViewer::handleViewerCrash() is triggered. // @@ -382,10 +389,24 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG; #define LL_NEWLINE '\n' -#define LL_ENDL \ - LLError::End(); \ - LLError::Log::flush(_out, _site); \ - } \ +#ifdef _LLERROR_CPP_ +volatile int* gCauseCrash = NULL; +#else +volatile extern int* gCauseCrash; +#endif // _LLERROR_CPP_ + +// Use this only in LL_ERRS or in a place that LL_ERRS may not be used +#define LLERROR_CRASH \ +{ \ + *gCauseCrash = 0; \ + exit(*gCauseCrash); \ +} + +#define LL_ENDL \ + LLError::End(); \ + if (LLError::ERR_CRASH == LLError::Log::flush(_out, _site)) \ + LLERROR_CRASH \ + } \ } while(0) // NEW Macros for debugging, allow the passing of a string tag |