From c5f618d096f05bdff91a5d384c46e26840f5a771 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 17 May 2018 06:53:42 -0400 Subject: SL-821: Move Windows BugSplat engagement from llcommon to newview. Use WSTRINGIZE(), LL_TO_WSTRING(), wstringize() to produce required wide strings. Use a lambda for callback that sends log file; use LLDir, if set, to find the log file. Introduce BUGSPLAT CMake variable to allow suppressing BugSplat. Make BUGSPLAT CMake variable set LL_BUGSPLAT for C++ compilations. Set viewer version macros on llappviewerwin32.cpp, llappviewerlinux.cpp and llappdelegate-objc.mm -- because BugSplat needs the viewer version data, and because the macOS BugSplat hook is engaged in an Objective-C++ function we override in the app delegate. --- indra/llcommon/CMakeLists.txt | 10 +------- indra/llcommon/llapp.cpp | 60 +++---------------------------------------- indra/llcommon/llapp.h | 10 +------- 3 files changed, 5 insertions(+), 75 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 4eba1d5451..d9eb13d65a 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -13,7 +13,6 @@ include(GoogleBreakpad) include(Copy3rdPartyLibs) include(ZLIB) include(URIPARSER) -include(BuildVersion) include_directories( ${EXPAT_INCLUDE_DIRS} @@ -254,14 +253,7 @@ set(llcommon_HEADER_FILES ) set_source_files_properties(${llcommon_HEADER_FILES} - PROPERTIES HEADER_FILE_ONLY TRUE - ) - -# bring in version information for BugSplat crash reporting -set_source_files_properties(${llcommon_SOURCE_FILES} - PROPERTIES - COMPILE_DEFINITIONS "${VIEWER_CHANNEL_VERSION_DEFINES}" # see BuildVersion.cmake - ) + PROPERTIES HEADER_FILE_ONLY TRUE) list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES}) diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index 3e652dbdb5..6cc9e804d4 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -49,20 +49,6 @@ #include "google_breakpad/exception_handler.h" #include "stringize.h" #include "llcleanup.h" -#include "BugSplat.h" - -// TESTING ONLY - REMOVE FOR PRODUCTION -// (Want to only invoke BugSplat crash reporting in the same way we did for Breakpad - for Release viewers -// but need to test here in a ReleaseWithDebugInfo environment) -#if BUGSPLAT_ENABLED -#define LL_SEND_CRASH_REPORTS 1 -#endif - -// BugSplat crash reporting tool - http://bugsplat.com -#if BUGSPLAT_ENABLED -bool BugSplatExceptionCallback(unsigned int nCode, void* lpVal1, void* lpVal2); -MiniDmpSender *gBugSplatSender; -#endif // // Signal handling @@ -399,26 +385,6 @@ void EnableCrashingOnCrashes() } #endif -#if BUGSPLAT_ENABLED -bool BugSplatExceptionCallback(unsigned int nCode, void* lpVal1, void* lpVal2) -{ - switch (nCode) - { - case MDSCB_EXCEPTIONCODE: - { - // send the main viewer log file (Clearly a temporary hack since we don't have access to the gDir*** set of functions in newview - const std::string appdata = std::string(getenv("APPDATA")); - const std::string logfile = appdata + "\\SecondLife\\logs\\Secondlife.log"; - const std::wstring wide_logfile(logfile.begin(), logfile.end()); - gBugSplatSender->sendAdditionalFile((const __wchar_t *)wide_logfile.c_str()); - } - break; - } - - return false; -} -#endif - void LLApp::setupErrorHandling(bool second_instance) { // Error handling is done by starting up an error handling thread, which just sleeps and @@ -427,25 +393,6 @@ void LLApp::setupErrorHandling(bool second_instance) #if LL_WINDOWS #if LL_SEND_CRASH_REPORTS - -#if BUGSPLAT_ENABLED - // TODOCP: populate these fields correctly - static const wchar_t *bugdb_name = L"second_life_callum_test"; - - // build (painfully) the app/channel name - #define stringize_inner(x) L#x - #define stringize_outer(x) stringize_inner(x) - std::wstring app_name(stringize_outer(LL_VIEWER_CHANNEL)); - - // build in real app version now we leveraged CMake to build in BuildVersion.cmake into LLCommon - wchar_t version_string[MAX_STRING]; - wsprintf(version_string, L"%d.%d.%d.%d", LL_VIEWER_VERSION_MAJOR, LL_VIEWER_VERSION_MINOR, LL_VIEWER_VERSION_PATCH, LL_VIEWER_VERSION_BUILD); - - gBugSplatSender = new MiniDmpSender((const __wchar_t *)bugdb_name, (const __wchar_t *)app_name.c_str(), (const __wchar_t *)version_string, NULL); - - gBugSplatSender->setCallback(BugSplatExceptionCallback); -#else - EnableCrashingOnCrashes(); // This sets a callback to handle w32 signals to the console window. @@ -507,9 +454,8 @@ void LLApp::setupErrorHandling(bool second_instance) mExceptionHandler->set_handle_debug_exceptions(true); } } -#endif // BUGSPLAT_ENABLED -#endif // LL_SEND_CRASH_REPORTS -#else // not LL_WINDOWS +#endif +#else // // Start up signal handling. // @@ -570,7 +516,7 @@ void LLApp::setupErrorHandling(bool second_instance) } #endif -#endif // LL_WINDOWS +#endif startErrorThread(); } diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h index 5a4b7f13df..acd829d864 100644 --- a/indra/llcommon/llapp.h +++ b/indra/llcommon/llapp.h @@ -30,7 +30,6 @@ #include #include "llrun.h" #include "llsd.h" - // Forward declarations template class LLAtomic32; typedef LLAtomic32 LLAtomicU32; @@ -40,14 +39,6 @@ class LLLiveFile; #include #endif -// first version of Bugsplat (http://bugsplat.com) crash reporting tool -// is only supported on Windows - macOS to follow. -#define BUGSPLAT_ENABLED LL_WINDOWS - -#if BUGSPLAT_ENABLED -class __declspec(dllexport) MiniDmpSender; -#endif - typedef void (*LLAppErrorHandler)(); #if !LL_WINDOWS @@ -325,6 +316,7 @@ private: google_breakpad::ExceptionHandler * mExceptionHandler; + #if !LL_WINDOWS friend void default_unix_signal_handler(int signum, siginfo_t *info, void *); #endif -- cgit v1.2.3