1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #ifndef INCLUDED_DESKTOP_CRASHREPORT_HXX
11 #define INCLUDED_DESKTOP_CRASHREPORT_HXX
13 #include <desktop/dllapi.h>
15 #include <rtl/ustring.hxx>
16 #include <osl/mutex.hxx>
18 #include <config_features.h>
20 // vector not sort the entries
25 namespace google_breakpad
27 class ExceptionHandler
;
31 * Provides access to the crash reporter service.
39 #if HAVE_FEATURE_BREAKPAD
40 // MSVC 2013 has undefined symbols for inline functions if it's exported
43 /*class*/ CrashReporter
46 typedef enum {AddItem
, Write
, Create
} tAddKeyHandling
;
47 #if HAVE_FEATURE_BREAKPAD
48 static void addKeyValue(const OUString
& rKey
, const OUString
& rValue
, tAddKeyHandling AddKeyHandling
);
50 static void installExceptionHandler();
51 static void removeExceptionHandler();
53 static bool crashReportInfoExists();
55 static bool readSendConfig(std::string
& response
);
57 static bool IsDumpEnable();
60 static osl::Mutex maMutex
;
66 _mpair(const OUString
& First
, const OUString
& Second
)
73 typedef std::vector
<mpair
> vmaKeyValues
;
74 static vmaKeyValues maKeyValues
; // used to temporarily save entries before the old info has been uploaded
76 static std::unique_ptr
<google_breakpad::ExceptionHandler
> mpExceptionHandler
;
78 static std::string
getIniFileName();
79 static void writeCommonInfo();
80 static void writeToFile(std::ios_base::openmode Openmode
);
81 // when we create the ExceptionHandler we have no access to the user
82 // profile yet, so update when we have access
83 static void updateMinidumpLocation();
86 // Add dummy methods for the non-breakpad case. That allows us to use
87 // // the code without linking to the lib and without adding HAVE_FEATURE_BREAKPAD
88 // // everywhere we want to log something to the crash report system.
89 inline static void addKeyValue(SAL_UNUSED_PARAMETER
const OUString
& /*rKey*/, SAL_UNUSED_PARAMETER
const OUString
& /*rValue*/, SAL_UNUSED_PARAMETER tAddKeyHandling
/*AddKeyHandling*/) {};
90 #endif // HAVE_FEATURE_BREAKPAD
93 #endif // INCLUDED_DESKTOP_CRASHREPORT_HXX
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */