diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-11-26 00:15:27 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-02-26 15:01:24 +0000 |
commit | 98df76f26a808940935f1218586443e0d9328d0d (patch) | |
tree | 3dd542bcd80a03adef91dbd499323a8915666ea4 /desktop/source | |
parent | 8e9d171cf42931de44b00205a97c7801f07156a4 (diff) |
use the new ini file based minidump uploader
Change-Id: Iaf85fb53e6eff34e268b6948d62ca84b7f8e6dd2
Reviewed-on: https://gerrit.libreoffice.org/22558
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'desktop/source')
-rw-r--r-- | desktop/source/app/crashreport.cxx | 16 | ||||
-rw-r--r-- | desktop/source/app/sofficemain.cxx | 15 |
2 files changed, 20 insertions, 11 deletions
diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx index 4065b4dd5d9f..1ded7f0ed80e 100644 --- a/desktop/source/app/crashreport.cxx +++ b/desktop/source/app/crashreport.cxx @@ -16,15 +16,6 @@ osl::Mutex CrashReporter::maMutex; #if HAVE_FEATURE_BREAKPAD -namespace { - -const char* getIniFileName() -{ - return "/tmp/dump.ini"; -} - -} - void CrashReporter::AddKeyValue(const OUString& rKey, const OUString& rValue) { osl::MutexGuard aGuard(maMutex); @@ -33,6 +24,13 @@ void CrashReporter::AddKeyValue(const OUString& rKey, const OUString& rValue) ini_file << rtl::OUStringToOString(rKey, RTL_TEXTENCODING_UTF8).getStr() << "="; ini_file << rtl::OUStringToOString(rValue, RTL_TEXTENCODING_UTF8).getStr() << "\n"; } + #endif +const char* CrashReporter::getIniFileName() +{ + // TODO: we need a generic solution for the location + return "/tmp/dump.ini"; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx index e89dcdc3e0da..742bbba879cd 100644 --- a/desktop/source/app/sofficemain.cxx +++ b/desktop/source/app/sofficemain.cxx @@ -44,6 +44,8 @@ #include <unotools/mediadescriptor.hxx> #if HAVE_FEATURE_BREAKPAD +#include <fstream> +#include <desktop/crashreport.hxx> #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID #include <client/linux/handler/exception_handler.h> @@ -74,10 +76,13 @@ OString getLibDir() #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void* /*context*/, bool succeeded) { + std::string ini_path = CrashReporter::getIniFileName(); + std::ofstream minidump_file(ini_path, std::ios_base::app); + minidump_file << "DumpFile=" << descriptor.path() << "\n";; + minidump_file.close(); // send the minidump to the server (not yet implemented) SAL_WARN("destkop.crashreport", "minidump generated: " << descriptor.path()); - OString aCommand = getLibDir().copy(7) + "/minidump_upload -p LibreOffice -v \"" LIBO_VERSION_DOTTED "\" "; - aCommand = aCommand + descriptor.path() + " http://libreofficecrash.org/submit"; + OString aCommand = getLibDir().copy(7) + "/minidump_upload " + ini_path.c_str(); int retVal = std::system(aCommand.getStr()); SAL_WARN_IF(retVal != 0, "destkop.crashreport", "Failed to upload minidump. Error Code: " << retVal); return succeeded; @@ -90,6 +95,12 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main() #if HAVE_FEATURE_BREAKPAD //limit the amount of code that needs to be executed before the crash reporting + std::string ini_path = CrashReporter::getIniFileName(); + std::ofstream minidump_file(ini_path, std::ios_base::trunc); + minidump_file << "ProductName=LibreOffice\n"; + minidump_file << "Version=" << LIBO_VERSION_DOTTED << "\n"; + minidump_file.close(); + #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID google_breakpad::MinidumpDescriptor descriptor("/tmp"); google_breakpad::ExceptionHandler eh(descriptor, nullptr, dumpCallback, nullptr, true, -1); |