-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathqt_breakpad.h
86 lines (70 loc) · 3 KB
/
qt_breakpad.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef QT_BREAKPAD_H
#define QT_BREAKPAD_H
#include <QCoreApplication>
#include <QDir>
#include <QFile>
#include <QProcess>
#include <QString>
#if defined(Q_OS_WIN32)
// breakpad includes windows.h, so we must include QT's qt_windows.h beforehand
// to avoid breaking other QT headers
#include <qt_windows.h>
#include "vendor/breakpad/src/client/windows/handler/exception_handler.h"
#elif defined(Q_OS_LINUX)
#include "vendor/breakpad/src/client/linux/handler/exception_handler.h"
#endif // OS-specific includes
class QtBreakpad
{
public:
static void init(const QString& reportPath,
google_breakpad::ExceptionHandler::FilterCallback filterCallBack = NULL,
google_breakpad::ExceptionHandler::MinidumpCallback minidumpCallback = NULL,
void* callbackContext = NULL);
typedef bool (*QMinidumpCallback)(QFile& minidumpFile, void* context);
static void init(const QString& reportPath,
QMinidumpCallback qMinidumpCallback,
void* callbackContext = NULL);
private:
Q_DISABLE_COPY(QtBreakpad)
static QtBreakpad* _instance;
static void replaceInstance(QtBreakpad* newInstance);
class QMinidumpContextWrapper
{
public:
QMinidumpContextWrapper(QMinidumpCallback qMinicudmpCallback, void* context)
{
this->qMinicudmpCallback = qMinicudmpCallback;
this->context = context;
}
~QMinidumpContextWrapper() { }
QMinidumpCallback qMinicudmpCallback;
void* context;
};
QtBreakpad(const QString& reportPath,
google_breakpad::ExceptionHandler::FilterCallback filterCallBack,
google_breakpad::ExceptionHandler::MinidumpCallback minidumpCallback,
void* callbackContext);
QtBreakpad(const QString& reportPath,
QMinidumpCallback qMinidumpCallback,
void* callbackContext);
~QtBreakpad();
google_breakpad::ExceptionHandler* _breakpad_handler;
void buildBreakpadHandler(const QString& reportPath,
google_breakpad::ExceptionHandler::FilterCallback filterCallBack,
google_breakpad::ExceptionHandler::MinidumpCallback minidumpCallback,
void* callbackContext);
QMinidumpContextWrapper* _qMinidumpContextWrapper;
#if defined(Q_OS_WIN32)
static bool qMinidumpWrapper(const wchar_t* dump_path,
const wchar_t* minidump_id,
QMinidumpContextWrapper* context,
EXCEPTION_POINTERS* exinfo,
MDRawAssertionInfo* assertion,
bool succeeded);
#elif defined(Q_OS_LINUX)
static bool qMinidumpWrapper(const MinidumpDescriptor& descriptor,
QMinidumpContextWrapper* context,
bool succeeded);
#endif
};
#endif // QT_BREAKPAD_H