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