1 //===- PdbYAML.h ---------------------------------------------- *- C++ --*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H
11 #define LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H
13 #include "OutputStyle.h"
15 #include "llvm/ADT/Optional.h"
16 #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
17 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
18 #include "llvm/DebugInfo/MSF/MSFCommon.h"
19 #include "llvm/DebugInfo/PDB/Native/PDBFile.h"
20 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
21 #include "llvm/DebugInfo/PDB/PDBTypes.h"
22 #include "llvm/ObjectYAML/CodeViewYAMLDebugSections.h"
23 #include "llvm/ObjectYAML/CodeViewYAMLSymbols.h"
24 #include "llvm/ObjectYAML/CodeViewYAMLTypes.h"
25 #include "llvm/Support/Endian.h"
26 #include "llvm/Support/YAMLTraits.h"
32 class DebugStringTableSubsection;
37 struct SerializationContext;
40 msf::SuperBlock SuperBlock;
41 uint32_t NumDirectoryBlocks = 0;
42 std::vector<uint32_t> DirectoryBlocks;
43 uint32_t NumStreams = 0;
44 uint32_t FileSize = 0;
47 struct StreamBlockList {
48 std::vector<uint32_t> Blocks;
51 struct NamedStreamMapping {
53 uint32_t StreamNumber;
56 struct PdbInfoStream {
57 PdbRaw_ImplVer Version = PdbImplVC70;
58 uint32_t Signature = 0;
61 std::vector<PdbRaw_FeatureSig> Features;
62 std::vector<NamedStreamMapping> NamedStreams;
65 struct PdbModiStream {
67 std::vector<CodeViewYAML::SymbolRecord> Symbols;
70 struct PdbDbiModuleInfo {
73 std::vector<StringRef> SourceFiles;
74 std::vector<CodeViewYAML::YAMLDebugSubsection> Subsections;
75 Optional<PdbModiStream> Modi;
79 PdbRaw_DbiVer VerHeader = PdbDbiV70;
81 uint16_t BuildNumber = 0;
82 uint32_t PdbDllVersion = 0;
83 uint16_t PdbDllRbld = 0;
85 PDB_Machine MachineType = PDB_Machine::x86;
87 std::vector<PdbDbiModuleInfo> ModInfos;
91 PdbRaw_TpiVer Version = PdbTpiV80;
92 std::vector<CodeViewYAML::LeafRecord> Records;
96 explicit PdbObject(BumpPtrAllocator &Allocator) : Allocator(Allocator) {}
98 Optional<MSFHeaders> Headers;
99 Optional<std::vector<uint32_t>> StreamSizes;
100 Optional<std::vector<StreamBlockList>> StreamMap;
101 Optional<PdbInfoStream> PdbStream;
102 Optional<PdbDbiStream> DbiStream;
103 Optional<PdbTpiStream> TpiStream;
104 Optional<PdbTpiStream> IpiStream;
106 Optional<std::vector<StringRef>> StringTable;
108 BumpPtrAllocator &Allocator;
114 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbObject)
115 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::MSFHeaders)
116 LLVM_YAML_DECLARE_MAPPING_TRAITS(msf::SuperBlock)
117 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::StreamBlockList)
118 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbInfoStream)
119 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbDbiStream)
120 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbTpiStream)
121 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::NamedStreamMapping)
122 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbModiStream)
123 LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbDbiModuleInfo)
125 #endif // LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H