/
CrashInfo.h
107 lines (83 loc) · 2.71 KB
/
CrashInfo.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
* Copyright 2011 Arx Libertatis Team (see the AUTHORS file)
*
* This file is part of Arx Libertatis.
*
* Arx Libertatis is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Arx Libertatis is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Arx Libertatis. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ARX_PLATFORM_CRASHHANDLER_CRASHINFO_H
#define ARX_PLATFORM_CRASHHANDLER_CRASHINFO_H
#include "Configure.h"
#define BOOST_DATE_TIME_NO_LIB
#include <boost/version.hpp>
#if BOOST_VERSION < 104500
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-fpermissive"
#endif
#include <boost/interprocess/sync/interprocess_semaphore.hpp>
#include <boost/interprocess/detail/os_thread_functions.hpp>
#if BOOST_VERSION < 104500
#pragma GCC diagnostic pop
#endif
#include "platform/Platform.h"
#include "platform/Thread.h"
struct CrashInfoBase {
CrashInfoBase() : exitLock(0) { }
enum Constants {
MaxNbFiles = 32,
MaxFilenameLen = 256,
MaxNbVariables = 64,
MaxVariableNameLen = 64,
MaxVariableValueLen = 128,
MaxDetailCrashInfoLen = 4096,
MaxCallstackDepth = 256
};
char executablePath[MaxFilenameLen];
char executableVersion[MaxVariableNameLen];
u32 architecture;
// Files to attach to the report.
int nbFilesAttached;
char attachedFiles[MaxNbFiles][MaxFilenameLen];
// Variables to add to the report.
int nbVariables;
struct Variable {
char name[MaxVariableNameLen];
char value[MaxVariableValueLen];
} variables[MaxNbVariables];
// ID of the crashed process & thread
process_id_type processId;
thread_id_type threadId;
// Detailed crash info (messages, registers, whatever).
char detailedCrashInfo[MaxDetailCrashInfoLen];
// Where the crash reports should be written.
char crashReportFolder[MaxFilenameLen];
// Once released, this lock will allow the crashed application to terminate.
boost::interprocess::interprocess_semaphore exitLock;
};
#if ARX_PLATFORM != ARX_PLATFORM_WIN32
struct CrashInfo : public CrashInfoBase {
char execFullName[512];
void * backtrace[100];
};
#else
#include <windows.h>
#include <dbghelp.h>
struct CrashInfo : public CrashInfoBase {
CONTEXT contextRecord;
CHAR miniDumpTmpFile[MAX_PATH];
HANDLE threadHandle;
DWORD exceptionCode;
};
#endif
#endif // ARX_PLATFORM_CRASHHANDLER_CRASHINFO_H