Kaydet (Commit) 98a8eafa authored tarafından Markus Mohrhard's avatar Markus Mohrhard

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/22553Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst aaca25d6
......@@ -87,6 +87,7 @@ $(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 \
......
......@@ -16,7 +16,7 @@
#include <com/sun/star/lang/XComponent.hpp>
#include <memory>
#include <map>
#include "../../source/inc/desktopdllapi.h"
#include <desktop/dllapi.h>
#include <osl/thread.h>
class LOKInteractionHandler;
......
/* -*- 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: */
......@@ -21,7 +21,7 @@
#include <config_features.h>
#include <config_folders.h>
#include "desktopdllapi.h"
#include <desktop/dllapi.h>
#include "app.hxx"
#include "exithelper.h"
......
......@@ -20,7 +20,7 @@
#ifndef INCLUDED_DESKTOP_SOURCE_APP_SOFFICEMAIN_H
#define INCLUDED_DESKTOP_SOURCE_APP_SOFFICEMAIN_H
#include "desktopdllapi.h"
#include <desktop/dllapi.h>
#if defined __cplusplus
extern "C" {
......
......@@ -18,7 +18,7 @@
*/
#include "desktopdllapi.h"
#include <desktop/dllapi.h>
#include "dp_misc.h"
#include "unopkg_main.h"
#include "unopkg_shared.h"
......
......@@ -20,7 +20,7 @@
#ifndef INCLUDED_DESKTOP_SOURCE_PKGCHK_UNOPKG_UNOPKG_MAIN_H
#define INCLUDED_DESKTOP_SOURCE_PKGCHK_UNOPKG_UNOPKG_MAIN_H
#include "desktopdllapi.h"
#include <desktop/dllapi.h>
#if defined __cplusplus
extern "C" {
......
/* -*- 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/.
*/
#ifndef INCLUDED_DESKTOP_CRASHREPORT_HXX
#define INCLUDED_DESKTOP_CRASHREPORT_HXX
#include <desktop/dllapi.h>
#include <rtl/ustring.hxx>
#include <osl/mutex.hxx>
#include <config_features.h>
#include <map>
/**
* Provides access to the crash reporter service.
*
* Valid keys are:
* * AdapterVendorId
* * AdapterDeviceId
*
*/
class DESKTOP_DLLPUBLIC CrashReporter
{
public:
static void AddKeyValue(const OUString& rKey, const OUString& rValue);
const char* getIniFileName();
private:
static std::map<OUString, OUString> maValueMap;
static osl::Mutex maMutex;
};
// Add dummy methods for the non-breakpad case. That allows us to use
// the code without linking to the lib and without adding HAVE_FEATURE_BREAKPAD
// everywhere we want to log something to the crash report system.
#if HAVE_FEATURE_BREAKPAD
#else
void CrashReporter::AddKeyValue(const OUString& /*rKey*/, const OUString& /*rValue*/)
{
}
#endif
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment