From 88cb6814f0883cdce15ca1942409da708ab07af5 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 7 Mar 2016 11:24:48 -0500 Subject: SL-315 WIP - more call stack tracing, initial hooks for avatar reset skeleton option. --- indra/llcommon/llcallstack.cpp | 40 +++++++++++++++++++++++++++++++++++++--- indra/llcommon/llcallstack.h | 6 ++++-- 2 files changed, 41 insertions(+), 5 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llcallstack.cpp b/indra/llcommon/llcallstack.cpp index 2409f7a876..9978645ff4 100644 --- a/indra/llcommon/llcallstack.cpp +++ b/indra/llcommon/llcallstack.cpp @@ -29,6 +29,7 @@ #include "llcommon.h" #include "llcallstack.h" #include "StackWalker.h" +#include "llthreadlocalstorage.h" #if LL_WINDOWS class LLCallStackImpl: public StackWalker @@ -88,6 +89,19 @@ LLCallStack::LLCallStack(S32 skip_count, bool verbose): s_impl->getStack(m_strings, m_skipCount, m_verbose); } +bool LLCallStack::contains(const std::string& str) +{ + for (std::vector::const_iterator it = m_strings.begin(); + it != m_strings.end(); ++it) + { + if (it->find(str) != std::string::npos) + { + return true; + } + } + return false; +} + std::ostream& operator<<(std::ostream& s, const LLCallStack& call_stack) { std::vector::const_iterator it; @@ -98,8 +112,6 @@ std::ostream& operator<<(std::ostream& s, const LLCallStack& call_stack) return s; } -#include "llthreadlocalstorage.h" - LLContextStrings::LLContextStrings() { } @@ -135,18 +147,40 @@ void LLContextStrings::removeContextString(const std::string& str) } } +// static +bool LLContextStrings::contains(const std::string& str) +{ + const std::map& strings = + LLThreadLocalSingletonPointer::getInstance()->m_contextStrings; + for (std::map::const_iterator it = strings.begin(); it!=strings.end(); ++it) + { + if (it->first.find(str) != std::string::npos) + { + return true; + } + } + return false; +} + // static void LLContextStrings::output(std::ostream& os) { - const std::map& strings = LLThreadLocalSingletonPointer::getInstance()->m_contextStrings; + const std::map& strings = + LLThreadLocalSingletonPointer::getInstance()->m_contextStrings; for (std::map::const_iterator it = strings.begin(); it!=strings.end(); ++it) { os << it->first << "[" << it->second << "]" << "\n"; } } +// static std::ostream& operator<<(std::ostream& s, const LLContextStatus& context_status) { LLThreadLocalSingletonPointer::getInstance()->output(s); return s; } + +bool LLContextStatus::contains(const std::string& str) +{ + return LLThreadLocalSingletonPointer::getInstance()->contains(str); +} diff --git a/indra/llcommon/llcallstack.h b/indra/llcommon/llcallstack.h index 7196907980..1f7a7689d7 100644 --- a/indra/llcommon/llcallstack.h +++ b/indra/llcommon/llcallstack.h @@ -34,6 +34,7 @@ public: LLCallStack(S32 skip_count=0, bool verbose=false); std::vector m_strings; bool m_verbose; + bool contains(const std::string& str); private: static LLCallStackImpl *s_impl; S32 m_skipCount; @@ -49,6 +50,7 @@ public: static void removeContextString(const std::string& str); static void output(std::ostream& os); static LLContextStrings* getThreadLocalInstance(); + static bool contains(const std::string& str); private: std::map m_contextStrings; }; @@ -69,10 +71,10 @@ private: std::string m_str; }; -// This doesn't really have any state, just acts as class to hook the -// ostream override to. +// Mostly exists as a class to hook an ostream override to. struct LLContextStatus { + bool contains(const std::string& str); }; LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLContextStatus& context_status); -- cgit v1.3