From 0c15cf444bc80992c67b3d7eae8c71526d9a078d Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Mon, 23 Nov 2015 17:48:16 +0100 Subject: upload crashes correctly to server for linux Change-Id: I75778dc572a2888b3966cb5731f7e59209c7a942 Reviewed-on: https://gerrit.libreoffice.org/22551 Reviewed-by: Markus Mohrhard Tested-by: Markus Mohrhard --- desktop/source/app/sofficemain.cxx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx index b14df2f30a15..3c93c681a919 100644 --- a/desktop/source/app/sofficemain.cxx +++ b/desktop/source/app/sofficemain.cxx @@ -19,6 +19,7 @@ #include #include +#include #include "desktopdllapi.h" @@ -61,26 +62,39 @@ #if HAVE_FEATURE_BREAKPAD +OString getLibDir() +{ + OUString aOriginal = "$BRAND_BASE_DIR/" LIBO_ETC_FOLDER; + rtl::Bootstrap::expandMacros(aOriginal); + + return rtl::OUStringToOString(aOriginal, RTL_TEXTENCODING_UTF8); +} + #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void* /*context*/, bool succeeded) { // send the minidump to the server (not yet implemented) - SAL_WARN("sofficemain", "minidump generated: " << descriptor.path()); + SAL_WARN("crashreport", "minidump generated: " << descriptor.path()); + OString aCommand = getLibDir().copy(7) + "/minidump_upload -p LibreOffice -v \"5.1.0.0\" "; + aCommand = aCommand + descriptor.path() + " " + "http://libreofficecrash.org/submit"; + int retVal = std::system(aCommand.getStr()); + SAL_WARN_IF(retVal != 0, "crashreport", "Failed to upload minidump. Error Code: " << retVal); return succeeded; } #endif #endif - 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 #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID google_breakpad::MinidumpDescriptor descriptor("/tmp"); google_breakpad::ExceptionHandler eh(descriptor, NULL, dumpCallback, NULL, true, -1); -#endif +#else +#endif #endif #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) -- cgit