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