summaryrefslogtreecommitdiffstats
path: root/desktop/source/app/crashreport.cxx
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-11-25 16:50:22 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-02-25 00:50:08 +0000
commit98a8eafa915b8d57b8bdccab9981e537d77f6f4a (patch)
treec0d7dea9b32eaad23762e9c238614af54ac5211c /desktop/source/app/crashreport.cxx
parentloplugin:implicitboolconversion (diff)
downloadcore-98a8eafa915b8d57b8bdccab9981e537d77f6f4a.tar.gz
core-98a8eafa915b8d57b8bdccab9981e537d77f6f4a.zip
add way to add additional information to the crash report
We can add several additional key value pairs during the execution of the program that will be used on the server to show more information. Change-Id: I4102adc15fc821415fa0b997ca7fe0dc4f7abcec Reviewed-on: https://gerrit.libreoffice.org/22553 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'desktop/source/app/crashreport.cxx')
-rw-r--r--desktop/source/app/crashreport.cxx33
1 files changed, 33 insertions, 0 deletions
diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx
new file mode 100644
index 000000000000..0bde05979a72
--- /dev/null
+++ b/desktop/source/app/crashreport.cxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ */
+
+#include <desktop/crashreport.hxx>
+
+#include <string>
+#include <fstream>
+
+osl::Mutex CrashReporter::maMutex;
+
+#if HAVE_FEATURE_BREAKPAD
+void CrashReporter::AddKeyValue(const OUString& rKey, const OUString& rValue)
+{
+ osl::MutexGuard aGuard(maMutex);
+ std::string ini_path = getIniFileName();
+ std::ofstream ini_file(ini_path, std::ios_base::app);
+ ini_file << rtl::OUStringToOString(rKey, RTL_TEXTENCODING_UTF8).getStr() << "=";
+ ini_file << rtl::OUStringToOString(rValue, RTL_TEXTENCODING_UTF8).getStr() << "\n";
+}
+#endif
+
+const char* CrashReporter::getIniFileName()
+{
+ return "/tmp/dump.ini";
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */