OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with 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 | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 | 14 |
15 #ifndef CRASHPAD_MINIDUMP_MINIDUMP_EXTENSIONS_H_ | 15 #ifndef CRASHPAD_MINIDUMP_MINIDUMP_EXTENSIONS_H_ |
16 #define CRASHPAD_MINIDUMP_MINIDUMP_EXTENSIONS_H_ | 16 #define CRASHPAD_MINIDUMP_MINIDUMP_EXTENSIONS_H_ |
17 | 17 |
| 18 #include "build/build_config.h" |
| 19 |
| 20 #if defined(OS_WIN) |
| 21 #include <windows.h> |
| 22 #endif // OS_WIN |
| 23 |
18 #include <dbghelp.h> | 24 #include <dbghelp.h> |
19 #include <stdint.h> | 25 #include <stdint.h> |
20 #include <winnt.h> | 26 #include <winnt.h> |
21 | 27 |
| 28 #include "util/misc/struct_pack.h" |
22 #include "util/misc/uuid.h" | 29 #include "util/misc/uuid.h" |
23 | 30 |
24 namespace crashpad { | 31 namespace crashpad { |
25 | 32 |
26 //! \brief Minidump stream type values for MINIDUMP_DIRECTORY::StreamType. Each | 33 //! \brief Minidump stream type values for MINIDUMP_DIRECTORY::StreamType. Each |
27 //! stream structure has a corresponding stream type value to identify it. | 34 //! stream structure has a corresponding stream type value to identify it. |
28 //! | 35 //! |
29 //! \sa MINIDUMP_STREAM_TYPE | 36 //! \sa MINIDUMP_STREAM_TYPE |
30 enum MinidumpStreamType : uint32_t { | 37 enum MinidumpStreamType : uint32_t { |
31 //! \brief The stream type for MINIDUMP_THREAD_LIST. | 38 //! \brief The stream type for MINIDUMP_THREAD_LIST. |
(...skipping 30 matching lines...) Expand all Loading... |
62 // 0x4350 = "CP" | 69 // 0x4350 = "CP" |
63 | 70 |
64 //! \brief The stream type for MinidumpCrashpadInfo. | 71 //! \brief The stream type for MinidumpCrashpadInfo. |
65 kMinidumpStreamTypeCrashpadInfo = 0x43500001, | 72 kMinidumpStreamTypeCrashpadInfo = 0x43500001, |
66 }; | 73 }; |
67 | 74 |
68 //! \brief A variable-length UTF-8-encoded string carried within a minidump | 75 //! \brief A variable-length UTF-8-encoded string carried within a minidump |
69 //! file. | 76 //! file. |
70 //! | 77 //! |
71 //! \sa MINIDUMP_STRING | 78 //! \sa MINIDUMP_STRING |
72 struct __attribute__((packed, aligned(4))) MinidumpUTF8String { | 79 PACK_AND_ALIGN_4(struct MinidumpUTF8String { |
73 // The field names do not conform to typical style, they match the names used | 80 // 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 | 81 // in MINIDUMP_STRING. This makes it easier to operate on MINIDUMP_STRING (for |
75 // UTF-16 strings) and MinidumpUTF8String using templates. | 82 // UTF-16 strings) and MinidumpUTF8String using templates. |
76 | 83 |
77 //! \brief The length of the #Buffer field in bytes, not including the `NUL` | 84 //! \brief The length of the #Buffer field in bytes, not including the `NUL` |
78 //! terminator. | 85 //! terminator. |
79 //! | 86 //! |
80 //! \note This field is interpreted as a byte count, not a count of Unicode | 87 //! \note This field is interpreted as a byte count, not a count of Unicode |
81 //! code points. | 88 //! code points. |
82 uint32_t Length; | 89 uint32_t Length; |
83 | 90 |
84 //! \brief The string, encoded in UTF-8, and terminated with a `NUL` byte. | 91 //! \brief The string, encoded in UTF-8, and terminated with a `NUL` byte. |
85 uint8_t Buffer[0]; | 92 uint8_t Buffer[0]; |
86 }; | 93 };) |
87 | 94 |
88 //! \brief CPU type values for MINIDUMP_SYSTEM_INFO::ProcessorArchitecture. | 95 //! \brief CPU type values for MINIDUMP_SYSTEM_INFO::ProcessorArchitecture. |
89 //! | 96 //! |
90 //! \sa \ref PROCESSOR_ARCHITECTURE_x "PROCESSOR_ARCHITECTURE_*" | 97 //! \sa \ref PROCESSOR_ARCHITECTURE_x "PROCESSOR_ARCHITECTURE_*" |
91 enum MinidumpCPUArchitecture : uint16_t { | 98 enum MinidumpCPUArchitecture : uint16_t { |
92 //! \brief 32-bit x86. | 99 //! \brief 32-bit x86. |
93 //! | 100 //! |
94 //! These systems identify their CPUs generically as “x86” or “ia32”, or with | 101 //! These systems identify their CPUs generically as “x86” or “ia32”, or with |
95 //! more specific names such as “i386”, “i486”, “i586”, and “i686”. | 102 //! more specific names such as “i386”, “i486”, “i586”, and “i686”. |
96 kMinidumpCPUArchitectureX86 = PROCESSOR_ARCHITECTURE_INTEL, | 103 kMinidumpCPUArchitectureX86 = PROCESSOR_ARCHITECTURE_INTEL, |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 //! \brief The path or file name of the `.pdb` file associated with the | 297 //! \brief The path or file name of the `.pdb` file associated with the |
291 //! module. | 298 //! module. |
292 //! | 299 //! |
293 //! This is a NUL-terminated string. On Windows, it will be encoded in the | 300 //! This is a NUL-terminated string. On Windows, it will be encoded in the |
294 //! code page of the system that linked the module. On other operating | 301 //! code page of the system that linked the module. On other operating |
295 //! systems, UTF-8 may be used. | 302 //! systems, UTF-8 may be used. |
296 uint8_t pdb_name[1]; | 303 uint8_t pdb_name[1]; |
297 }; | 304 }; |
298 | 305 |
299 //! \brief A list of ::RVA pointers. | 306 //! \brief A list of ::RVA pointers. |
300 struct __attribute__((packed, aligned(4))) MinidumpRVAList { | 307 PACK_AND_ALIGN_4(struct MinidumpRVAList { |
301 //! \brief The number of children present in the #children array. | 308 //! \brief The number of children present in the #children array. |
302 uint32_t count; | 309 uint32_t count; |
303 | 310 |
304 //! \brief Pointers to other structures in the minidump file. | 311 //! \brief Pointers to other structures in the minidump file. |
305 RVA children[0]; | 312 RVA children[0]; |
306 }; | 313 };) |
307 | 314 |
308 //! \brief A list of MINIDUMP_LOCATION_DESCRIPTOR objects. | 315 //! \brief A list of MINIDUMP_LOCATION_DESCRIPTOR objects. |
309 struct __attribute__((packed, aligned(4))) MinidumpLocationDescriptorList { | 316 PACK_AND_ALIGN_4(struct MinidumpLocationDescriptorList { |
310 //! \brief The number of children present in the #children array. | 317 //! \brief The number of children present in the #children array. |
311 uint32_t count; | 318 uint32_t count; |
312 | 319 |
313 //! \brief Pointers to other structures in the minidump file. | 320 //! \brief Pointers to other structures in the minidump file. |
314 MINIDUMP_LOCATION_DESCRIPTOR children[0]; | 321 MINIDUMP_LOCATION_DESCRIPTOR children[0]; |
315 }; | 322 };) |
316 | 323 |
317 //! \brief A key-value pair. | 324 //! \brief A key-value pair. |
318 struct __attribute__((packed, aligned(4))) MinidumpSimpleStringDictionaryEntry { | 325 PACK_AND_ALIGN_4(struct MinidumpSimpleStringDictionaryEntry { |
319 //! \brief ::RVA of a MinidumpUTF8String containing the key of a key-value | 326 //! \brief ::RVA of a MinidumpUTF8String containing the key of a key-value |
320 //! pair. | 327 //! pair. |
321 RVA key; | 328 RVA key; |
322 | 329 |
323 //! \brief ::RVA of a MinidumpUTF8String containing the value of a key-value | 330 //! \brief ::RVA of a MinidumpUTF8String containing the value of a key-value |
324 //! pair. | 331 //! pair. |
325 RVA value; | 332 RVA value; |
326 }; | 333 };) |
327 | 334 |
328 //! \brief A list of key-value pairs. | 335 //! \brief A list of key-value pairs. |
329 struct __attribute__((packed, aligned(4))) MinidumpSimpleStringDictionary { | 336 PACK_AND_ALIGN_4(struct MinidumpSimpleStringDictionary { |
330 //! \brief The number of key-value pairs present. | 337 //! \brief The number of key-value pairs present. |
331 uint32_t count; | 338 uint32_t count; |
332 | 339 |
333 //! \brief A list of MinidumpSimpleStringDictionaryEntry entries. | 340 //! \brief A list of MinidumpSimpleStringDictionaryEntry entries. |
334 MinidumpSimpleStringDictionaryEntry entries[0]; | 341 MinidumpSimpleStringDictionaryEntry entries[0]; |
335 }; | 342 };) |
336 | 343 |
337 //! \brief Additional Crashpad-specific information about a module carried | 344 //! \brief Additional Crashpad-specific information about a module carried |
338 //! within a minidump file. | 345 //! within a minidump file. |
339 //! | 346 //! |
340 //! This structure augments the information provided by MINIDUMP_MODULE. The | 347 //! This structure augments the information provided by MINIDUMP_MODULE. The |
341 //! minidump file must contain a module list stream | 348 //! minidump file must contain a module list stream |
342 //! (::kMinidumpStreamTypeModuleList) in order for this structure to appear. | 349 //! (::kMinidumpStreamTypeModuleList) in order for this structure to appear. |
343 //! | 350 //! |
344 //! This structure is versioned. When changing this structure, leave the | 351 //! This structure is versioned. When changing this structure, leave the |
345 //! existing structure intact so that earlier parsers will be able to understand | 352 //! existing structure intact so that earlier parsers will be able to understand |
346 //! the fields they are aware of, and make additions at the end of the | 353 //! the fields they are aware of, and make additions at the end of the |
347 //! structure. Revise #kVersion and document each field’s validity based on | 354 //! structure. Revise #kVersion and document each field’s validity based on |
348 //! #version, so that newer parsers will be able to determine whether the added | 355 //! #version, so that newer parsers will be able to determine whether the added |
349 //! fields are valid or not. | 356 //! fields are valid or not. |
350 //! | 357 //! |
351 //! \sa #MinidumpModuleCrashpadInfoList | 358 //! \sa #MinidumpModuleCrashpadInfoList |
352 struct __attribute__((packed, aligned(4))) MinidumpModuleCrashpadInfo { | 359 PACK_AND_ALIGN_4(struct MinidumpModuleCrashpadInfo { |
353 //! \brief The structure’s currently-defined version number. | 360 //! \brief The structure’s currently-defined version number. |
354 //! | 361 //! |
355 //! \sa version | 362 //! \sa version |
356 static const uint32_t kVersion = 1; | 363 static const uint32_t kVersion = 1; |
357 | 364 |
358 //! \brief The structure’s version number. | 365 //! \brief The structure’s version number. |
359 //! | 366 //! |
360 //! Readers can use this field to determine which other fields in the | 367 //! Readers can use this field to determine which other fields in the |
361 //! structure are valid. Upon encountering a value greater than #kVersion, a | 368 //! structure are valid. Upon encountering a value greater than #kVersion, a |
362 //! reader should assume that the structure’s layout is compatible with the | 369 //! reader should assume that the structure’s layout is compatible with the |
(...skipping 22 matching lines...) Expand all Loading... |
385 | 392 |
386 //! \brief A MinidumpSimpleStringDictionary pointing to strings interpreted as | 393 //! \brief A MinidumpSimpleStringDictionary pointing to strings interpreted as |
387 //! key-value pairs. The module controls the data that appears here. | 394 //! key-value pairs. The module controls the data that appears here. |
388 //! | 395 //! |
389 //! These key-value pairs correspond to | 396 //! These key-value pairs correspond to |
390 //! ModuleSnapshot::AnnotationsSimpleMap() and do not duplicate anything in | 397 //! ModuleSnapshot::AnnotationsSimpleMap() and do not duplicate anything in |
391 //! #list_annotations. | 398 //! #list_annotations. |
392 //! | 399 //! |
393 //! This field is present when #version is at least `1`. | 400 //! This field is present when #version is at least `1`. |
394 MINIDUMP_LOCATION_DESCRIPTOR simple_annotations; | 401 MINIDUMP_LOCATION_DESCRIPTOR simple_annotations; |
395 }; | 402 };) |
396 | 403 |
397 //! \brief Additional Crashpad-specific information about modules carried within | 404 //! \brief Additional Crashpad-specific information about modules carried within |
398 //! a minidump file. | 405 //! a minidump file. |
399 //! | 406 //! |
400 //! This structure augments the information provided by | 407 //! This structure augments the information provided by |
401 //! MINIDUMP_MODULE_LIST. The minidump file must contain a module list stream | 408 //! MINIDUMP_MODULE_LIST. The minidump file must contain a module list stream |
402 //! (::kMinidumpStreamTypeModuleList) in order for this structure to appear. | 409 //! (::kMinidumpStreamTypeModuleList) in order for this structure to appear. |
403 //! | 410 //! |
404 //! MinidumpModuleCrashpadInfoList::count may be less than the value of | 411 //! MinidumpModuleCrashpadInfoList::count may be less than the value of |
405 //! MINIDUMP_MODULE_LIST::NumberOfModules because not every MINIDUMP_MODULE | 412 //! MINIDUMP_MODULE_LIST::NumberOfModules because not every MINIDUMP_MODULE |
406 //! structure carried within the minidump file will necessarily have | 413 //! structure carried within the minidump file will necessarily have |
407 //! Crashpad-specific information provided by a MinidumpModuleCrashpadInfo | 414 //! Crashpad-specific information provided by a MinidumpModuleCrashpadInfo |
408 //! structure. | 415 //! structure. |
409 //! | 416 //! |
410 //! MinidumpModuleCrashpadInfoList::children references | 417 //! MinidumpModuleCrashpadInfoList::children references |
411 //! MinidumpModuleCrashpadInfo children indirectly through | 418 //! MinidumpModuleCrashpadInfo children indirectly through |
412 //! MINIDUMP_LOCATION_DESCRIPTOR pointers to allow for future growth of the | 419 //! MINIDUMP_LOCATION_DESCRIPTOR pointers to allow for future growth of the |
413 //! MinidumpModuleCrashpadInfo structure. | 420 //! MinidumpModuleCrashpadInfo structure. |
414 using MinidumpModuleCrashpadInfoList = MinidumpLocationDescriptorList; | 421 using MinidumpModuleCrashpadInfoList = MinidumpLocationDescriptorList; |
415 | 422 |
416 //! \brief Additional Crashpad-specific information carried within a minidump | 423 //! \brief Additional Crashpad-specific information carried within a minidump |
417 //! file. | 424 //! file. |
418 //! | 425 //! |
419 //! This structure is versioned. When changing this structure, leave the | 426 //! This structure is versioned. When changing this structure, leave the |
420 //! existing structure intact so that earlier parsers will be able to understand | 427 //! existing structure intact so that earlier parsers will be able to understand |
421 //! the fields they are aware of, and make additions at the end of the | 428 //! the fields they are aware of, and make additions at the end of the |
422 //! structure. Revise #kVersion and document each field’s validity based on | 429 //! structure. Revise #kVersion and document each field’s validity based on |
423 //! #version, so that newer parsers will be able to determine whether the added | 430 //! #version, so that newer parsers will be able to determine whether the added |
424 //! fields are valid or not. | 431 //! fields are valid or not. |
425 struct __attribute__((packed, aligned(4))) MinidumpCrashpadInfo { | 432 PACK_AND_ALIGN_4(struct MinidumpCrashpadInfo { |
426 //! \brief The structure’s currently-defined version number. | 433 //! \brief The structure’s currently-defined version number. |
427 //! | 434 //! |
428 //! \sa version | 435 //! \sa version |
429 static const uint32_t kVersion = 1; | 436 static const uint32_t kVersion = 1; |
430 | 437 |
431 //! \brief The structure’s version number. | 438 //! \brief The structure’s version number. |
432 //! | 439 //! |
433 //! Readers can use this field to determine which other fields in the | 440 //! Readers can use this field to determine which other fields in the |
434 //! structure are valid. Upon encountering a value greater than #kVersion, a | 441 //! structure are valid. Upon encountering a value greater than #kVersion, a |
435 //! reader should assume that the structure’s layout is compatible with the | 442 //! reader should assume that the structure’s layout is compatible with the |
436 //! structure defined as having value #kVersion. | 443 //! structure defined as having value #kVersion. |
437 //! | 444 //! |
438 //! Writers may produce values less than #kVersion in this field if there is | 445 //! Writers may produce values less than #kVersion in this field if there is |
439 //! no need for any fields present in later versions. | 446 //! no need for any fields present in later versions. |
440 uint32_t version; | 447 uint32_t version; |
441 | 448 |
442 //! \brief A pointer to a #MinidumpModuleCrashpadInfoList structure. | 449 //! \brief A pointer to a #MinidumpModuleCrashpadInfoList structure. |
443 //! | 450 //! |
444 //! This field is present when #version is at least `1`. | 451 //! This field is present when #version is at least `1`. |
445 MINIDUMP_LOCATION_DESCRIPTOR module_list; | 452 MINIDUMP_LOCATION_DESCRIPTOR module_list; |
446 }; | 453 };) |
447 | 454 |
448 } // namespace crashpad | 455 } // namespace crashpad |
449 | 456 |
450 #endif // CRASHPAD_MINIDUMP_MINIDUMP_EXTENSIONS_H_ | 457 #endif // CRASHPAD_MINIDUMP_MINIDUMP_EXTENSIONS_H_ |
OLD | NEW |