From 2dcd1ae04c599025267f74edc298707ef6f94c0d Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Mon, 11 Apr 2016 10:04:48 +0200 Subject: 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 Reviewed-by: Markus Mohrhard --- desktop/source/app/crashreport.cxx | 37 ++++++++++++++++++++++++++++++++++++- desktop/source/app/sofficemain.cxx | 3 ++- 2 files changed, 38 insertions(+), 2 deletions(-) (limited to 'desktop') diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx index 329b3a49a1fd..219d8dd60836 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 +#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 4a7ddfc13355..fec226d2cc6c 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 -- cgit