summaryrefslogtreecommitdiff
path: root/indra/llcommon/llerror.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon/llerror.h')
-rw-r--r--indra/llcommon/llerror.h32
1 files changed, 26 insertions, 6 deletions
diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h
index 0a78229555..6bdb2e852f 100644
--- a/indra/llcommon/llerror.h
+++ b/indra/llcommon/llerror.h
@@ -194,13 +194,19 @@ 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);
};
@@ -266,7 +272,7 @@ namespace LLError
//when LLAppViewer::handleViewerCrash() is triggered.
//
//Note: to be simple, efficient and necessary to keep track of correct call stacks,
- //LLCallStacks is designed not to be thread-safe.
+ //LLCallStacks is designed not to be thread-safe.
//so try not to use it in multiple parallel threads at same time.
//Used in a single thread at a time is fine.
class LL_COMMON_API LLCallStacks
@@ -367,10 +373,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