pdb_structures.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. // Copyright 2015 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. #ifndef CRASHPAD_UTIL_MISC_PDB_STRUCTURES_H_
  15. #define CRASHPAD_UTIL_MISC_PDB_STRUCTURES_H_
  16. #include <stdint.h>
  17. #include "util/misc/uuid.h"
  18. namespace crashpad {
  19. //! \brief A CodeView record linking to a `.pdb` 2.0 file.
  20. //!
  21. //! This format provides an indirect link to debugging data by referencing an
  22. //! external `.pdb` file by its name, timestamp, and age. This structure may be
  23. //! pointed to by MINIDUMP_MODULE::CvRecord. It has been superseded by
  24. //! CodeViewRecordPDB70.
  25. //!
  26. //! For more information about this structure and format, see <a
  27. //! href="http://www.debuginfo.com/articles/debuginfomatch.html#pdbfiles">Matching
  28. //! Debug Information</a>, PDB Files, and <a
  29. //! href="http://undocumented.rawol.com/sbs-w2k-1-windows-2000-debugging-support.pdf#page=63">Undocumented
  30. //! Windows 2000 Secrets</a>, Windows 2000 Debugging Support/Microsoft Symbol
  31. //! File Internals/CodeView Subsections.
  32. //!
  33. //! \sa IMAGE_DEBUG_MISC
  34. struct CodeViewRecordPDB20 {
  35. //! \brief The magic number identifying this structure version, stored in
  36. //! #signature.
  37. //!
  38. //! In a hex dump, this will appear as “NB10” when produced by a little-endian
  39. //! machine.
  40. static const uint32_t kSignature = '01BN';
  41. //! \brief The magic number identifying this structure version, the value of
  42. //! #kSignature.
  43. uint32_t signature;
  44. //! \brief The offset to CodeView data.
  45. //!
  46. //! In this structure, this field always has the value `0` because no CodeView
  47. //! data is present, there is only a link to CodeView data stored in an
  48. //! external file.
  49. uint32_t offset;
  50. //! \brief The time that the `.pdb` file was created, in `time_t` format, the
  51. //! number of seconds since the POSIX epoch.
  52. uint32_t timestamp;
  53. //! \brief The revision of the `.pdb` file.
  54. //!
  55. //! A `.pdb` file’s age indicates incremental changes to it. When a `.pdb`
  56. //! file is created, it has age `1`, and subsequent updates increase this
  57. //! value.
  58. uint32_t age;
  59. //! \brief The path or file name of the `.pdb` file associated with the
  60. //! module.
  61. //!
  62. //! This is a NUL-terminated string. On Windows, it will be encoded in the
  63. //! code page of the system that linked the module. On other operating
  64. //! systems, UTF-8 may be used.
  65. uint8_t pdb_name[1];
  66. };
  67. //! \brief A CodeView record linking to a `.pdb` 7.0 file.
  68. //!
  69. //! This format provides an indirect link to debugging data by referencing an
  70. //! external `.pdb` file by its name, %UUID, and age. This structure may be
  71. //! pointed to by MINIDUMP_MODULE::CvRecord.
  72. //!
  73. //! For more information about this structure and format, see <a
  74. //! href="http://www.debuginfo.com/articles/debuginfomatch.html#pdbfiles">Matching
  75. //! Debug Information</a>, PDB Files.
  76. //!
  77. //! \sa CodeViewRecordPDB20
  78. //! \sa IMAGE_DEBUG_MISC
  79. struct CodeViewRecordPDB70 {
  80. // UUID has a constructor, which makes it non-POD, which makes this structure
  81. // non-POD. In order for the default constructor to zero-initialize other
  82. // members, an explicit constructor must be provided.
  83. CodeViewRecordPDB70()
  84. : signature(),
  85. uuid(),
  86. age(),
  87. pdb_name() {
  88. }
  89. //! \brief The magic number identifying this structure version, stored in
  90. //! #signature.
  91. //!
  92. //! In a hex dump, this will appear as “RSDS” when produced by a little-endian
  93. //! machine.
  94. static const uint32_t kSignature = 'SDSR';
  95. //! \brief The magic number identifying this structure version, the value of
  96. //! #kSignature.
  97. uint32_t signature;
  98. //! \brief The `.pdb` file’s unique identifier.
  99. UUID uuid;
  100. //! \brief The revision of the `.pdb` file.
  101. //!
  102. //! A `.pdb` file’s age indicates incremental changes to it. When a `.pdb`
  103. //! file is created, it has age `1`, and subsequent updates increase this
  104. //! value.
  105. uint32_t age;
  106. //! \brief The path or file name of the `.pdb` file associated with the
  107. //! module.
  108. //!
  109. //! This is a NUL-terminated string. On Windows, it will be encoded in the
  110. //! code page of the system that linked the module. On other operating
  111. //! systems, UTF-8 may be used.
  112. uint8_t pdb_name[1];
  113. };
  114. } // namespace crashpad
  115. #endif // CRASHPAD_UTIL_MISC_PDB_STRUCTURES_H_