summaryrefslogtreecommitdiff
path: root/indra/llcommon/llerror.h
diff options
context:
space:
mode:
authorBrad Kittenbrink <brad@lindenlab.com>2009-02-18 21:10:16 +0000
committerBrad Kittenbrink <brad@lindenlab.com>2009-02-18 21:10:16 +0000
commitabdc99f21b542c4fea67030ddbd7166c9d1c6c63 (patch)
tree3e984e405adfdec189ca8a047daca5250737ffbf /indra/llcommon/llerror.h
parent34412f0530cf6a411b4de906a8e9da59cbcb3a85 (diff)
Merge of QAR-1267 to trunk. This was a combo merge of QAR-1175 (maint-render-9) and QAR-1236 (dll-msvcrt-2)
svn merge -r 109838:112264 svn+ssh://svn.lindenlab.com/svn/linden/branches/maint-render/maint-render-9-merge-r109833
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