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