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 <windows.h> |
18 #include <dbghelp.h> | 19 #include <dbghelp.h> |
19 #include <stdint.h> | 20 #include <stdint.h> |
20 #include <winnt.h> | 21 #include <winnt.h> |
21 | 22 |
| 23 #include "base/compiler_specific.h" |
| 24 #include "build/build_config.h" |
22 #include "util/misc/uuid.h" | 25 #include "util/misc/uuid.h" |
23 | 26 |
| 27 #if defined(COMPILER_MSVC) |
| 28 #define PACKED |
| 29 #pragma pack(push, 1) |
| 30 #else |
| 31 #define PACKED __attribute__((packed)) |
| 32 #endif // COMPILER_MSVC |
| 33 |
24 namespace crashpad { | 34 namespace crashpad { |
25 | 35 |
26 //! \brief Minidump stream type values for MINIDUMP_DIRECTORY::StreamType. Each | 36 //! \brief Minidump stream type values for MINIDUMP_DIRECTORY::StreamType. Each |
27 //! stream structure has a corresponding stream type value to identify it. | 37 //! stream structure has a corresponding stream type value to identify it. |
28 //! | 38 //! |
29 //! \sa MINIDUMP_STREAM_TYPE | 39 //! \sa MINIDUMP_STREAM_TYPE |
30 enum MinidumpStreamType : uint32_t { | 40 enum MinidumpStreamType : uint32_t { |
31 //! \brief The stream type for MINIDUMP_THREAD_LIST. | 41 //! \brief The stream type for MINIDUMP_THREAD_LIST. |
32 //! | 42 //! |
33 //! \sa ThreadListStream | 43 //! \sa ThreadListStream |
(...skipping 28 matching lines...) Expand all Loading... |
62 // 0x4350 = "CP" | 72 // 0x4350 = "CP" |
63 | 73 |
64 //! \brief The stream type for MinidumpCrashpadInfo. | 74 //! \brief The stream type for MinidumpCrashpadInfo. |
65 kMinidumpStreamTypeCrashpadInfo = 0x43500001, | 75 kMinidumpStreamTypeCrashpadInfo = 0x43500001, |
66 }; | 76 }; |
67 | 77 |
68 //! \brief A variable-length UTF-8-encoded string carried within a minidump | 78 //! \brief A variable-length UTF-8-encoded string carried within a minidump |
69 //! file. | 79 //! file. |
70 //! | 80 //! |
71 //! \sa MINIDUMP_STRING | 81 //! \sa MINIDUMP_STRING |
72 struct __attribute__((packed, aligned(4))) MinidumpUTF8String { | 82 struct ALIGNAS(4) PACKED MinidumpUTF8String { |
73 // The field names do not conform to typical style, they match the names used | 83 // 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 | 84 // in MINIDUMP_STRING. This makes it easier to operate on MINIDUMP_STRING (for |
75 // UTF-16 strings) and MinidumpUTF8String using templates. | 85 // UTF-16 strings) and MinidumpUTF8String using templates. |
76 | 86 |
77 //! \brief The length of the #Buffer field in bytes, not including the `NUL` | 87 //! \brief The length of the #Buffer field in bytes, not including the `NUL` |
78 //! terminator. | 88 //! terminator. |
79 //! | 89 //! |
80 //! \note This field is interpreted as a byte count, not a count of Unicode | 90 //! \note This field is interpreted as a byte count, not a count of Unicode |
81 //! code points. | 91 //! code points. |
82 uint32_t Length; | 92 uint32_t Length; |
(...skipping 207 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 | 300 //! \brief The path or file name of the `.pdb` file associated with the |
291 //! module. | 301 //! module. |
292 //! | 302 //! |
293 //! This is a NUL-terminated string. On Windows, it will be encoded in the | 303 //! 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 | 304 //! code page of the system that linked the module. On other operating |
295 //! systems, UTF-8 may be used. | 305 //! systems, UTF-8 may be used. |
296 uint8_t pdb_name[1]; | 306 uint8_t pdb_name[1]; |
297 }; | 307 }; |
298 | 308 |
299 //! \brief A list of ::RVA pointers. | 309 //! \brief A list of ::RVA pointers. |
300 struct __attribute__((packed, aligned(4))) MinidumpRVAList { | 310 struct ALIGNAS(4) PACKED MinidumpRVAList { |
301 //! \brief The number of children present in the #children array. | 311 //! \brief The number of children present in the #children array. |
302 uint32_t count; | 312 uint32_t count; |
303 | 313 |
304 //! \brief Pointers to other structures in the minidump file. | 314 //! \brief Pointers to other structures in the minidump file. |
305 RVA children[0]; | 315 RVA children[0]; |
306 }; | 316 }; |
307 | 317 |
308 //! \brief A list of MINIDUMP_LOCATION_DESCRIPTOR objects. | 318 //! \brief A list of MINIDUMP_LOCATION_DESCRIPTOR objects. |
309 struct __attribute__((packed, aligned(4))) MinidumpLocationDescriptorList { | 319 struct ALIGNAS(4) PACKED MinidumpLocationDescriptorList { |
310 //! \brief The number of children present in the #children array. | 320 //! \brief The number of children present in the #children array. |
311 uint32_t count; | 321 uint32_t count; |
312 | 322 |
313 //! \brief Pointers to other structures in the minidump file. | 323 //! \brief Pointers to other structures in the minidump file. |
314 MINIDUMP_LOCATION_DESCRIPTOR children[0]; | 324 MINIDUMP_LOCATION_DESCRIPTOR children[0]; |
315 }; | 325 }; |
316 | 326 |
317 //! \brief A key-value pair. | 327 //! \brief A key-value pair. |
318 struct __attribute__((packed, aligned(4))) MinidumpSimpleStringDictionaryEntry { | 328 struct ALIGNAS(4) PACKED MinidumpSimpleStringDictionaryEntry { |
319 //! \brief ::RVA of a MinidumpUTF8String containing the key of a key-value | 329 //! \brief ::RVA of a MinidumpUTF8String containing the key of a key-value |
320 //! pair. | 330 //! pair. |
321 RVA key; | 331 RVA key; |
322 | 332 |
323 //! \brief ::RVA of a MinidumpUTF8String containing the value of a key-value | 333 //! \brief ::RVA of a MinidumpUTF8String containing the value of a key-value |
324 //! pair. | 334 //! pair. |
325 RVA value; | 335 RVA value; |
326 }; | 336 }; |
327 | 337 |
328 //! \brief A list of key-value pairs. | 338 //! \brief A list of key-value pairs. |
329 struct __attribute__((packed, aligned(4))) MinidumpSimpleStringDictionary { | 339 struct ALIGNAS(4) PACKED MinidumpSimpleStringDictionary { |
330 //! \brief The number of key-value pairs present. | 340 //! \brief The number of key-value pairs present. |
331 uint32_t count; | 341 uint32_t count; |
332 | 342 |
333 //! \brief A list of MinidumpSimpleStringDictionaryEntry entries. | 343 //! \brief A list of MinidumpSimpleStringDictionaryEntry entries. |
334 MinidumpSimpleStringDictionaryEntry entries[0]; | 344 MinidumpSimpleStringDictionaryEntry entries[0]; |
335 }; | 345 }; |
336 | 346 |
337 //! \brief Additional Crashpad-specific information about a module carried | 347 //! \brief Additional Crashpad-specific information about a module carried |
338 //! within a minidump file. | 348 //! within a minidump file. |
339 //! | 349 //! |
340 //! This structure augments the information provided by MINIDUMP_MODULE. The | 350 //! This structure augments the information provided by MINIDUMP_MODULE. The |
341 //! minidump file must contain a module list stream | 351 //! minidump file must contain a module list stream |
342 //! (::kMinidumpStreamTypeModuleList) in order for this structure to appear. | 352 //! (::kMinidumpStreamTypeModuleList) in order for this structure to appear. |
343 //! | 353 //! |
344 //! This structure is versioned. When changing this structure, leave the | 354 //! This structure is versioned. When changing this structure, leave the |
345 //! existing structure intact so that earlier parsers will be able to understand | 355 //! 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 | 356 //! 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 | 357 //! 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 | 358 //! #version, so that newer parsers will be able to determine whether the added |
349 //! fields are valid or not. | 359 //! fields are valid or not. |
350 //! | 360 //! |
351 //! \sa #MinidumpModuleCrashpadInfoList | 361 //! \sa #MinidumpModuleCrashpadInfoList |
352 struct __attribute__((packed, aligned(4))) MinidumpModuleCrashpadInfo { | 362 struct ALIGNAS(4) PACKED MinidumpModuleCrashpadInfo { |
353 //! \brief The structure’s currently-defined version number. | 363 //! \brief The structure’s currently-defined version number. |
354 //! | 364 //! |
355 //! \sa version | 365 //! \sa version |
356 static const uint32_t kVersion = 1; | 366 static const uint32_t kVersion = 1; |
357 | 367 |
358 //! \brief The structure’s version number. | 368 //! \brief The structure’s version number. |
359 //! | 369 //! |
360 //! Readers can use this field to determine which other fields in the | 370 //! Readers can use this field to determine which other fields in the |
361 //! structure are valid. Upon encountering a value greater than #kVersion, a | 371 //! structure are valid. Upon encountering a value greater than #kVersion, a |
362 //! reader should assume that the structure’s layout is compatible with the | 372 //! reader should assume that the structure’s layout is compatible with the |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 | 425 |
416 //! \brief Additional Crashpad-specific information carried within a minidump | 426 //! \brief Additional Crashpad-specific information carried within a minidump |
417 //! file. | 427 //! file. |
418 //! | 428 //! |
419 //! This structure is versioned. When changing this structure, leave the | 429 //! This structure is versioned. When changing this structure, leave the |
420 //! existing structure intact so that earlier parsers will be able to understand | 430 //! 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 | 431 //! 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 | 432 //! 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 | 433 //! #version, so that newer parsers will be able to determine whether the added |
424 //! fields are valid or not. | 434 //! fields are valid or not. |
425 struct __attribute__((packed, aligned(4))) MinidumpCrashpadInfo { | 435 struct ALIGNAS(4) PACKED MinidumpCrashpadInfo { |
426 //! \brief The structure’s currently-defined version number. | 436 //! \brief The structure’s currently-defined version number. |
427 //! | 437 //! |
428 //! \sa version | 438 //! \sa version |
429 static const uint32_t kVersion = 1; | 439 static const uint32_t kVersion = 1; |
430 | 440 |
431 //! \brief The structure’s version number. | 441 //! \brief The structure’s version number. |
432 //! | 442 //! |
433 //! Readers can use this field to determine which other fields in the | 443 //! Readers can use this field to determine which other fields in the |
434 //! structure are valid. Upon encountering a value greater than #kVersion, a | 444 //! structure are valid. Upon encountering a value greater than #kVersion, a |
435 //! reader should assume that the structure’s layout is compatible with the | 445 //! reader should assume that the structure’s layout is compatible with the |
436 //! structure defined as having value #kVersion. | 446 //! structure defined as having value #kVersion. |
437 //! | 447 //! |
438 //! Writers may produce values less than #kVersion in this field if there is | 448 //! Writers may produce values less than #kVersion in this field if there is |
439 //! no need for any fields present in later versions. | 449 //! no need for any fields present in later versions. |
440 uint32_t version; | 450 uint32_t version; |
441 | 451 |
442 //! \brief A pointer to a #MinidumpModuleCrashpadInfoList structure. | 452 //! \brief A pointer to a #MinidumpModuleCrashpadInfoList structure. |
443 //! | 453 //! |
444 //! This field is present when #version is at least `1`. | 454 //! This field is present when #version is at least `1`. |
445 MINIDUMP_LOCATION_DESCRIPTOR module_list; | 455 MINIDUMP_LOCATION_DESCRIPTOR module_list; |
446 }; | 456 }; |
447 | 457 |
| 458 #if defined(COMPILER_MSVC) |
| 459 #pragma pack(pop) |
| 460 #endif // COMPILER_MSVC |
| 461 #undef PACKED |
| 462 |
448 } // namespace crashpad | 463 } // namespace crashpad |
449 | 464 |
450 #endif // CRASHPAD_MINIDUMP_MINIDUMP_EXTENSIONS_H_ | 465 #endif // CRASHPAD_MINIDUMP_MINIDUMP_EXTENSIONS_H_ |
OLD | NEW |