diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h index 170930c8c..7770ff4c5 100644 --- a/indra/llcommon/llevents.h +++ b/indra/llcommon/llevents.h @@ -182,10 +182,10 @@ public: bool operator! () const { return ! mListener; } /// explicit accessor - const LLEventListener& getListener() const { return *mListener; } + const ::LLEventListener& getListener() const { return *mListener; } /// implicit conversion to LLEventListener - operator LLEventListener() const { return *mListener; } + operator ::LLEventListener() const { return *mListener; } /// allow calling directly bool operator()(const LLSD& event) const; @@ -277,7 +277,7 @@ namespace LLEventDetail /// Any callable capable of connecting an LLEventListener to an /// LLStandardSignal to produce an LLBoundListener can be mapped to this /// signature. - typedef boost::function ConnectFunc; + typedef boost::function ConnectFunc; /// overload of visit_and_connect() when we have a string identifier available template @@ -547,7 +547,7 @@ private: virtual void reset(); private: - virtual LLBoundListener listen_impl(const std::string& name, const LLEventListener&, + virtual LLBoundListener listen_impl(const std::string& name, const ::LLEventListener&, const NameList& after, const NameList& before); std::string mName; @@ -845,7 +845,7 @@ namespace LLEventDetail * Visitor binds a reference to LLEventListener so we can track() any * shared_ptrs we find in the argument list. */ - Visitor(LLEventListener& listener): + Visitor(::LLEventListener& listener): mListener(listener) { } @@ -988,7 +988,7 @@ namespace LLEventDetail |*==========================================================================*/ /// Bind a reference to the LLEventListener to call its track() method. - LLEventListener& mListener; + ::LLEventListener& mListener; }; /** @@ -1005,7 +1005,7 @@ namespace LLEventDetail const ConnectFunc& connect_func) { // Capture the listener - LLEventListener listener(raw_listener); + ::LLEventListener listener(raw_listener); // Define our Visitor, binding the listener so we can call // listener.track() if we discover any shared_ptr. LLEventDetail::Visitor visitor(listener); diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 77382fd07..06cbfa569 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -220,13 +220,40 @@ #include #include #include +#include #include #include "llnotificationsutil.h" #include "llversioninfo.h" + + +template +struct crashpad_annotation : public crashpad::Annotation { + std::array buffer; + crashpad_annotation(const char* name) : crashpad::Annotation(T, name, buffer.data()) + {} + void set(const std::string& src) { + LL_INFOS() << name() << ": " << src.c_str() << LL_ENDL; + const size_t min_size = llmin(SIZE, src.size()); + memcpy(buffer.data(), src.data(), min_size); + buffer.data()[SIZE - 1] = '\0'; + SetSize(min_size); + } +}; +#define DEFINE_CRASHPAD_ANNOTATION(name, len) \ +static crashpad_annotation g_crashpad_annotation_##name##_buffer(#name); +#define SET_CRASHPAD_ANNOTATION_VALUE(name, value) \ +g_crashpad_annotation_##name##_buffer.set(value); +#else +#define SET_CRASHPAD_ANNOTATION_VALUE(name, value) +#define DEFINE_CRASHPAD_ANNOTATION(name, len) #endif +DEFINE_CRASHPAD_ANNOTATION(fatal_message, 512); +DEFINE_CRASHPAD_ANNOTATION(grid_name, 64); +DEFINE_CRASHPAD_ANNOTATION(cpu_string, 128); +DEFINE_CRASHPAD_ANNOTATION(startup_state, 32); ////// Windows-specific includes to the bottom - nasty defines in these pollute the preprocessor // @@ -770,8 +797,18 @@ bool LLAppViewer::init() initCrashReporting(); #endif + writeDebugInfo(); + setupErrorHandling(); + { + auto fn = boost::bind([](const LLSD& stateInfo) -> bool { + SET_CRASHPAD_ANNOTATION_VALUE(startup_state, stateInfo["str"].asString()); + return false; + }, _1); + LLStartUp::getStateEventPump().listen<::LLEventListener>("LLAppViewer", fn); + } + // // Start of the application // @@ -2741,6 +2778,10 @@ void LLAppViewer::writeDebugInfo(bool isStatic) isStatic ? LLSDSerialize::toPrettyXML(gDebugInfo, out_file) : LLSDSerialize::toPrettyXML(gDebugInfo["Dynamic"], out_file); +#else + SET_CRASHPAD_ANNOTATION_VALUE(fatal_message, gDebugInfo["FatalMessage"].asString()); + SET_CRASHPAD_ANNOTATION_VALUE(grid_name, gDebugInfo["GridName"].asString()); + SET_CRASHPAD_ANNOTATION_VALUE(cpu_string, gDebugInfo["CPUInfo"]["CPUString"].asString()); #endif } diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h index 71f89e59b..88cdac5e6 100644 --- a/indra/newview/llstartup.h +++ b/indra/newview/llstartup.h @@ -139,6 +139,7 @@ public: static bool startLLProxy(); // Initialize the SOCKS 5 proxy static LLViewerStats::PhaseMap& getPhases() { return *sPhases; } + static LLEventPump& getStateEventPump() { return *sStateWatcher; } private: static LLSLURL sStartSLURL;