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.h36
1 files changed, 35 insertions, 1 deletions
diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h
index e39d19741b..6794be4904 100644
--- a/indra/llcommon/llerror.h
+++ b/indra/llcommon/llerror.h
@@ -38,6 +38,7 @@
#include <typeinfo>
#include "llerrorlegacy.h"
+#include "stdtypes.h"
/* Error Logging Facility
@@ -135,6 +136,7 @@ namespace LLError
public:
static bool shouldLog(CallSite&);
static std::ostringstream* out();
+ static void flush(std::ostringstream* out, char* message) ;
static void flush(std::ostringstream*, const CallSite&);
};
@@ -179,9 +181,41 @@ namespace LLError
class 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.
+ //
+ //Note: to be simple, efficient and necessary to keep track of correct call stacks,
+ //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 LLCallStacks
+ {
+ private:
+ static char** sBuffer ;
+ static S32 sIndex ;
+
+ public:
+ static void push(const char* function, const int line) ;
+ static std::ostringstream* insert(const char* function, const int line) ;
+ static void print() ;
+ static void clear() ;
+ static void end(std::ostringstream* _out) ;
+ };
+}
+//this is cheaper than llcallstacks if no need to output other variables to call stacks.
+#define llpushcallstacks LLError::LLCallStacks::push(__FUNCTION__, __LINE__)
+#define llcallstacks \
+ {\
+ std::ostringstream* _out = LLError::LLCallStacks::insert(__FUNCTION__, __LINE__) ; \
+ (*_out)
+#define llcallstacksendl \
+ LLError::End(); \
+ LLError::LLCallStacks::end(_out) ; \
+ }
+#define llclearcallstacks LLError::LLCallStacks::clear()
+#define llprintcallstacks LLError::LLCallStacks::print()
/*
Class type information for logging