[Libreoffice-commits] core.git: desktop/source include/desktop

Markus Mohrhard markus.mohrhard at googlemail.com
Thu May 19 00:24:03 UTC 2016


 desktop/source/app/crashreport.cxx |   37 ++++++++++++++++++++++++++++++++++++-
 desktop/source/app/sofficemain.cxx |    3 ++-
 include/desktop/crashreport.hxx    |   13 +++++++++++++
 3 files changed, 51 insertions(+), 2 deletions(-)

New commits:
commit 2dcd1ae04c599025267f74edc298707ef6f94c0d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Apr 11 10:04:48 2016 +0200

    update the location for breakpad as soon as we have access to profile
    
    Change-Id: I33b29c06fdc9ec9b6d4c7d5f1b6db6024f39e92e
    Reviewed-on: https://gerrit.libreoffice.org/24027
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx
index 329b3a4..219d8dd 100644
--- a/desktop/source/app/crashreport.cxx
+++ b/desktop/source/app/crashreport.cxx
@@ -21,6 +21,12 @@ osl::Mutex CrashReporter::maMutex;
 
 #if HAVE_FEATURE_BREAKPAD
 
+#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID
+#include <client/linux/handler/exception_handler.h>
+#endif
+
+google_breakpad::ExceptionHandler* CrashReporter::mpExceptionHandler = nullptr;
+
 void CrashReporter::AddKeyValue(const OUString& rKey, const OUString& rValue)
 {
     osl::MutexGuard aGuard(maMutex);
@@ -41,14 +47,43 @@ void CrashReporter::writeCommonInfo()
     minidump_file << "Version=" LIBO_VERSION_DOTTED "\n";
     minidump_file << "URL=http://127.0.0.1:8000/submit\n";
     minidump_file.close();
+
+    updateMinidumpLocation();
 }
 
-std::string CrashReporter::getIniFileName()
+namespace {
+
+OUString getCrashUserProfileDirectory()
 {
     OUString url("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/crash/");
     rtl::Bootstrap::expandMacros(url);
     osl::Directory::create(url);
 
+    return url;
+}
+
+}
+
+void CrashReporter::updateMinidumpLocation()
+{
+    OUString aURL = getCrashUserProfileDirectory();
+    OString aOStringUrl = OUStringToOString(aURL, RTL_TEXTENCODING_UTF8);
+
+#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID
+    google_breakpad::MinidumpDescriptor descriptor(aOStringUrl.getStr());
+    mpExceptionHandler->set_minidump_descriptor(descriptor);
+#else
+#endif
+}
+
+void CrashReporter::storeExceptionHandler(google_breakpad::ExceptionHandler* pExceptionHandler)
+{
+    mpExceptionHandler = pExceptionHandler;
+}
+
+std::string CrashReporter::getIniFileName()
+{
+    OUString url = getCrashUserProfileDirectory();
     OString aUrl = OUStringToOString(url, RTL_TEXTENCODING_UTF8);
     std::string aRet(aUrl.getStr());
     return aRet;
diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx
index 4a7ddfc..fec226d 100644
--- a/desktop/source/app/sofficemain.cxx
+++ b/desktop/source/app/sofficemain.cxx
@@ -83,9 +83,10 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main()
 #if HAVE_FEATURE_BREAKPAD
 
 #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID
-    // TODO: we need a better location for this
     google_breakpad::MinidumpDescriptor descriptor("/tmp");
     google_breakpad::ExceptionHandler eh(descriptor, nullptr, dumpCallback, nullptr, true, -1);
+
+    CrashReporter::storeExceptionHandler(&eh);
 #else
 
 #endif
diff --git a/include/desktop/crashreport.hxx b/include/desktop/crashreport.hxx
index 05b1fd8..e58e387 100644
--- a/include/desktop/crashreport.hxx
+++ b/include/desktop/crashreport.hxx
@@ -20,6 +20,11 @@
 #include <map>
 #include <string>
 
+namespace google_breakpad
+{
+class ExceptionHandler;
+}
+
 /**
  * Provides access to the crash reporter service.
  *
@@ -42,9 +47,17 @@ public:
 
     static void writeCommonInfo();
 
+    static void storeExceptionHandler(google_breakpad::ExceptionHandler* pExceptionHandler);
+
+    // when we create the ExceptionHandler we have no access to the user
+    // profile yet, so update when we have access
+    static void updateMinidumpLocation();
+
 private:
 
     static osl::Mutex maMutex;
+
+    static google_breakpad::ExceptionHandler* mpExceptionHandler;
 };
 
 // Add dummy methods for the non-breakpad case. That allows us to use


More information about the Libreoffice-commits mailing list