From 09fea3f2b2a85e5917476cfbeae938bc371a0606 Mon Sep 17 00:00:00 2001 From: Nicky Date: Mon, 21 Feb 2022 06:19:09 +0100 Subject: [PATCH] Linux; Crash reporting. Implement CRASH_BEHAVIOR_ASK with a simple FTLK choice dialog. --- indra/linux_crash_logger/CMakeLists.txt | 4 +--- .../linux_crash_logger/linux_crash_logger.cpp | 11 +++++++++++ indra/newview/llappviewerlinux.cpp | 18 +++++++++++------- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/indra/linux_crash_logger/CMakeLists.txt b/indra/linux_crash_logger/CMakeLists.txt index deab5f3087..ab8ef14fce 100644 --- a/indra/linux_crash_logger/CMakeLists.txt +++ b/indra/linux_crash_logger/CMakeLists.txt @@ -53,15 +53,13 @@ set(LIBRT_LIBRARY rt) target_link_libraries(linux-crash-logger - ${LLCOMMON_LIBRARIES} - ${BOOST_FIBER_LIBRARY} - ${BOOST_CONTEXT_LIBRARY} ${UI_LIBRARIES} ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES} ${CRYPTO_LIBRARIES} ${ZLIB_LIBRARIES} ${LIBRT_LIBRARY} + X11 ) add_custom_target(linux-crash-logger-target ALL diff --git a/indra/linux_crash_logger/linux_crash_logger.cpp b/indra/linux_crash_logger/linux_crash_logger.cpp index 307acc955e..5d55e551a4 100644 --- a/indra/linux_crash_logger/linux_crash_logger.cpp +++ b/indra/linux_crash_logger/linux_crash_logger.cpp @@ -27,6 +27,7 @@ #include #include #include +#include /* Called via execl( gCrashLogger.c_str(), gCrashLogger.c_str(), descriptor.path(), gVersion.c_str(), gBugsplatDB.c_str(), nullptr ); @@ -48,7 +49,17 @@ int main(int argc, char **argv) std::string dmpFile{ argv[1] }; std::string version{ argv[2] }; std::string strDb{ argv[3] }; + std::string strAsk{ argv[4] }; + if( strAsk == "ask" ) + { + auto choice = fl_choice( "Firestorm has crashed, submit the minidump?", "No", "Yes", nullptr ); + if( choice == 0 ) + { + std::cerr << "Abort send due to users choice" << std::endl; + return 0; + } + } std::string url{ "https://" }; url += strDb; diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp index 8a802183d5..99716e9ede 100644 --- a/indra/newview/llappviewerlinux.cpp +++ b/indra/newview/llappviewerlinux.cpp @@ -144,11 +144,12 @@ LLAppViewerLinux::~LLAppViewerLinux() std::string gCrashLogger; std::string gVersion; std::string gBugsplatDB; +std::string gCrashBehavior; static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void* context, bool succeeded) { if( fork() == 0 ) - execl( gCrashLogger.c_str(), gCrashLogger.c_str(), descriptor.path(), gVersion.c_str(), gBugsplatDB.c_str(), nullptr ); + execl( gCrashLogger.c_str(), gCrashLogger.c_str(), descriptor.path(), gVersion.c_str(), gBugsplatDB.c_str(), gCrashBehavior.c_str(), nullptr ); return succeeded; } @@ -187,12 +188,9 @@ void setupBreadpad() LL_INFOS("BUGSPLAT") << "Initializing with crash logger: " << gCrashLogger << " database: " << gBugsplatDB << " version: " << gVersion << LL_ENDL; - google_breakpad::MinidumpDescriptor *descriptor = new google_breakpad::MinidumpDescriptor( - gDirUtilp->getExpandedFilename(LL_PATH_DUMP, "")); - google_breakpad::ExceptionHandler *eh = new google_breakpad::ExceptionHandler(*descriptor, NULL, dumpCallback, NULL, - true, -1); + google_breakpad::MinidumpDescriptor *descriptor = new google_breakpad::MinidumpDescriptor(gDirUtilp->getExpandedFilename(LL_PATH_DUMP, "")); + google_breakpad::ExceptionHandler *eh = new google_breakpad::ExceptionHandler(*descriptor, NULL, dumpCallback, NULL, true, -1); } - #endif bool LLAppViewerLinux::init() @@ -208,8 +206,14 @@ bool LLAppViewerLinux::init() S32 nCrashSubmitBehavior = gCrashSettings.getS32("CrashSubmitBehavior"); // For the first version we just consider always send and create a nice dialog for CRASH_BEHAVIOR_ASK later. - if (success && nCrashSubmitBehavior == CRASH_BEHAVIOR_ALWAYS_SEND) + if (success && nCrashSubmitBehavior != CRASH_BEHAVIOR_NEVER_SEND ) + { + if( nCrashSubmitBehavior == CRASH_BEHAVIOR_ASK ) + gCrashBehavior = "ask"; + else + gCrashBehavior = "send"; setupBreadpad(); + } #endif return success;