1 //===- PdbYAML.h ---------------------------------------------- *- C++ --*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H
10 #define LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H
12 #include "OutputStyle.h"
14 #include "llvm/ADT/Optional.h"
15 #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
16 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
17 #include "llvm/DebugInfo/MSF/MSFCommon.h"
18 #include "llvm/DebugInfo/PDB/Native/PDBFile.h"
19 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
20 #include "llvm/DebugInfo/PDB/PDBTypes.h"
21 #include "llvm/ObjectYAML/CodeViewYAMLDebugSections.h"
22 #include "llvm/ObjectYAML/CodeViewYAMLSymbols.h"
23 #include "llvm/ObjectYAML/CodeViewYAMLTypes.h"
24 #include "llvm/Support/Endian.h"
25 #include "llvm/Support/YAMLTraits.h"
31 class DebugStringTableSubsection
;
36 struct SerializationContext
;
39 msf::SuperBlock SuperBlock
;
40 uint32_t NumDirectoryBlocks
= 0;
41 std::vector
<uint32_t> DirectoryBlocks
;
42 uint32_t NumStreams
= 0;
43 uint32_t FileSize
= 0;
46 struct StreamBlockList
{
47 std::vector
<uint32_t> Blocks
;
50 struct NamedStreamMapping
{
52 uint32_t StreamNumber
;
55 struct PdbInfoStream
{
56 PdbRaw_ImplVer Version
= PdbImplVC70
;
57 uint32_t Signature
= 0;
60 std::vector
<PdbRaw_FeatureSig
> Features
;
61 std::vector
<NamedStreamMapping
> NamedStreams
;
64 struct PdbModiStream
{
66 std::vector
<CodeViewYAML::SymbolRecord
> Symbols
;
69 struct PdbDbiModuleInfo
{
72 std::vector
<StringRef
> SourceFiles
;
73 std::vector
<CodeViewYAML::YAMLDebugSubsection
> Subsections
;
74 Optional
<PdbModiStream
> Modi
;
78 PdbRaw_DbiVer VerHeader
= PdbDbiV70
;
80 uint16_t BuildNumber
= 0;
81 uint32_t PdbDllVersion
= 0;
82 uint16_t PdbDllRbld
= 0;
84 PDB_Machine MachineType
= PDB_Machine::x86
;
86 std::vector
<PdbDbiModuleInfo
> ModInfos
;
90 PdbRaw_TpiVer Version
= PdbTpiV80
;
91 std::vector
<CodeViewYAML::LeafRecord
> Records
;
94 struct PdbPublicsStream
{
95 std::vector
<CodeViewYAML::SymbolRecord
> PubSyms
;
99 explicit PdbObject(BumpPtrAllocator
&Allocator
) : Allocator(Allocator
) {}
101 Optional
<MSFHeaders
> Headers
;
102 Optional
<std::vector
<uint32_t>> StreamSizes
;
103 Optional
<std::vector
<StreamBlockList
>> StreamMap
;
104 Optional
<PdbInfoStream
> PdbStream
;
105 Optional
<PdbDbiStream
> DbiStream
;
106 Optional
<PdbTpiStream
> TpiStream
;
107 Optional
<PdbTpiStream
> IpiStream
;
108 Optional
<PdbPublicsStream
> PublicsStream
;
110 Optional
<std::vector
<StringRef
>> StringTable
;
112 BumpPtrAllocator
&Allocator
;
118 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbObject
)
119 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::MSFHeaders
)
120 LLVM_YAML_DECLARE_MAPPING_TRAITS(msf::SuperBlock
)
121 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::StreamBlockList
)
122 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbInfoStream
)
123 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbDbiStream
)
124 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbTpiStream
)
125 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbPublicsStream
)
126 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::NamedStreamMapping
)
127 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbModiStream
)
128 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbDbiModuleInfo
)
130 #endif // LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H