Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: minidump/minidump_extensions.h

Issue 435013002: Add minidump_extensions.h (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « minidump/minidump.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #ifndef CRASHPAD_MINIDUMP_MINIDUMP_EXTENSIONS_H_
16 #define CRASHPAD_MINIDUMP_MINIDUMP_EXTENSIONS_H_
17
18 #include <dbghelp.h>
19 #include <stdint.h>
20 #include <winnt.h>
21
22 #include "util/misc/uuid.h"
23
24 namespace crashpad {
25
26 //! \brief Minidump stream type values for MINIDUMP_DIRECTORY::StreamType. Each
27 //! stream structure has a corresponding stream type value to identify it.
28 //!
29 //! \sa MINIDUMP_STREAM_TYPE
30 enum MinidumpStreamType {
31 //! \brief The stream type for MINIDUMP_THREAD_LIST.
32 //!
33 //! \sa ThreadListStream
34 kMinidumpStreamTypeThreadList = ThreadListStream,
35
36 //! \brief The stream type for MINIDUMP_MODULE_LIST.
37 //!
38 //! \sa ModuleListStream
39 kMinidumpStreamTypeModuleList = ModuleListStream,
40
41 //! \brief The stream type for MINIDUMP_MEMORY_LIST.
42 //!
43 //! \sa MemoryListStream
44 kMinidumpStreamTypeMemoryList = MemoryListStream,
45
46 //! \brief The stream type for MINIDUMP_EXCEPTION_STREAM.
47 //!
48 //! \sa ExceptionStream
49 kMinidumpStreamTypeException = ExceptionStream,
50
51 //! \brief The stream type for MINIDUMP_SYSTEM_INFO.
52 //!
53 //! \sa SystemInfoStream
54 kMinidumpStreamTypeSystemInfo = SystemInfoStream,
55
56 //! \brief The stream type for MINIDUMP_MISC_INFO, MINIDUMP_MISC_INFO_2,
57 //! MINIDUMP_MISC_INFO_3, and MINIDUMP_MISC_INFO_4.
58 //!
59 //! \sa MiscInfoStream
60 kMinidumpStreamTypeMiscInfo = MiscInfoStream,
61
62 // 0x4350 = "CP"
63
64 //! \brief The stream type for MinidumpCrashpadInfo.
65 kMinidumpStreamTypeCrashpadInfo = 0x43500001,
66 };
67
68 //! \brief A variable-length UTF-8-encoded string carried within a minidump
69 //! file.
70 //!
71 //! \sa MINIDUMP_STRING
72 struct __attribute__((packed, aligned(4))) MinidumpUTF8String {
73 // The field names do not conform to typical style, they match the names used
74 // in MINIDUMP_STRING. This makes it easier to operate on MINIDUMP_STRING (for
75 // UTF-16 strings) and MinidumpUTF8String using templates.
76
77 //! \brief The length of the #Buffer field in bytes, not including the `NUL`
78 //! terminator.
79 //!
80 //! \note This field is interpreted as a byte count, not a count of Unicode
81 //! code points.
82 uint32_t Length;
83
84 //! \brief The string, encoded in UTF-8, and terminated with a `NUL` byte.
85 uint8_t Buffer[0];
86 };
87
88 //! \brief CPU type values for MINIDUMP_SYSTEM_INFO::ProcessorArchitecture.
89 //!
90 //! \sa \ref PROCESSOR_ARCHITECTURE_x "PROCESSOR_ARCHITECTURE_*"
91 enum MinidumpCPUArchitecture : uint16_t {
92 //! \brief 32-bit x86.
93 //!
94 //! These systems identify their CPUs generically as “x86” or “ia32”, or with
95 //! more specific names such as “i386”, “i486”, “i586”, and “i686”.
96 kMinidumpCPUArchitectureX86 = PROCESSOR_ARCHITECTURE_INTEL,
97
98 kMinidumpCPUArchitectureMIPS = PROCESSOR_ARCHITECTURE_MIPS,
99 kMinidumpCPUArchitectureAlpha = PROCESSOR_ARCHITECTURE_ALPHA,
100
101 //! \brief 32-bit PowerPC.
102 //!
103 //! These systems identify their CPUs generically as “ppc”, or with more
104 //! specific names such as “ppc6xx”, “ppc7xx”, and “ppc74xx”.
105 kMinidumpCPUArchitecturePPC = PROCESSOR_ARCHITECTURE_PPC,
106
107 kMinidumpCPUArchitectureSHx = PROCESSOR_ARCHITECTURE_SHX,
108
109 //! \brief 32-bit ARM.
110 //!
111 //! These systems identify their CPUs generically as “arm”, or with more
112 //! specific names such as “armv6” and “armv7”.
113 kMinidumpCPUArchitectureARM = PROCESSOR_ARCHITECTURE_ARM,
114
115 kMinidumpCPUArchitectureIA64 = PROCESSOR_ARCHITECTURE_IA64,
116 kMinidumpCPUArchitectureAlpha64 = PROCESSOR_ARCHITECTURE_ALPHA64,
117 kMinidumpCPUArchitectureMSIL = PROCESSOR_ARCHITECTURE_MSIL,
118
119 //! \brief 64-bit x86.
120 //!
121 //! These systems identify their CPUs as “x86_64”, “amd64”, or “x64”.
122 kMinidumpCPUArchitectureAMD64 = PROCESSOR_ARCHITECTURE_AMD64,
123
124 kMinidumpCPUArchitectureX86Win64 = PROCESSOR_ARCHITECTURE_IA32_ON_WIN64,
125 kMinidumpCPUArchitectureNeutral = PROCESSOR_ARCHITECTURE_NEUTRAL,
126 kMinidumpCPUArchitectureSPARC = 0x8001,
127
128 //! \brief 64-bit PowerPC.
129 //!
130 //! These systems identify their CPUs generically as “ppc64”, or with more
131 //! specific names such as “ppc970”.
132 kMinidumpCPUArchitecturePPC64 = 0x8002,
133
134 //! \brief 64-bit ARM.
135 //!
136 //! These systems identify their CPUs generically as “arm64” or “aarch64”, or
137 //! with more specific names such as “armv8”.
138 kMinidumpCPUArchitectureARM64 = 0x8003,
139
140 //! \brief Unknown CPU architecture.
141 kMinidumpCPUArchitectureUnknown = PROCESSOR_ARCHITECTURE_UNKNOWN,
142 };
143
144 //! \brief Operating system type values for MINIDUMP_SYSTEM_INFO::ProductType.
145 //!
146 //! \sa \ref VER_NT_x "VER_NT_*"
147 enum MinidumpOSType : uint8_t {
148 //! \brief A “desktop” or “workstation” system.
149 kMinidumpOSTypeWorkstation = VER_NT_WORKSTATION,
150
151 //! \brief A “domain controller” system. Windows-specific.
152 kMinidumpOSTypeDomainController = VER_NT_DOMAIN_CONTROLLER,
153
154 //! \brief A “server” system.
155 kMinidumpOSTypeServer = VER_NT_SERVER,
156 };
157
158 //! \brief Operating system family values for MINIDUMP_SYSTEM_INFO::PlatformId.
159 //!
160 //! \sa \ref VER_PLATFORM_x "VER_PLATFORM_*"
161 enum MinidumpOS : uint32_t {
162 //! \brief Windows 3.1.
163 kMinidumpOSWin32s = VER_PLATFORM_WIN32s,
164
165 //! \brief Windows 95, Windows 98, and Windows Me.
166 kMinidumpOSWin32Windows = VER_PLATFORM_WIN32_WINDOWS,
167
168 //! \brief Windows NT, Windows 2000, and later.
169 kMinidumpOSWin32NT = VER_PLATFORM_WIN32_NT,
170
171 kMinidumpOSUnix = 0x8000,
172
173 //! \brief Mac OS X, Darwin for traditional systems.
174 kMinidumpOSMacOSX = 0x8101,
175
176 //! \brief iOS, Darwin for mobile devices.
177 kMinidumpOSiOS = 0x8102,
178
179 //! \brief Linux, not including Android.
180 kMinidumpOSLinux = 0x8201,
181
182 kMinidumpOSSolaris = 0x8202,
183
184 //! \brief Android.
185 kMinidumpOSAndroid = 0x8203,
186
187 kMinidumpOSPS3 = 0x8204,
188
189 //! \brief Native Client (NaCl).
190 kMinidumpOSNaCl = 0x8205,
191
192 //! \brief Unknown operating system.
193 kMinidumpOSUnknown = 0xffffffff,
194 };
195
196 //! \brief Exception code values for MINIDUMP_EXCEPTION::ExceptionCode.
197 //!
198 //! In Mach terminology, these are “exceptions”, not “codes”, and are
199 //! represented by `exception_type_t`. In a minidump file, they are referred to
200 //! as codes.
201 enum MinidumpExceptionCodeMac : uint32_t {
202 kMinidumpExceptionCodeMacBadAccess = 1, // EXC_BAD_ACCESS
Robert Sesek 2014/08/01 17:48:24 I'm surprised you're not using direct assignment h
203 kMinidumpExceptionCodeMacBadInstruction, // EXC_BAD_INSTRUCTION
204 kMinidumpExceptionCodeMacArithmetic, // EXC_ARITHMETIC
205 kMinidumpExceptionCodeMacEmulation, // EXC_EMULATION
206 kMinidumpExceptionCodeMacSoftware, // EXC_SOFTWARE
207 kMinidumpExceptionCodeMacBreakpoint, // EXC_BREAKPOINT
208 kMinidumpExceptionCodeMacSyscall, // EXC_SYSCALL
209 kMinidumpExceptionCodeMacMachSyscall, // EXC_MACH_SYSCALL
210 kMinidumpExceptionCodeMacRPCAlert, // EXC_RPC_ALERT
211 kMinidumpExceptionCodeMacCrash, // EXC_CRASH
212 kMinidumpExceptionCodeMacResource, // EXC_RESOURCE
213 kMinidumpExceptionCodeMacGuard, // EXC_GUARD
214 };
215
216 //! \brief A CodeView record linking to a `.pdb` 2.0 file.
217 //!
218 //! This format provides an indirect link to debugging data by referencing an
219 //! external `.pdb` file by its name, timestamp, and age. This structure may be
220 //! pointed to by MINIDUMP_MODULE::CvRecord. It has been superseded by
221 //! MinidumpModuleCodeViewRecordPDB70.
222 //!
223 //! For more information about this structure and format, see <a
224 //! href="http://www.debuginfo.com/articles/debuginfomatch.html#pdbfiles">Matchi ng
225 //! Debug Information</a>, PDB Files, and <a
226 //! href="http://undocumented.rawol.com/sbs-w2k-1-windows-2000-debugging-support .pdf#page=63">Undocumented
227 //! Windows 2000 Secrets</a>, Windows 2000 Debugging Support/Microsoft Symbol
228 //! File Internals/CodeView Subsections.
229 //!
230 //! \sa IMAGE_DEBUG_MISC
231 struct MinidumpModuleCodeViewRecordPDB20 {
232 //! \brief The magic number identifying this structure version, stored in
233 //! #signature.
234 //!
235 //! In a hex dump, this will appear as “NB10” when produced by a little-endian
236 //! machine.
237 static const uint32_t kSignature = '01BN';
238
239 //! \brief The magic number identifying this structure version, the value of
240 //! #kSignature.
241 uint32_t signature;
242
243 //! \brief The offset to CodeView data.
244 //!
245 //! In this structure, this field always has the value `0` because no CodeView
246 //! data is present, there is only a link to CodeView data stored in an
247 //! external file.
248 uint32_t offset;
249
250 //! \brief The time that the `.pdb` file was created, in `time_t` format, the
251 //! number of seconds since the POSIX epoch.
252 uint32_t timestamp;
253
254 //! \brief The revision of the `.pdb` file.
255 //!
256 //! A `.pdb` file’s age indicates incremental changes to it. When a `.pdb`
257 //! file is created, it has age `1`, and subsequent updates increase this
258 //! value.
259 uint32_t age;
260
261 //! \brief The path or file name of the `.pdb` file associated with the
262 //! module.
263 //!
264 //! This is a NUL-terminated string. On Windows, it will be encoded in the
265 //! code page of the system that linked the module. On other operating
266 //! systems, UTF-8 may be used.
267 uint8_t pdb_name[1];
268 };
269
270 //! \brief A CodeView record linking to a `.pdb` 7.0 file.
271 //!
272 //! This format provides an indirect link to debugging data by referencing an
273 //! external `.pdb` file by its name, %UUID, and age. This structure may be
274 //! pointed to by MINIDUMP_MODULE::CvRecord.
275 //!
276 //! For more information about this structure and format, see <a
277 //! href="http://www.debuginfo.com/articles/debuginfomatch.html#pdbfiles">Matchi ng
278 //! Debug Information</a>, PDB Files.
279 //!
280 //! \sa MinidumpModuleCodeViewRecordPDB20
281 //! \sa IMAGE_DEBUG_MISC
282 struct MinidumpModuleCodeViewRecordPDB70 {
283 //! \brief The magic number identifying this structure version, stored in
284 //! #signature.
285 //!
286 //! In a hex dump, this will appear as “RSDS” when produced by a little-endian
287 //! machine.
288 static const uint32_t kSignature = 'SDSR';
289
290 //! \brief The magic number identifying this structure version, the value of
291 //! #kSignature.
292 uint32_t signature;
293
294 //! \brief The `.pdb` file’s unique identifier.
295 UUID uuid;
296
297 //! \brief The revision of the `.pdb` file.
298 //!
299 //! A `.pdb` file’s age indicates incremental changes to it. When a `.pdb`
300 //! file is created, it has age `1`, and subsequent updates increase this
301 //! value.
302 uint32_t age;
303
304 //! \brief The path or file name of the `.pdb` file associated with the
305 //! module.
306 //!
307 //! This is a NUL-terminated string. On Windows, it will be encoded in the
308 //! code page of the system that linked the module. On other operating
309 //! systems, UTF-8 may be used.
310 uint8_t pdb_name[1];
311 };
312
313 //! \brief A key-value pair.
314 struct __attribute__((packed, aligned(4))) MinidumpSimpleStringDictionaryEntry {
315 //! \brief ::RVA of a MinidumpUTF8String containing the key of a key-value
316 //! pair.
317 RVA key;
318
319 //! \brief ::RVA of a MinidumpUTF8String containing the value of a key-value
320 //! pair.
321 RVA value;
322 };
323
324 //! \brief A list of key-value pairs.
325 struct __attribute__((packed, aligned(4))) MinidumpSimpleStringDictionary {
326 //! \brief The number of key-value pairs present.
327 uint32_t count;
328
329 //! \brief A list of MinidumpSimpleStringDictionaryEntry entries.
330 MinidumpSimpleStringDictionaryEntry entries[0];
331 };
332
333 //! \brief Additional Crashpad-specific information carried within a minidump
334 //! file.
335 struct __attribute__((packed, aligned(4))) MinidumpCrashpadInfo {
336 //! \brief The size of the entire structure, in bytes.
337 //!
338 //! \sa version
339 uint32_t size;
340
341 //! \brief The structure’s version number. This can be used to determine which
342 //! other fields in the structure are valid.
343 //!
344 //! \sa size
345 uint32_t version;
346
347 //! \brief A MinidumpSimpleStringDictionary pointing to strings interpreted as
348 //! key-value pairs. The process that crashed controlled the data that
349 //! appears here.
350 //!
351 //! If MINIDUMP_LOCATION_DESCRIPTOR::DataSize is `0`, no key-value pairs are
352 //! present, and MINIDUMP_LOCATION_DESCRIPTOR::Rva should not be consulted.
353 //!
354 //! This field is present when #version is at least `1`.
355 MINIDUMP_LOCATION_DESCRIPTOR simple_annotations;
356 };
357
358 } // namespace crashpad
359
360 #endif // CRASHPAD_MINIDUMP_MINIDUMP_EXTENSIONS_H_
OLDNEW
« no previous file with comments | « minidump/minidump.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698