Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/toolkit/crashreporter/CrashAnnotations.h
Line
Count
Source (jump to first uncovered line)
1
/* This file was autogenerated by toolkit/crashreporter/generate_crash_reporter_sources.py. DO NOT EDIT */
2
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#ifndef CrashAnnotations_h
8
#define CrashAnnotations_h
9
10
#include <cstdint>
11
12
namespace CrashReporter {
13
14
// Typed enum representing all crash annotations
15
enum class Annotation : uint32_t {
16
  A11yHandlerRegistered = 0,
17
  AbortMessage = 1,
18
  Accessibility = 2,
19
  AccessibilityClient = 3,
20
  AccessibilityInProcClient = 4,
21
  ActualStreamLen = 5,
22
  AdapterDeviceID = 6,
23
  AdapterDriverVersion = 7,
24
  AdapterSubsysID = 8,
25
  AdapterVendorID = 9,
26
  Addons = 10,
27
  AppInitDLLs = 11,
28
  AsyncShutdownModule = 12,
29
  AsyncShutdownTimeout = 13,
30
  AvailablePageFile = 14,
31
  AvailablePhysicalMemory = 15,
32
  AvailableVirtualMemory = 16,
33
  BIOS_Manufacturer = 17,
34
  BlockedDllList = 18,
35
  BlocklistInitFailed = 19,
36
  BreakpadReserveAddress = 20,
37
  BreakpadReserveSize = 21,
38
  BuildID = 22,
39
  CPUMicrocodeVersion = 23,
40
  ClassRegistrationInfoChild = 24,
41
  ClassRegistrationInfoParent = 25,
42
  CoMarshalInterfaceFailure = 26,
43
  CoUnmarshalInterfaceResult = 27,
44
  ContainsMemoryReport = 28,
45
  ContentSandboxCapabilities = 29,
46
  ContentSandboxCapable = 30,
47
  ContentSandboxEnabled = 31,
48
  ContentSandboxLevel = 32,
49
  CpuUsageFlashProcess1 = 33,
50
  CpuUsageFlashProcess2 = 34,
51
  CrashAddressLikelyWrong = 35,
52
  CrashTime = 36,
53
  CreateStreamOnHGlobalFailure = 37,
54
  CycleCollector = 38,
55
  DOMIPCEnabled = 39,
56
  DeviceResetReason = 40,
57
  EMCheckCompatibility = 41,
58
  EventLoopNestingLevel = 42,
59
  ExpectedStreamLen = 43,
60
  FlashProcessDump = 44,
61
  FramePoisonBase = 45,
62
  FramePoisonSize = 46,
63
  GMPLibraryPath = 47,
64
  GMPPlugin = 48,
65
  GPUProcessLaunchCount = 49,
66
  GPUProcessStatus = 50,
67
  GetHGlobalFromStreamFailure = 51,
68
  GraphicsCriticalError = 52,
69
  GraphicsSanityTest = 53,
70
  GraphicsStartupTest = 54,
71
  HangMonitorDescription = 55,
72
  HasDeviceTouchScreen = 56,
73
  IAccessibleConfig = 57,
74
  IPCFatalErrorMsg = 58,
75
  IPCFatalErrorProtocol = 59,
76
  IPCMessageName = 60,
77
  IPCMessageSize = 61,
78
  IPCReadErrorReason = 62,
79
  IPCShutdownState = 63,
80
  IPCSystemError = 64,
81
  IPCTransportFailureReason = 65,
82
  InstallTime = 66,
83
  InterfaceRegistrationInfoChild = 67,
84
  InterfaceRegistrationInfoParent = 68,
85
  IpcCreateEndpointsNsresult = 69,
86
  IpcCreatePipeCloExecErrno = 70,
87
  IpcCreatePipeFcntlErrno = 71,
88
  IpcCreatePipeSocketPairErrno = 72,
89
  IpcCreateTransportDupErrno = 73,
90
  IsGarbageCollecting = 74,
91
  JSLargeAllocationFailure = 75,
92
  JSOutOfMemory = 76,
93
  JavaStackTrace = 77,
94
  LowCommitSpaceEvents = 78,
95
  MarshalActCtxManifestPath = 79,
96
  MemoryErrorCorrection = 80,
97
  MozCrashReason = 81,
98
  Notes = 82,
99
  NumberOfProcessors = 83,
100
  OOMAllocationSize = 84,
101
  PluginCpuUsage = 85,
102
  PluginFilename = 86,
103
  PluginHang = 87,
104
  PluginHangUIDuration = 88,
105
  PluginName = 89,
106
  PluginVersion = 90,
107
  ProcessType = 91,
108
  ProductID = 92,
109
  ProductName = 93,
110
  ProxyStreamSize = 94,
111
  ProxyStreamSizeFrom = 95,
112
  ProxyStreamUnmarshalStatus = 96,
113
  ProxyStreamValid = 97,
114
  RecordReplay = 98,
115
  RecordReplayError = 99,
116
  RecordReplayHang = 100,
117
  ReleaseChannel = 101,
118
  RemoteType = 102,
119
  SafeMode = 103,
120
  SecondsSinceLastCrash = 104,
121
  ServerURL = 105,
122
  SheetLoadFailure = 106,
123
  ShutdownProgress = 107,
124
  StartupCrash = 108,
125
  StartupTime = 109,
126
  StatFailure = 110,
127
  StorageConnectionNotClosed = 111,
128
  SystemMemoryUsePercentage = 112,
129
  TelemetryClientId = 113,
130
  TelemetryEnvironment = 114,
131
  TelemetryServerURL = 115,
132
  TelemetrySessionId = 116,
133
  TestKey = 117,
134
  TestUnicode = 118,
135
  TextureUsage = 119,
136
  ThreadIdNameMapping = 120,
137
  TotalPageFile = 121,
138
  TotalPhysicalMemory = 122,
139
  TotalVirtualMemory = 123,
140
  URL = 124,
141
  UnknownNetAddrSocketFamily = 125,
142
  UnmarshalActCtx = 126,
143
  UnmarshalActCtxManifestPath = 127,
144
  UptimeTS = 128,
145
  User32BeforeBlocklist = 129,
146
  Vendor = 130,
147
  Version = 131,
148
  Winsock_LSP = 132,
149
  additional_minidumps = 133,
150
  ipc_channel_error = 134,
151
  nsAsyncShutdownComponent = 135,
152
  useragent_locale = 136,
153
  Count = 137
154
};
155
156
// Stringified crash annotation names
157
const char* const kAnnotationStrings[] = {
158
  "A11yHandlerRegistered",
159
  "AbortMessage",
160
  "Accessibility",
161
  "AccessibilityClient",
162
  "AccessibilityInProcClient",
163
  "ActualStreamLen",
164
  "AdapterDeviceID",
165
  "AdapterDriverVersion",
166
  "AdapterSubsysID",
167
  "AdapterVendorID",
168
  "Add-ons",
169
  "AppInitDLLs",
170
  "AsyncShutdownModule",
171
  "AsyncShutdownTimeout",
172
  "AvailablePageFile",
173
  "AvailablePhysicalMemory",
174
  "AvailableVirtualMemory",
175
  "BIOS_Manufacturer",
176
  "BlockedDllList",
177
  "BlocklistInitFailed",
178
  "BreakpadReserveAddress",
179
  "BreakpadReserveSize",
180
  "BuildID",
181
  "CPUMicrocodeVersion",
182
  "ClassRegistrationInfoChild",
183
  "ClassRegistrationInfoParent",
184
  "CoMarshalInterfaceFailure",
185
  "CoUnmarshalInterfaceResult",
186
  "ContainsMemoryReport",
187
  "ContentSandboxCapabilities",
188
  "ContentSandboxCapable",
189
  "ContentSandboxEnabled",
190
  "ContentSandboxLevel",
191
  "CpuUsageFlashProcess1",
192
  "CpuUsageFlashProcess2",
193
  "CrashAddressLikelyWrong",
194
  "CrashTime",
195
  "CreateStreamOnHGlobalFailure",
196
  "CycleCollector",
197
  "DOMIPCEnabled",
198
  "DeviceResetReason",
199
  "EMCheckCompatibility",
200
  "EventLoopNestingLevel",
201
  "ExpectedStreamLen",
202
  "FlashProcessDump",
203
  "FramePoisonBase",
204
  "FramePoisonSize",
205
  "GMPLibraryPath",
206
  "GMPPlugin",
207
  "GPUProcessLaunchCount",
208
  "GPUProcessStatus",
209
  "GetHGlobalFromStreamFailure",
210
  "GraphicsCriticalError",
211
  "GraphicsSanityTest",
212
  "GraphicsStartupTest",
213
  "HangMonitorDescription",
214
  "HasDeviceTouchScreen",
215
  "IAccessibleConfig",
216
  "IPCFatalErrorMsg",
217
  "IPCFatalErrorProtocol",
218
  "IPCMessageName",
219
  "IPCMessageSize",
220
  "IPCReadErrorReason",
221
  "IPCShutdownState",
222
  "IPCSystemError",
223
  "IPCTransportFailureReason",
224
  "InstallTime",
225
  "InterfaceRegistrationInfoChild",
226
  "InterfaceRegistrationInfoParent",
227
  "IpcCreateEndpointsNsresult",
228
  "IpcCreatePipeCloExecErrno",
229
  "IpcCreatePipeFcntlErrno",
230
  "IpcCreatePipeSocketPairErrno",
231
  "IpcCreateTransportDupErrno",
232
  "IsGarbageCollecting",
233
  "JSLargeAllocationFailure",
234
  "JSOutOfMemory",
235
  "JavaStackTrace",
236
  "LowCommitSpaceEvents",
237
  "MarshalActCtxManifestPath",
238
  "MemoryErrorCorrection",
239
  "MozCrashReason",
240
  "Notes",
241
  "NumberOfProcessors",
242
  "OOMAllocationSize",
243
  "PluginCpuUsage",
244
  "PluginFilename",
245
  "PluginHang",
246
  "PluginHangUIDuration",
247
  "PluginName",
248
  "PluginVersion",
249
  "ProcessType",
250
  "ProductID",
251
  "ProductName",
252
  "ProxyStreamSize",
253
  "ProxyStreamSizeFrom",
254
  "ProxyStreamUnmarshalStatus",
255
  "ProxyStreamValid",
256
  "RecordReplay",
257
  "RecordReplayError",
258
  "RecordReplayHang",
259
  "ReleaseChannel",
260
  "RemoteType",
261
  "SafeMode",
262
  "SecondsSinceLastCrash",
263
  "ServerURL",
264
  "SheetLoadFailure",
265
  "ShutdownProgress",
266
  "StartupCrash",
267
  "StartupTime",
268
  "StatFailure",
269
  "StorageConnectionNotClosed",
270
  "SystemMemoryUsePercentage",
271
  "TelemetryClientId",
272
  "TelemetryEnvironment",
273
  "TelemetryServerURL",
274
  "TelemetrySessionId",
275
  "TestKey",
276
  "TestUnicode",
277
  "TextureUsage",
278
  "ThreadIdNameMapping",
279
  "TotalPageFile",
280
  "TotalPhysicalMemory",
281
  "TotalVirtualMemory",
282
  "URL",
283
  "UnknownNetAddrSocketFamily",
284
  "UnmarshalActCtx",
285
  "UnmarshalActCtxManifestPath",
286
  "UptimeTS",
287
  "User32BeforeBlocklist",
288
  "Vendor",
289
  "Version",
290
  "Winsock_LSP",
291
  "additional_minidumps",
292
  "ipc_channel_error",
293
  "nsAsyncShutdownComponent",
294
  "useragent_locale"
295
};
296
297
// Whitelist of crash annotations that can be included in a crash ping
298
const Annotation kCrashPingWhitelist[] = {
299
  Annotation::AsyncShutdownTimeout,
300
  Annotation::AvailablePageFile,
301
  Annotation::AvailablePhysicalMemory,
302
  Annotation::AvailableVirtualMemory,
303
  Annotation::BlockedDllList,
304
  Annotation::BlocklistInitFailed,
305
  Annotation::BuildID,
306
  Annotation::ContainsMemoryReport,
307
  Annotation::CrashTime,
308
  Annotation::EventLoopNestingLevel,
309
  Annotation::IsGarbageCollecting,
310
  Annotation::LowCommitSpaceEvents,
311
  Annotation::MozCrashReason,
312
  Annotation::OOMAllocationSize,
313
  Annotation::ProductID,
314
  Annotation::ProductName,
315
  Annotation::ReleaseChannel,
316
  Annotation::RemoteType,
317
  Annotation::SecondsSinceLastCrash,
318
  Annotation::ShutdownProgress,
319
  Annotation::StartupCrash,
320
  Annotation::SystemMemoryUsePercentage,
321
  Annotation::TextureUsage,
322
  Annotation::TotalPageFile,
323
  Annotation::TotalPhysicalMemory,
324
  Annotation::TotalVirtualMemory,
325
  Annotation::UptimeTS,
326
  Annotation::User32BeforeBlocklist,
327
  Annotation::ipc_channel_error
328
};
329
330
// Blacklist of crash annotations that shouldn't be read from a content process
331
const Annotation kContentProcessBlacklist[] = {
332
  Annotation::FramePoisonBase,
333
  Annotation::FramePoisonSize,
334
  Annotation::StartupCrash,
335
  Annotation::StartupTime,
336
  Annotation::URL
337
};
338
339
/**
340
 * Return the string representation of a crash annotation.
341
 *
342
 * @param aAnnotation a crash annotation
343
 * @returns A constant string holding the annotation name
344
 */
345
static inline const char*
346
0
AnnotationToString(Annotation aAnnotation) {
347
0
  return kAnnotationStrings[static_cast<uint32_t>(aAnnotation)];
348
0
}
349
350
/**
351
 * Converts a string to its corresponding crash annotation.
352
 *
353
 * @param aResult a reference where the annotation will be stored
354
 * @param aValue the string to be converted
355
 * @return true if the string was successfully converted, false if it did not
356
 *         correspond to any known annotation
357
 */
358
bool AnnotationFromString(Annotation& aResult, const char* aValue);
359
360
/**
361
 * Checks if the given crash annotation is whitelisted for inclusion in the
362
 * crash ping.
363
 *
364
 * @param aAnnotation the crash annotation to be checked
365
 * @return true if the annotation can be included in the crash ping, false
366
 *         otherwise
367
 */
368
bool IsAnnotationWhitelistedForPing(Annotation aAnnotation);
369
370
/**
371
 * Checks if the given crash annotation needs to be filtered out when reading
372
 * a content process crash annotations. Blacklisted annotations will be
373
 * replaced with ones provided by the parent process.
374
 *
375
 * @param aAnnotation the crash annotation to be checked
376
 * @return true if the annotation needs to be filtered out when reading
377
 *         annotations provided by a content process, false otherwise
378
 */
379
bool IsAnnotationBlacklistedForContent(Annotation aAnnotation);
380
381
} // namespace CrashReporter
382
383
#endif // CrashAnnotations_h