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
24 namespace google_breakpad
26 class ExceptionHandler
;
30 * Provides access to the crash reporter service.
38 #if HAVE_FEATURE_BREAKPAD
39 // MSVC 2013 has undefined symbols for inline functions if it's exported
42 /*class*/ CrashReporter
45 typedef enum {AddItem
, Write
, Create
} tAddKeyHandling
;
46 #if HAVE_FEATURE_BREAKPAD
47 static void addKeyValue(const OUString
& rKey
, const OUString
& rValue
, tAddKeyHandling AddKeyHandling
);
49 static void storeExceptionHandler(google_breakpad::ExceptionHandler
* pExceptionHandler
);
51 static bool crashReportInfoExists();
53 static bool readSendConfig(std::string
& response
);
55 static bool IsDumpEnable();
58 static osl::Mutex maMutex
;
64 _mpair(const OUString
& First
, const OUString
& Second
)
71 typedef std::vector
<mpair
> vmaKeyValues
;
72 static vmaKeyValues maKeyValues
; // used to temporarily save entries before the old info has been uploaded
74 static google_breakpad::ExceptionHandler
* mpExceptionHandler
;
76 static std::string
getIniFileName();
77 static void writeCommonInfo();
78 static void writeToFile(std::ios_base::openmode Openmode
);
79 // when we create the ExceptionHandler we have no access to the user
80 // profile yet, so update when we have access
81 static void updateMinidumpLocation();
84 // Add dummy methods for the non-breakpad case. That allows us to use
85 // // the code without linking to the lib and without adding HAVE_FEATURE_BREAKPAD
86 // // everywhere we want to log something to the crash report system.
87 inline static void addKeyValue(SAL_UNUSED_PARAMETER
const OUString
& /*rKey*/, SAL_UNUSED_PARAMETER
const OUString
& /*rValue*/, SAL_UNUSED_PARAMETER tAddKeyHandling
/*AddKeyHandling*/) {};
88 #endif // HAVE_FEATURE_BREAKPAD
91 #endif // INCLUDED_DESKTOP_CRASHREPORT_HXX
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */