diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-04-11 10:04:48 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-05-19 00:23:43 +0000 |
commit | 2dcd1ae04c599025267f74edc298707ef6f94c0d (patch) | |
tree | 5fab6278ba0c6edfbf7314768067bf2db0c2257d /desktop | |
parent | 389d8db4d90d427f886d06c3f7304ad973f0d39c (diff) |
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@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/crashreport.cxx | 37 | ||||
-rw-r--r-- | desktop/source/app/sofficemain.cxx | 3 |
2 files changed, 38 insertions, 2 deletions
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 <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 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 |