[Libreoffice-commits] core.git: desktop/Library_crashreport.mk desktop/Library_sofficeapp.mk desktop/Module_desktop.mk desktop/source include/desktop Repository.mk

Markus Mohrhard markus.mohrhard at googlemail.com
Fri Feb 26 15:01:53 UTC 2016


 Repository.mk                      |    1 
 desktop/Library_crashreport.mk     |   44 +++++++++++++++++++++++++++++++++++++
 desktop/Library_sofficeapp.mk      |   12 +++++-----
 desktop/Module_desktop.mk          |    1 
 desktop/source/app/crashreport.cxx |   16 +++++--------
 desktop/source/app/sofficemain.cxx |   15 ++++++++++--
 include/desktop/crashreport.hxx    |    6 ++---
 include/desktop/dllapi.h           |    6 +++++
 8 files changed, 82 insertions(+), 19 deletions(-)

New commits:
commit 98df76f26a808940935f1218586443e0d9328d0d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Nov 26 00:15:27 2015 +0100

    use the new ini file based minidump uploader
    
    Change-Id: Iaf85fb53e6eff34e268b6948d62ca84b7f8e6dd2
    Reviewed-on: https://gerrit.libreoffice.org/22558
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/Repository.mk b/Repository.mk
index 0f6fc18..83cfeb0 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -543,6 +543,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo, \
 	collator_data \
 	comphelper \
 	$(call gb_Helper_optional,DBCONNECTIVITY,dbpool2) \
+	$(call gb_Helper_optional,BREAKPAD,crashreport) \
 	deployment \
 	deploymentgui \
 	dict_ja \
diff --git a/desktop/Library_crashreport.mk b/desktop/Library_crashreport.mk
new file mode 100644
index 0000000..5b14519
--- /dev/null
+++ b/desktop/Library_crashreport.mk
@@ -0,0 +1,44 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Library_Library,crashreport))
+
+$(eval $(call gb_Library_set_include,crashreport,\
+    $$(INCLUDE) \
+    -I$(SRCDIR)/desktop/inc \
+))
+
+$(eval $(call gb_Library_use_external,crashreport,breakpad))
+
+$(eval $(call gb_Library_add_defs,crashreport,\
+    -DCRASHREPORT_DLLIMPLEMENTATION \
+))
+
+$(eval $(call gb_Library_add_libs,crashreport,\
+    $(if $(filter LINUX %BSD SOLARIS, $(OS)), \
+        $(DLOPEN_LIBS) \
+        -lpthread \
+    ) \
+))
+
+$(eval $(call gb_Library_use_libraries,crashreport,\
+    comphelper \
+    cppu \
+    cppuhelper \
+    sal \
+    salhelper \
+	$(gb_UWINAPI) \
+))
+
+$(eval $(call gb_Library_add_exception_objects,crashreport,\
+    desktop/source/app/crashreport \
+))
+
+
+# vim: set ts=4 sw=4 et:
diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk
index 99fa979..d24f615 100644
--- a/desktop/Library_sofficeapp.mk
+++ b/desktop/Library_sofficeapp.mk
@@ -25,6 +25,10 @@ $(eval $(call gb_Library_add_libs,sofficeapp,\
 
 $(eval $(call gb_Library_use_external,sofficeapp,boost_headers))
 
+ifeq ($(ENABLE_BREAKPAD),TRUE)
+$(eval $(call gb_Library_use_external,sofficeapp,breakpad))
+endif
+
 $(eval $(call gb_Library_use_custom_headers,sofficeapp,\
 	officecfg/registry \
 ))
@@ -44,6 +48,9 @@ $(eval $(call gb_Library_use_libraries,sofficeapp,\
     comphelper \
     cppu \
     cppuhelper \
+    $(if $(filter TRUE,$(ENABLE_BREAKPAD)), \
+        crashreport \
+    ) \
     deploymentmisc \
     editeng \
     i18nlangtag \
@@ -86,7 +93,6 @@ $(eval $(call gb_Library_add_exception_objects,sofficeapp,\
     desktop/source/app/check_ext_deps \
     desktop/source/app/cmdlineargs \
     desktop/source/app/cmdlinehelp \
-    desktop/source/app/crashreport \
     desktop/source/app/desktopcontext \
     desktop/source/app/desktopresid \
     desktop/source/app/dispatchwatcher \
@@ -117,10 +123,6 @@ $(eval $(call gb_Library_add_libs,sofficeapp,\
 endif
 endif
 
-ifeq ($(ENABLE_BREAKPAD),TRUE)
-$(eval $(call gb_Library_use_external,sofficeapp,breakpad))
-endif
-
 # LibreOfficeKit bits
 ifneq ($(filter $(OS),ANDROID IOS MACOSX WNT),)
 $(eval $(call gb_Library_add_exception_objects,sofficeapp,\
diff --git a/desktop/Module_desktop.mk b/desktop/Module_desktop.mk
index c87a777..619c060 100644
--- a/desktop/Module_desktop.mk
+++ b/desktop/Module_desktop.mk
@@ -17,6 +17,7 @@ $(eval $(call gb_Module_add_targets,desktop,\
     Library_deploymentmisc \
     Library_offacc \
     Library_sofficeapp \
+    $(if $(ENABLE_BREAKPAD),Library_crashreport) \
     $(if $(ENABLE_HEADLESS),,Library_spl) \
     Package_branding \
     $(if $(CUSTOM_BRAND_DIR),Package_branding_custom) \
diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx
index 4065b4d..1ded7f0 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 e89dcdc..742bbba 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);
diff --git a/include/desktop/crashreport.hxx b/include/desktop/crashreport.hxx
index 02cc5a0..b9bbb7c 100644
--- a/include/desktop/crashreport.hxx
+++ b/include/desktop/crashreport.hxx
@@ -27,14 +27,14 @@
  *      * AdapterDeviceId
  *
  */
-class DESKTOP_DLLPUBLIC CrashReporter
+class CRASHREPORT_DLLPUBLIC CrashReporter
 {
 public:
     static void AddKeyValue(const OUString& rKey, const OUString& rValue);
 
-private:
+    static const char* getIniFileName();
 
-    static std::map<OUString, OUString> maValueMap;
+private:
 
     static osl::Mutex maMutex;
 };
diff --git a/include/desktop/dllapi.h b/include/desktop/dllapi.h
index ebc75f1..fd23aeb 100644
--- a/include/desktop/dllapi.h
+++ b/include/desktop/dllapi.h
@@ -19,6 +19,12 @@
 #   define DESKTOP_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
 #endif
 
+#if defined(CRASHREPORT_DLLIMPLEMENTATION)
+#   define CRASHREPORT_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#   define CRASHREPORT_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
 #endif
 
 /* vim: set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list