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

Side by Side Diff: compat/non_win/dbghelp.h

Issue 432843002: Add compat to Crashpad (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
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_COMPAT_NON_WIN_DBGHELP_H_
16 #define CRASHPAD_COMPAT_NON_WIN_DBGHELP_H_
17
18 #include <stdint.h>
19
20 #include "base/strings/string16.h"
21 #include "compat/non_win/timezoneapi.h"
22 #include "compat/non_win/verrsrc.h"
23 #include "compat/non_win/winnt.h"
24
25 //! \file
Robert Sesek 2014/07/31 16:55:41 Not sure you need a file-level comment here, if no
Mark Mentovai 2014/07/31 17:06:54 rsesek wrote:
26
27 //! \brief The magic number for a minidump file, stored in
28 //! MINIDUMP_HEADER::Signature.
29 //!
30 //! A hex dump of a little-endian minidump file will begin with the string
31 //! “MDMP”.
32 #define MINIDUMP_SIGNATURE ('PMDM') // 0x4d444d50
33
34 //! \brief The version of a minidump file, stored in MINIDUMP_HEADER::Version.
35 #define MINIDUMP_VERSION (42899)
36
37 //! \brief An offset within a minidump file, relative to the start of its
38 //! MINIDUMP_HEADER.
39 //!
40 //! RVA stands for “relative virtual address”. Within a minidump file, RVAs are
41 //! used as pointers to link structures together.
42 //!
43 //! \sa MINIDUMP_LOCATION_DESCRIPTOR
44 typedef uint32_t RVA;
45
46 //! \brief A pointer to a structure or union within a minidump file.
47 struct __attribute__((packed, aligned(4))) MINIDUMP_LOCATION_DESCRIPTOR {
48 //! \brief The size of the referenced structure or union, in bytes.
49 uint32_t DataSize;
50
51 //! \brief The relative virtual address of the structure or union within the
52 //! minidump file.
53 RVA Rva;
54 };
55
56 //! \brief A pointer to a snapshot of a region of memory contained within a
57 //! minidump file.
58 //!
59 //! \sa MINIDUMP_MEMORY_LIST
60 struct __attribute__((packed, aligned(4))) MINIDUMP_MEMORY_DESCRIPTOR {
61 //! \brief The base address of the memory region in the address space of the
62 //! process that the minidump file contains a snapshot of.
63 uint64_t StartOfMemoryRange;
64
65 //! \brief The contents of the memory region.
66 MINIDUMP_LOCATION_DESCRIPTOR Memory;
67 };
68
69 //! \brief The top-level structure identifying a minidump file.
70 //!
71 //! This structure contains a pointer to the stream directory, a second-level
72 //! structure which in turn contains pointers to third-level structures
73 //! (“streams”) containing the data within the minidump file. This structure
74 //! also contains the minidump file’s magic numbers, and other bookkeeping data.
75 //!
76 //! This structure must be present at the beginning of a minidump file (at ::RVA
Robert Sesek 2014/07/31 16:55:41 Does Doxygen do something special to ::RVA, or is
Mark Mentovai 2014/07/31 17:06:54 rsesek wrote:
Robert Sesek 2014/07/31 17:25:36 Got it, I thought that might be the case.
77 //! 0).
78 struct __attribute__((packed, aligned(4))) MINIDUMP_HEADER {
79 //! \brief The minidump file format magic number, ::MINIDUMP_SIGNATURE.
80 uint32_t Signature;
81
82 //! \brief The minidump file format version number, ::MINIDUMP_VERSION.
83 uint32_t Version;
84
85 //! \brief The number of MINIDUMP_DIRECTORY elements present in the directory
86 //! referenced by #StreamDirectoryRva.
87 uint32_t NumberOfStreams;
88
89 //! \brief A pointer to an array of MINIDUMP_DIRECTORY structures that
90 //! identify all of the streams within this minidump file. The array has
91 //! #NumberOfStreams elements present.
92 RVA StreamDirectoryRva;
93
94 //! \brief The minidump file’s checksum. This can be `0`, and in practice, `0`
95 //! is the only value that has ever been seen in this field.
96 uint32_t CheckSum;
97
98 //! \brief The time that the minidump file was generated, in `time_t` format,
99 //! the number of seconds since the POSIX epoch.
100 uint32_t TimeDateStamp;
101
102 //! \brief A bitfield containing members of ::MINIDUMP_TYPE, describing the
103 //! types of data carried within this minidump file.
104 uint64_t Flags;
105 };
106
107 //! \brief A pointer to a stream within a minidump file.
108 //!
109 //! Each stream present in a minidump file will have a corresponding
110 //! MINIDUMP_DIRECTORY entry in the stream directory referenced by
111 //! MINIDUMP_HEADER::StreamDirectoryRva.
112 struct __attribute__((packed, aligned(4))) MINIDUMP_DIRECTORY {
113 //! \brief The type of stream referenced, a value of ::MINIDUMP_STREAM_TYPE.
114 uint32_t StreamType;
115
116 //! \brief A pointer to the stream data within the minidump file.
117 MINIDUMP_LOCATION_DESCRIPTOR Location;
118 };
119
120 //! \brief A variable-length UTF-16-encoded string carried within a minidump
Robert Sesek 2014/07/31 16:55:41 UTF-16 LE or BE, or is it the same as the minidump
121 //! file.
122 //!
123 //! \sa crashpad::MinidumpUTF8String
124 struct __attribute__((packed, aligned(4))) MINIDUMP_STRING {
125 //! \brief The length of the #Buffer field in bytes, not including the `NUL`
126 //! terminator.
127 //!
128 //! \note This field is interpreted as a byte count, not a count of UTF-16
129 //! code units or Unicode code points.
130 uint32_t Length;
131
132 //! \brief The string, encoded in UTF-16, and terminated with a UTF-16 `NUL`
133 //! code unit (two `NUL` bytes).
134 char16 Buffer[0];
135 };
136
137 //! \brief Minidump stream type values for MINIDUMP_DIRECTORY::StreamType. Each
138 //! stream structure has a corresponding stream type value to identify it.
139 //!
140 //! \sa crashpad::MinidumpStreamType
141 enum MINIDUMP_STREAM_TYPE {
142 //! \brief The stream type for MINIDUMP_THREAD_LIST.
143 ThreadListStream = 3,
144
145 //! \brief The stream type for MINIDUMP_MODULE_LIST.
146 ModuleListStream = 4,
147
148 //! \brief The stream type for MINIDUMP_MEMORY_LIST.
149 MemoryListStream = 5,
150
151 //! \brief The stream type for MINIDUMP_EXCEPTION_STREAM.
152 ExceptionStream = 6,
153
154 //! \brief The stream type for MINIDUMP_SYSTEM_INFO.
155 SystemInfoStream = 7,
156
157 //! \brief The stream type for MINIDUMP_MISC_INFO, MINIDUMP_MISC_INFO_2,
158 //! MINIDUMP_MISC_INFO_3, and MINIDUMP_MISC_INFO_4.
159 //!
160 //! More recent versions of this stream are supersets of earlier versions.
161 //!
162 //! The exact version of the stream that is present is implied by the stream’s
163 //! size. Furthermore, this stream contains a field,
164 //! MINIDUMP_MISC_INFO_STREAM::Flags1, that indicates which data is present
165 //! and valid.
166 MiscInfoStream = 15,
167 };
168
169 //! \brief Information about the CPU (or CPUs) that ran the process that the
170 //! minidump file contains a snapshot of.
171 //!
172 //! This union only appears as MINIDUMP_SYSTEM_INFO::Cpu. Its interpretation is
173 //! controlled by MINIDUMP_SYSTEM_INFO::ProcessorArchitecture.
174 union __attribute__((packed, aligned(4))) CPU_INFORMATION {
175 //! \brief Information about 32-bit x86 CPUs, or x86_64 CPUs when running
176 //! 32-bit x86 processes.
177 struct __attribute__((packed, aligned(4))) {
178 //! \brief The CPU’s vendor identification string as encoded in `cpuid 0`
179 //! `ebx`, `edx`, and `ecx`, represented as it appears in these
180 //! registers.
181 //!
182 //! For Intel CPUs, `[0]` will encode “Genu”, `[1]` will encode “ineI”, and
183 //! `[2]` will encode “ntel”, for a vendor ID string “GenuineIntel”.
184 //!
185 //! \note The Windows documentation incorrectly states that these fields are
186 //! to be interpreted as `cpuid 0` `eax`, `ebx`, and `ecx`.
187 uint32_t VendorId[3];
188
189 //! \brief Family, model, and stepping ID values as encoded in `cpuid 1`
190 //! `eax`.
191 uint32_t VersionInformation;
192
193 //! \brief A bitfield containing supported CPU capabilities as encoded in
194 //! `cpuid 1` `edx`.
195 uint32_t FeatureInformation;
196
197 //! \brief A bitfield containing supported CPU capabalities as encoded in
198 //! `cpuid 0x80000001` `edx`.
199 //!
200 //! This field is only valid if #VendorId identifies the CPU vendor as
201 //! “AuthenticAMD”.
202 uint32_t AMDExtendedCpuFeatures;
203 } X86CpuInfo;
204
205 //! \brief Information about non-x86 CPUs, and x86_64 CPUs when not running
206 //! 32-bit x86 processes.
207 struct __attribute__((packed, aligned(4))) {
208 //! \brief Bitfields containing supported CPU capabilities as identified by
209 //! bits corresponding to `PF_*` values passed to
210 //! `IsProcessorFeaturePresent()`.
211 uint64_t ProcessorFeatures[2];
212 } OtherCpuInfo;
213 };
214
215 //! \brief Information about the system that hosted the process that the
216 //! minidump file contains a snapshot of.
217 struct __attribute__((packed, aligned(4))) MINIDUMP_SYSTEM_INFO {
218 // The next 4 fields are from the SYSTEM_INFO structure returned by
219 // GetSystemInfo().
220
221 //! \brief The system’s CPU architecture. This may be a \ref
222 //! PROCESSOR_ARCHITECTURE_x "PROCESSOR_ARCHITECTURE_*" value, or a member
223 //! of crashpad::MinidumpCPUArchitecture.
224 //!
225 //! In some cases, a system may be able to run processes of multiple specific
226 //! architecture types. For example, systems based on 64-bit architectures
227 //! such as x86_64 are often able to run 32-bit code of another architecture
228 //! in the same family, such as 32-bit x86. On these systems, this field will
229 //! identify the architecture of the process that the minidump file contains a
230 //! snapshot of.
231 uint16_t ProcessorArchitecture;
232
233 //! \brief General CPU version information.
234 //!
235 //! The precise interpretation of this field is specific to each CPU
236 //! architecture. For x86-family CPUs (including x86_64 and 32-bit x86), this
237 //! field contains the CPU family ID value from `cpuid 1` `eax`, adjusted to
238 //! take the extended family ID into account.
239 uint16_t ProcessorLevel;
240
241 //! \brief Specific CPU version information.
242 //!
243 //! The precise interpretation of this field is specific to each CPU
244 //! architecture. For x86-family CPUs (including x86_64 and 32-bit x86), this
245 //! field contains values obtained from `cpuid 1` `eax`: the high byte
246 //! contains the CPU model ID value adjusted to take the extended model ID
247 //! into account, and the low byte contains the CPU stepping ID value.
248 uint16_t ProcessorRevision;
249
250 //! \brief The total number of CPUs present in the system.
251 uint8_t NumberOfProcessors;
252
253 // The next 7 fields are from the OSVERSIONINFOEX structure returned by
254 // GetVersionEx().
255
256 //! \brief The system’s operating system type, which distinguishes between
257 //! “desktop” or “workstation” systems and “server” systems. This may be a
258 //! \ref VER_NT_x "VER_NT_*" value, or a member of
259 //! crashpad::MinidumpOSType.
260 uint8_t ProductType;
261
262 //! \brief The system’s operating system version number’s first (major)
263 //! component.
264 //!
265 //! - For Windows 7 (NT 6.1) SP1, version 6.1.7601, this would be `6`.
266 //! - For Mac OS X 10.9.2, this would be `10`.
267 uint32_t MajorVersion;
268
269 //! \brief The system’s operating system version number’s second (minor)
270 //! component.
271 //!
272 //! - For Windows 7 (NT 6.1) SP1, version 6.1.7601, this would be `1`.
273 //! - For Mac OS X 10.9.2, this would be `9`.
274 uint32_t MinorVersion;
275
276 //! \brief The system’s operating system version number’s third (build or
277 //! patch) component.
278 //!
279 //! - For Windows 7 (NT 6.1) SP1, version 6.1.7601, this would be `7601`.
280 //! - For Mac OS X 10.9.2, this would be `2`.
281 uint32_t BuildNumber;
282
283 //! \brief The system’s operating system family. This may be a \ref
284 //! VER_PLATFORM_x "VER_PLATFORM_*" value, or a member of
285 //! crashpad::MinidumpOS.
286 uint32_t PlatformId;
287
288 //! \brief ::RVA of a MINIDUMP_STRING containing operating system-specific
289 //! version information.
290 //!
291 //! This field further identifies an operating system version beyond its
292 //! version number fields. Historically, “CSD” stands for “corrective service
293 //! diskette.”
294 //!
295 //! - On Windows, this is the name of the installed operating system service
296 //! pack, such as “Service Pack 1”. If no service pack is installed, this
297 //! field references an empty string.
298 //! - On Mac OS X, this is the operating system build number from `sw_vers
299 //! -buildVersion`. For Mac OS X 10.9.2 on most hardware types, this would
300 //! be `13C64`.
301 //! - On Linux and other Unix-like systems, this is the kernel version from
302 //! `uname -srvm`, possibly with additional information appended. On
303 //! Android, the `ro.build.fingerprint` system property is appended.
304 RVA CSDVersionRva;
305
306 //! \brief A bitfield identifying products installed on the system. This is
307 //! composed of \ref VER_SUITE_x "VER_SUITE_*" values.
308 //!
309 //! This field is Windows-specific, and has no meaning on other operating
310 //! systems.
311 uint16_t SuiteMask;
312
313 uint16_t Reserved2;
314
315 //! \brief Information about the system’s CPUs.
316 //!
317 //! This field is a union. Which of its members should be expressed is
318 //! controlled by the #ProcessorArchitecture field. If it is set to
319 //! crashpad::kMinidumpCPUArchitectureX86, the CPU_INFORMATION::X86CpuInfo
320 //! field is expressed. Otherwise, the CPU_INFORMATION::OtherCpuInfo field is
321 //! expressed.
322 //!
323 //! \note Older Breakpad implementations produce minidump files that express
324 //! CPU_INFORMATION::X86CpuInfo when #ProcessorArchitecture is set to
325 //! crashpad::kMinidumpCPUArchitectureAMD64. Minidump files produced by
326 //! `dbghelp.dll` on Windows express CPU_INFORMATION::OtherCpuInfo in this
327 //! case.
328 CPU_INFORMATION Cpu;
329 };
330
331 //! \brief Information about a specific thread within the process.
332 //!
333 //! \sa MINIDUMP_THREAD_LIST
334 struct __attribute__((packed, aligned(4))) MINIDUMP_THREAD {
335 //! \brief The thread’s ID. This may be referenced by
336 //! MINIDUMP_EXCEPTION_STREAM::ThreadId.
337 uint32_t ThreadId;
338
339 //! \brief The thread’s suspend count.
340 //!
341 //! This field will be `0` if the thread is schedulable (not suspended).
342 uint32_t SuspendCount;
343
344 //! \brief The thread’s priority class.
345 //!
346 //! On Windows, this is a `*_PRIORITY_CLASS` value. `NORMAL_PRIORITY_CLASS`
347 //! has value `0x20`; higher priority classes have higher values.
348 uint32_t PriorityClass;
349
350 //! \brief The thread’s priority level.
351 //!
352 //! On Windows, this is a `THREAD_PRIORITY_*` value. `THREAD_PRIORITY_NORMAL`
353 //! has value `0`; higher priorities have higher values, and lower priorities
354 //! have lower (negative) values.
355 uint32_t Priority;
356
357 //! \brief The address of the thread’s thread environment block in the address
358 //! space of the process that the minidump file contains a snapshot of.
359 //!
360 //! The thread environment block contains thread-local data.
361 //!
362 //! A MINIDUMP_MEMORY_DESCRIPTOR may be present in the MINIDUMP_MEMORY_LIST
363 //! stream containing the thread-local data pointed to by this field.
364 uint64_t Teb;
365
366 // \brief A snapshot of the thread’s stack.
367 //
368 // A MINIDUMP_MEMORY_DESCRIPTOR may be present in the MINIDUMP_MEMORY_LIST
369 // stream containing a pointer to the same memory range referenced by this
370 // field.
371 MINIDUMP_MEMORY_DESCRIPTOR Stack;
372
373 //! \brief A pointer to a CPU-specific CONTEXT structure containing the
374 //! thread’s context at the time the snapshot was taken.
375 //!
376 //! If the minidump file was generated as a result of an exception taken on
377 //! this thread, this field may identify a different context than the
378 //! exception context. For these minidump files, a MINIDUMP_EXCEPTION_STREAM
379 //! stream will be present, and the context contained within that stream will
380 //! be the exception context.
381 //!
382 //! The interpretation of the context structure is dependent on the CPU
383 //! architecture identified by MINIDUMP_SYSTEM_INFO::ProcessorArchitecture.
384 //! For crashpad::kMinidumpCPUArchitectureX86, this will be
385 //! crashpad::MinidumpContextX86. For crashpad::kMinidumpCPUArchitectureAMD64,
386 //! this will be crashpad::MinidumpContextAMD64.
387 MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
388 };
389
390 //! \brief Information about all threads within the process.
391 struct __attribute__((packed, aligned(4))) MINIDUMP_THREAD_LIST {
392 //! \brief The number of threads present in the #Threads array.
393 uint32_t NumberOfThreads;
394
395 //! \brief Structures identifying each thread within the process.
396 MINIDUMP_THREAD Threads[0];
397 };
398
399 //! \brief Information about an exception that occurred in the process.
400 struct __attribute__((packed, aligned(4))) MINIDUMP_EXCEPTION {
401 //! \brief The top-level exception code identifying the exception, in
402 //! operating system-specific values.
403 //!
404 //! For Mac OS X minidumps, this will be a value of
405 //! crashpad::MinidumpExceptionCodeMac, which corresponds to an `EXC_*`
406 //! exception type. `EXC_CRASH` will not appear here for exceptions processed
407 //! as `EXC_CRASH` when generated from another preceding exception: the
408 //! original exception code will appear instead. The exception type as it was
409 //! received will appear at index 0 of #ExceptionInformation.
410 //!
411 //! \note This field is named ExceptionCode, but what is known as the
412 //! “exception code” on Mac OS X/Mach is actually stored in the
413 //! #ExceptionFlags field of a minidump file.
414 //!
415 //! \todo Document the possible values by OS. There should be OS-specific
416 //! enums in minidump_extensions.h.
417 uint32_t ExceptionCode;
418
419 //! \brief Additional exception flags that further identify the exception, in
420 //! operating system-specific values.
421 //!
422 //! For Mac OS X minidumps, this will be the value of the exception code at
423 //! index 0 as received by a Mach exception handler. For exception type
424 //! `EXC_CRASH` generated from another preceding exception, the original
425 //! exception code will appear here, not the code as received by the Mach
426 //! exception handler. The code as it was received will appear at index 1 of
427 //! #ExceptionInformation.
428 //!
429 //! \todo Document the possible values by OS. There should be OS-specific
430 //! enums in minidump_extensions.h.
431 uint32_t ExceptionFlags;
432
433 //! \brief An address, in the address space of the process that this minidump
434 //! file contains a snapshot of, of another MINIDUMP_EXCEPTION. This field
435 //! is used for nested exceptions.
436 uint64_t ExceptionRecord;
437
438 //! \brief The address that caused the exception.
439 //!
440 //! This may be the address that caused a fault on data access, or it may be
441 //! the instruction pointer that contained an offending instruction.
442 uint64_t ExceptionAddress;
443
444 //! \brief The number of valid elements in #ExceptionInformation.
445 uint32_t NumberParameters;
446
447 uint32_t __unusedAlignment;
448
449 //! \brief Additional information about the exception, specific to the
450 //! operating system and possibly the #ExceptionCode.
451 //!
452 //! For Mac OS X minidumps, this will contain the exception type as received
453 //! by a Mach exception handler and the values of the `codes[0]` and
454 //! `codes[1]` (exception code and subcode) parameters supplied to the Mach
455 //! exception handler. Unlike #ExceptionCode and #ExceptionFlags, the values
456 //! received by a Mach exception handler are used directly here even for the
457 //! `EXC_CRASH` exception type.
458 uint64_t ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
459 };
460
461 //! \brief Information about the exception that triggered a minidump file’s
462 //! generation.
463 struct __attribute__((packed, aligned(4))) MINIDUMP_EXCEPTION_STREAM {
464 //! \brief The ID of the thread that caused the exception.
465 //!
466 //! \sa MINIDUMP_THREAD::ThreadId
467 uint32_t ThreadId;
468
469 uint32_t __alignment;
470
471 //! \brief Information about the exception.
472 MINIDUMP_EXCEPTION ExceptionRecord;
473
474 //! \brief A pointer to a CPU-specific CONTEXT structure containing the
475 //! thread’s context at the time the exception was caused.
476 //!
477 //! The interpretation of the context structure is dependent on the CPU
478 //! architecture identified by MINIDUMP_SYSTEM_INFO::ProcessorArchitecture.
479 //! For crashpad::kMinidumpCPUArchitectureX86, this will be
480 //! crashpad::MinidumpContextX86. For crashpad::kMinidumpCPUArchitectureAMD64,
481 //! this will be crashpad::MinidumpContextAMD64.
482 MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
483 };
484
485 //! \brief Information about a specific module loaded within the process at the
486 //! time the snapshot was taken.
487 //!
488 //! A module may be the main executable, a shared library, or a loadable module.
489 //!
490 //! \sa MINIDUMP_MODULE_LIST
491 struct __attribute__((packed, aligned(4))) MINIDUMP_MODULE {
492 //! \brief The base address of the loaded module in the address space of the
493 //! process that the minidump file contains a snapshot of.
494 uint64_t BaseOfImage;
495
496 //! \brief The size of the loaded module.
497 uint32_t SizeOfImage;
498
499 //! \brief The loaded module’s checksum, or `0` if unknown.
500 //!
501 //! On Windows, this field comes from the `CheckSum` field of the module’s
502 //! `IMAGE_OPTIONAL_HEADER` structure, if present. It reflects the checksum at
503 //! the time the module was linked.
504 uint32_t CheckSum;
505
506 //! \brief The module’s timestamp, in `time_t` units, seconds since the POSIX
507 //! epoch.
508 //!
509 //! On Windows, this field comes from the `TimeDateStamp` field of the
510 //! module’s `IMAGE_HEADER` structure. It reflects the timestamp at the time
511 //! the module was linked.
512 uint32_t TimeDateStamp;
513
514 //! \brief ::RVA of a MINIDUMP_STRING containing the module’s path or file
515 //! name.
516 RVA ModuleNameRva;
517
518 //! \brief The module’s version information.
519 VS_FIXEDFILEINFO VersionInfo;
520
521 //! \brief A pointer to the module’s CodeView record, typically a link to its
522 //! debugging information in crashpad::MinidumpModuleCodeViewRecordPDB70
523 //! format.
524 //!
525 //! The specific format of the CodeView record is indicated by its signature,
526 //! the first 32-bit value in the structure. For links to debugging
527 //! information in contemporary usage, this is normally a
528 //! crashpad::MinidumpModuleCodeViewRecordPDB70 structure, but may be a
529 //! crashpad::MinidumpModuleCodeViewRecordPDB20 structure instead. These
530 //! structures identify a link to debugging data within a `.pdb` (Program
531 //! Database) file. See <a
532 //! href="http://www.debuginfo.com/articles/debuginfomatch.html#pdbfiles">Matc hing
533 //! Debug Information</a>, PDB Files.
534 //!
535 //! On Windows, it is also possible for the CodeView record to contain
536 //! debugging information itself, as opposed to a link to a `.pdb` file. See
537 //! <a
538 //! href="http://pierrelib.pagesperso-orange.fr/exec_formats/MS_Symbol_Type_v1 .0.pdf#page=71">Microsoft
539 //! Symbol and Type Information</a>, section 7.2, “Debug Information Format”
540 //! for a list of debug information formats, and <a
541 //! href="http://undocumented.rawol.com/sbs-w2k-1-windows-2000-debugging-suppo rt.pdf#page=63">Undocumented
542 //! Windows 2000 Secrets</a>, Windows 2000 Debugging Support/Microsoft Symbol
543 //! File Internals/CodeView Subsections for an in-depth description of the
544 //! CodeView 4.1 format. Signatures seen in the wild include “NB09”
545 //! (0x3930424e) for CodeView 4.1 and “NB11” (0x3131424e) for CodeView 5.0.
546 //! This form of debugging information within the module, as opposed to a link
547 //! to an external `.pdb` file, is chosen by building with `/Z7`.
548 //!
549 //! On Windows, the CodeView record is taken from a module’s
550 //! IMAGE_DEBUG_DIRECTORY entry whose Type field has the value
551 //! IMAGE_DEBUG_TYPE_CODEVIEW (`2`), if any. Records in
552 //! crashpad::MinidumpModuleCodeViewRecordPDB70 format are generated by Visual
553 //! Studio .NET (2002) (version 7.0) and later.
554 //!
555 //! When the CodeView record is not present, the fields of this
556 //! MINIDUMP_LOCATION_DESCRIPTOR will be `0`.
557 MINIDUMP_LOCATION_DESCRIPTOR CvRecord;
558
559 //! \brief A pointer to the module’s miscellaneous debugging record, a
560 //! structure of type IMAGE_DEBUG_MISC.
561 //!
562 //! This field is Windows-specific, and has no meaning on other operating
563 //! systems. It is largely obsolete on Windows, where it was used to link to
564 //! debugging information stored in a `.dbg` file. `.dbg` files have been
565 //! superseded by `.pdb` files.
566 //!
567 //! On Windows, the miscellaneous debugging record is taken from module’s
568 //! IMAGE_DEBUG_DIRECTORY entry whose Type field has the value
569 //! IMAGE_DEBUG_TYPE_MISC (`4`), if any.
570 //!
571 //! When the miscellaneous debugging record is not present, the fields of this
572 //! MINIDUMP_LOCATION_DESCRIPTOR will be `0`.
573 //!
574 //! \sa #CvRecord
575 MINIDUMP_LOCATION_DESCRIPTOR MiscRecord;
576
577 uint64_t Reserved0;
578 uint64_t Reserved1;
579 };
580
581 //! \brief Information about all modules loaded within the process at the time
582 //! the snapshot was taken.
583 struct __attribute__((packed, aligned(4))) MINIDUMP_MODULE_LIST {
584 //! \brief The number of modules present in the #Modules array.
585 uint32_t NumberOfModules;
586
587 //! \brief Structures identifying each module present in the minidump file.
588 MINIDUMP_MODULE Modules[0];
589 };
590
591 //! \brief Information about memory regions within the process.
592 //!
593 //! Typically, a minidump file will not contain a snapshot of a process’ entire
594 //! memory image. For minidump files identified as ::MiniDumpNormal in
595 //! MINIDUMP_HEADER::Flags, memory regions are limited to those referenced by
596 //! MINIDUMP_THREAD::Stack fields, and a small number of others possibly related
597 //! to the exception that triggered the snapshot to be taken.
598 struct __attribute__((packed, aligned(4))) MINIDUMP_MEMORY_LIST {
599 //! \brief The number of memory regions present in the #MemoryRanges array.
600 uint32_t NumberOfMemoryRanges;
601
602 //! \brief Structures identifying each memory region present in the minidump
603 //! file.
604 MINIDUMP_MEMORY_DESCRIPTOR MemoryRanges[0];
605 };
606
607 //! \anchor MINIDUMP_MISCx
608 //! \name MINIDUMP_MISC*
609 //!
610 //! \brief Field validity flag values for MINIDUMP_MISC_INFO::Flags1.
611 //! \{
612
613 //! \brief MINIDUMP_MISC_INFO::ProcessId is valid.
614 #define MINIDUMP_MISC1_PROCESS_ID 0x00000001
615
616 //! \brief The time-related fields in MINIDUMP_MISC_INFO are valid.
617 //!
618 //! The following fields are valid:
619 //! - MINIDUMP_MISC_INFO::ProcessCreateTime
Robert Sesek 2014/07/31 16:55:41 Does Doxygen automatically turn these into bullete
Mark Mentovai 2014/07/31 17:06:54 rsesek wrote:
620 //! - MINIDUMP_MISC_INFO::ProcessUserTime
621 //! - MINIDUMP_MISC_INFO::ProcessKernelTime
622 #define MINIDUMP_MISC1_PROCESS_TIMES 0x00000002
623
624 //! \brief The CPU-related fields in MINIDUMP_MISC_INFO_2 are valid.
625 //!
626 //! The following fields are valid:
627 //! - MINIDUMP_MISC_INFO_2::ProcessorMaxMhz
628 //! - MINIDUMP_MISC_INFO_2::ProcessorCurrentMhz
629 //! - MINIDUMP_MISC_INFO_2::ProcessorMhzLimit
630 //! - MINIDUMP_MISC_INFO_2::ProcessorMaxIdleState
631 //! - MINIDUMP_MISC_INFO_2::ProcessorCurrentIdleState
632 //!
633 //! \note This macro should likely have been named
634 //! MINIDUMP_MISC2_PROCESSOR_POWER_INFO.
635 #define MINIDUMP_MISC1_PROCESSOR_POWER_INFO 0x00000004
636
637 //! \brief MINIDUMP_MISC_INFO3::ProcessIntegrityLevel is valid.
638 #define MINIDUMP_MISC3_PROCESS_INTEGRITY 0x00000010
639
640 //! \brief MINIDUMP_MISC_INFO3::ProcessExecuteFlags is valid.
641 #define MINIDUMP_MISC3_PROCESS_EXECUTE_FLAGS 0x00000020
642
643 //! \brief The time zone-related fields in MINIDUMP_MISC_INFO_3 are valid.
644 //!
645 //! The following fields are valid:
646 //! - MINIDUMP_MISC_INFO_3::TimeZoneId
647 //! - MINIDUMP_MISC_INFO_3::TimeZone
648 #define MINIDUMP_MISC3_TIMEZONE 0x00000040
649
650 //! \brief MINIDUMP_MISC_INFO3::ProtectedProcess is valid.
651 #define MINIDUMP_MISC3_PROTECTED_PROCESS 0x00000080
652
653 //! \brief The build string-related fields in MINIDUMP_MISC_INFO_4 are valid.
654 //!
655 //! The following fields are valid:
656 //! - MINIDUMP_MISC_INFO_4::BuildString
657 //! - MINIDUMP_MISC_INFO_4::DbgBldStr
658 #define MINIDUMP_MISC4_BUILDSTRING 0x00000100
659 //! \}
660
661 //! \brief Information about the process that the minidump file contains a
662 //! snapshot of, as well as the system that hosted that process.
663 //!
664 //! \sa \ref MINIDUMP_MISCx "MINIDUMP_MISC*"
665 //! \sa MINIDUMP_MISC_INFO_2
666 //! \sa MINIDUMP_MISC_INFO_3
667 //! \sa MINIDUMP_MISC_INFO_4
668 //! \sa MINIDUMP_MISC_INFO_N
669 struct __attribute__((packed, aligned(4))) MINIDUMP_MISC_INFO {
670 //! \brief The size of the structure.
671 //!
672 //! This field can be used to distinguish between different versions of this
673 //! structure: MINIDUMP_MISC_INFO, MINIDUMP_MISC_INFO_2, MINIDUMP_MISC_INFO_3,
674 //! and MINIDUMP_MISC_INFO_4.
675 //!
676 //! \sa Flags1
677 uint32_t SizeOfInfo;
678
679 //! \brief A bit field of \ref MINIDUMP_MISCx "MINIDUMP_MISC*" values
680 //! indicating which fields of this structure contain valid data.
681 uint32_t Flags1;
682
683 //! \brief The process ID of the process.
684 uint32_t ProcessId;
685
686 //! \brief The time that the process started, in `time_t` units, seconds since
687 //! the POSIX epoch.
688 uint32_t ProcessCreateTime;
689
690 //! \brief The amount of user-mode CPU time used by the process, in seconds,
691 //! at the time of the snapshot.
692 uint32_t ProcessUserTime;
693
694 //! \brief The amount of system-mode (kernel) CPU time used by the process, in
695 //! seconds, at the time of the snapshot.
696 uint32_t ProcessKernelTime;
697 };
698
699 //! \brief Information about the process that the minidump file contains a
700 //! snapshot of, as well as the system that hosted that process.
701 //!
702 //! This structure variant is used on Windows Vista (NT 6.0) and later.
703 //!
704 //! \sa \ref MINIDUMP_MISCx "MINIDUMP_MISC*"
705 //! \sa MINIDUMP_MISC_INFO
706 //! \sa MINIDUMP_MISC_INFO_3
707 //! \sa MINIDUMP_MISC_INFO_4
708 //! \sa MINIDUMP_MISC_INFO_N
709 struct __attribute__((packed, aligned(4))) MINIDUMP_MISC_INFO_2
710 : public MINIDUMP_MISC_INFO {
711 //! \brief The maximum clock rate of the system’s CPU or CPUs, in MHz.
712 uint32_t ProcessorMaxMhz;
713
714 //! \brief The clock rate of the system’s CPU or CPUs, in MHz, at the time of
715 //! the snapshot.
716 uint32_t ProcessorCurrentMhz;
717
718 //! \brief The maximum clock rate of the system’s CPU or CPUs, in MHz, reduced
719 //! by any thermal limitations, at the time of the snapshot.
720 uint32_t ProcessorMhzLimit;
721
722 //! \brief The maximum idle state of the system’s CPU or CPUs.
723 uint32_t ProcessorMaxIdleState;
724
725 //! \brief The idle state of the system’s CPU or CPUs at the time of the
726 //! snapshot.
727 uint32_t ProcessorCurrentIdleState;
728 };
729
730 //! \brief Information about the process that the minidump file contains a
731 //! snapshot of, as well as the system that hosted that process.
732 //!
733 //! This structure variant is used on Windows 7 (NT 6.1) and later.
734 //!
735 //! \sa \ref MINIDUMP_MISCx "MINIDUMP_MISC*"
736 //! \sa MINIDUMP_MISC_INFO
737 //! \sa MINIDUMP_MISC_INFO_2
738 //! \sa MINIDUMP_MISC_INFO_4
739 //! \sa MINIDUMP_MISC_INFO_N
740 struct __attribute__((packed, aligned(4))) MINIDUMP_MISC_INFO_3
741 : public MINIDUMP_MISC_INFO_2 {
742 //! \brief The process’ integrity level.
743 //!
744 //! Windows typically uses `SECURITY_MANDATORY_MEDIUM_RID` (0x2000) for
745 //! processes belonging to normal authenticated users and
746 //! `SECURITY_MANDATORY_HIGH_RID` (0x3000) for elevated processes.
747 //!
748 //! This field is Windows-specific, and has no meaning on other operating
Robert Sesek 2014/07/31 16:55:41 Process UID maybe? Would only be interesting if <
Mark Mentovai 2014/07/31 17:06:54 rsesek wrote:
749 //! systems.
750 uint32_t ProcessIntegrityLevel;
751
752 //! \brief The process’ execute flags.
753 //!
754 //! On Windows, this appears to be returned by `NtQueryInformationProcess()`
755 //! with an argument of `ProcessExecuteFlags` (34).
756 //!
757 //! This field is Windows-specific, and has no meaning on other operating
758 //! systems.
759 uint32_t ProcessExecuteFlags;
760
761 //! \brief Whether the process is protected.
762 //!
763 //! This field is Windows-specific, and has no meaning on other operating
Robert Sesek 2014/07/31 16:55:41 Could be a sandbox check on Mac.
Mark Mentovai 2014/07/31 17:06:54 rsesek wrote:
764 //! systems.
765 uint32_t ProtectedProcess;
766
767 //! \brief Whether daylight saving time was being observed in the system’s
768 //! location at the time of the snapshot.
769 //!
770 //! This field can contain the following values:
771 //! - `0` if the location does not observe daylight saving time at all. The
772 //! TIME_ZONE_INFORMATION::StandardName field of #TimeZoneId contains the
773 //! time zone name.
774 //! - `1` if the location observes daylight saving time, but standard time
775 //! was in effect at the time of the snapshot. The
776 //! TIME_ZONE_INFORMATION::StandardName field of #TimeZoneId contains the
777 //! time zone name.
778 //! - `2` if the location observes daylight saving time, and it was in effect
779 //! at the time of the snapshot. The TIME_ZONE_INFORMATION::DaylightName
780 //! field of #TimeZoneId contains the time zone name.
781 //!
782 //! \sa #TimeZone
783 uint32_t TimeZoneId;
784
785 //! \brief Information about the time zone at the system’s location.
786 //!
787 //! \sa #TimeZoneId
788 TIME_ZONE_INFORMATION TimeZone;
789 };
790
791 //! \brief Information about the process that the minidump file contains a
792 //! snapshot of, as well as the system that hosted that process.
793 //!
794 //! This structure variant is used on Windows 8 (NT 6.2) and later.
795 //!
796 //! \sa \ref MINIDUMP_MISCx "MINIDUMP_MISC*"
797 //! \sa MINIDUMP_MISC_INFO
798 //! \sa MINIDUMP_MISC_INFO_2
799 //! \sa MINIDUMP_MISC_INFO_3
800 //! \sa MINIDUMP_MISC_INFO_N
801 struct __attribute__((packed, aligned(4))) MINIDUMP_MISC_INFO_4
802 : public MINIDUMP_MISC_INFO_3 {
803 //! \brief The operating system’s “build string”, a string identifying a
804 //! specific build of the operating system.
805 //!
806 //! This string is UTF-16-encoded and terminated by a UTF-16 `NUL` code unit.
807 //!
808 //! On Windows 8.1 (NT 6.3), this is “6.3.9600.17031
809 //! (winblue_gdr.140221-1952)”.
810 char16 BuildString[260];
811
812 //! \brief The minidump producer’s “build string”, a string identifying the
813 //! module that produced a minidump file.
814 //!
815 //! This string is UTF-16-encoded and terminated by a UTF-16 `NUL` code unit.
816 //!
817 //! On Windows 8.1 (NT 6.3), this may be “dbghelp.i386,6.3.9600.16520” or
818 //! “dbghelp.amd64,6.3.9600.16520” depending on CPU architecture.
819 char16 DbgBldStr[40];
820 };
821
822 //! \brief The latest known version of the MINIDUMP_MISC_INFO structure.
823 typedef MINIDUMP_MISC_INFO_4 MINIDUMP_MISC_INFO_N;
824
825 //! \brief Minidump file type values for MINIDUMP_HEADER::Flags. These bits
826 //! describe the types of data carried within a minidump file.
827 enum MINIDUMP_TYPE {
828 //! \brief A minidump file without any additional data.
829 //!
830 //! This type of minidump file contains:
831 //! - A MINIDUMP_SYSTEM_INFO stream.
832 //! - A MINIDUMP_MISC_INFO, MINIDUMP_MISC_INFO_2, MINIDUMP_MISC_INFO_3, or
833 //! MINIDUMP_MISC_INFO_4 stream, depending on which fields are present.
834 //! - A MINIDUMP_THREAD_LIST stream. All threads are present, along with a
835 //! snapshot of each thread’s stack memory sufficient to obtain backtraces.
836 //! - If the minidump file was generated as a result of an exception, a
837 //! MINIDUMP_EXCEPTION_STREAM describing the exception.
838 //! - A MINIDUMP_MODULE_LIST stream. All loaded modules are present.
839 //! - Typically, a MINIDUMP_MEMORY_LIST stream containing duplicate pointers
840 //! to the stack memory regions also referenced by the MINIDUMP_THREAD_LIST
841 //! stream. Since Windows 7 (NT 6.1), this type of minidump file also
842 //! includes a MINIDUMP_MEMORY_DESCRIPTOR containing the 256 bytes centered
843 //! around the exception address or the instruction pointer.
844 MiniDumpNormal = 0x00000000,
845 };
846
847 #endif // CRASHPAD_COMPAT_NON_WIN_DBGHELP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698