From c7f39b50435fe428ea6b70cf830dd6349922ff95 Mon Sep 17 00:00:00 2001 From: Nicky Date: Wed, 9 Feb 2022 23:04:31 +0100 Subject: [PATCH] Linux; bring back breakpad. No upload to bugsplat implemented yet. --- autobuild.xml | 28 ++++++++++++++ indra/cmake/bugsplat.cmake | 13 +++++-- indra/newview/fs_viewer_manifest.py | 60 +++++++++++++++++++++++++++++ indra/newview/llappviewerlinux.cpp | 24 +++++++++++- indra/newview/viewer_manifest.py | 1 + scripts/configure_firestorm.sh | 2 +- 6 files changed, 122 insertions(+), 6 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index e25cef33e2..c8acd9d9d8 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -3,6 +3,34 @@ installables + breakpad + + copyright + Copyright (C) google + license + BSD + license_file + LICENSES/google_breakpad.txt + name + breakpad + platforms + + linux64 + + archive + + hash + 482c2b25bbfd25edc058a02f82da39b2 + url + http://3p.firestormviewer.org/breakpad-4708e6fb-linux64_bionic-220392253.tar.bz2 + + name + linux + + + version + 2.48.0 + glib copyright diff --git a/indra/cmake/bugsplat.cmake b/indra/cmake/bugsplat.cmake index f709f35403..af8610e261 100644 --- a/indra/cmake/bugsplat.cmake +++ b/indra/cmake/bugsplat.cmake @@ -12,17 +12,19 @@ endif (INSTALL_PROPRIETARY) if (USE_BUGSPLAT) if (NOT USESYSTEMLIBS) include(Prebuilt) - use_prebuilt_binary(bugsplat) if (WINDOWS) + use_prebuilt_binary(bugsplat) set(BUGSPLAT_LIBRARIES ${ARCH_PREBUILT_DIRS_RELEASE}/bugsplat.lib ) elseif (DARWIN) + use_prebuilt_binary(bugsplat) find_library(BUGSPLAT_LIBRARIES BugsplatMac REQUIRED NO_DEFAULT_PATH PATHS "${ARCH_PREBUILT_DIRS_RELEASE}") message("Bugsplat for OSX not fully implemented, please adapt llappdelegate-objc.mm to honor options of sending user name and settings.xml.") else (WINDOWS) - message(FATAL_ERROR "BugSplat is not supported; add -DUSE_BUGSPLAT=OFF") + use_prebuilt_binary(breakpad) + set(BUGSPLAT_LIBRARIES ${ARCH_PREBUILT_DIRS_RELEASE}/libbreakpad.a ${ARCH_PREBUILT_DIRS_RELEASE}/libbreakpad_client.a ) endif (WINDOWS) else (NOT USESYSTEMLIBS) set(BUGSPLAT_FIND_QUIETLY ON) @@ -32,7 +34,12 @@ if (USE_BUGSPLAT) set(BUGSPLAT_DB "" CACHE STRING "BugSplat crash database name") - set(BUGSPLAT_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/bugsplat) + if( LINUX ) + set(BUGSPLAT_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/breakpad) + add_compile_definitions(__STDC_FORMAT_MACROS) + else() + set(BUGSPLAT_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/bugsplat) + endif() set(BUGSPLAT_DEFINE "LL_BUGSPLAT") endif (USE_BUGSPLAT) diff --git a/indra/newview/fs_viewer_manifest.py b/indra/newview/fs_viewer_manifest.py index 5bea417026..2112ba1f54 100644 --- a/indra/newview/fs_viewer_manifest.py +++ b/indra/newview/fs_viewer_manifest.py @@ -162,3 +162,63 @@ class FSViewerManifest: if self.path( src,dst ) == 0: self.missing.pop() + def fs_generate_breakpad_symbols_for_file( self, aFile ): + from os import makedirs, remove + from os.path import join, isfile + import subprocess + from shutil import move + + dumpSym = join( self.args["build"], "..", "packages", "bin", "dump_syms" ) + if not isfile( dumpSym ): + return + + symbolFile = aFile +".sym" + + with open( symbolFile, "w") as outfile: + subprocess.call( [dumpSym, aFile ], stdout=outfile ) + + firstline = open( symbolFile ).readline().strip() + + if firstline != "": + module, os, bitness, hash, filename = firstline.split(" ") + symbolDir = join( "symbols", filename, hash ) + try: + makedirs( symbolDir ) + except: + pass + move( symbolFile, symbolDir ) + + if isfile( symbolFile ): + remove( symbolFile ) + + def fs_save_breakpad_symbols(self, osname): + from glob import glob + import sys + from os.path import isdir + from shutil import rmtree + import tarfile + + #if isdir( "symbols" ): + # rmtree( "symbols" ) + + #files = glob( "%s/bin/*" % self.args['dest'] ) + #for f in files: + # self.fs_generate_breakpad_symbols_for_file( f ) + + #files = glob( "%s/lib/*.so" % self.args['dest'] ) + #for f in files: + # self.fs_generate_breakpad_symbols_for_file( f ) + + + if isdir( "symbols" ): + for a in self.args: + print("%s: %s" % (a, self.args[a])) + symbolsName = "%s/Phoenix_%s_%s_%s_symbols-%s-%d.tar.bz2" % (self.args['configuration'].lower(), + self.fs_channel_legacy_oneword(), + '-'.join( self.args['version'] ), + self.args['viewer_flavor'], + osname, + self.address_size) + + fTar = tarfile.open( symbolsName, "w:bz2") + fTar.add("symbols", arcname=".") diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp index af00bd64e7..650f710f08 100644 --- a/indra/newview/llappviewerlinux.cpp +++ b/indra/newview/llappviewerlinux.cpp @@ -45,6 +45,12 @@ #include +#if LL_SEND_CRASH_REPORTS +#include "breakpad/client/linux/handler/exception_handler.h" +#include "breakpad/common/linux/http_upload.h" +#include "lldir.h" +#endif + #define VIEWERAPI_SERVICE "com.secondlife.ViewerAppAPIService" #define VIEWERAPI_PATH "/com/secondlife/ViewerAppAPI" #define VIEWERAPI_INTERFACE "com.secondlife.ViewerAppAPI" @@ -131,6 +137,20 @@ LLAppViewerLinux::~LLAppViewerLinux() { } +static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void* context, bool succeeded) +{ + std::map< std::string, std::string> parameters, files; + parameters["prod"] = "MyApp"; + parameters["ver"] = "1.0"; + parameters["email"] = "fred@bugsplat.com"; + parameters["comments"] = "BugSplat rocks!"; + files["upload_file_minidump"] = descriptor.path(); + + printf("Dump path: %s\n", descriptor.path() ); + return succeeded; +} + + bool LLAppViewerLinux::init() { // g_thread_init() must be called before *any* use of glib, *and* @@ -143,8 +163,8 @@ bool LLAppViewerLinux::init() #if LL_SEND_CRASH_REPORTS if (success) { - LLAppViewer* pApp = LLAppViewer::instance(); - pApp->initCrashReporting(); + 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 diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index f356d33adb..608601b6dd 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -2050,6 +2050,7 @@ class LinuxManifest(ViewerManifest): installer_name = "_".join(installer_name_components) #installer_name = self.installer_base_name() + self.fs_save_breakpad_symbols("linux") self.fs_delete_linux_symbols() # Delete old syms self.strip_binaries() self.fs_save_linux_symbols() # Package symbols, add debug link diff --git a/scripts/configure_firestorm.sh b/scripts/configure_firestorm.sh index 11e396faea..77f9606f8d 100755 --- a/scripts/configure_firestorm.sh +++ b/scripts/configure_firestorm.sh @@ -301,7 +301,7 @@ if [ ! -d `dirname "$LOG"` ] ; then mkdir -p `dirname "$LOG"` fi -if [ $TARGET_PLATFORM != "windows" ] +if [ $TARGET_PLATFORM == "darwin" ] then if [ $WANTS_CRASHREPORTING -eq $TRUE ] then