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/Support/Endian.h"
23 #include "llvm/Support/YAMLTraits.h"
31 struct SerializationContext;
34 msf::SuperBlock SuperBlock;
35 uint32_t NumDirectoryBlocks = 0;
36 std::vector<uint32_t> DirectoryBlocks;
37 uint32_t NumStreams = 0;
38 uint32_t FileSize = 0;
41 struct StreamBlockList {
42 std::vector<uint32_t> Blocks;
45 struct NamedStreamMapping {
47 uint32_t StreamNumber;
50 struct PdbInfoStream {
51 PdbRaw_ImplVer Version = PdbImplVC70;
52 uint32_t Signature = 0;
55 std::vector<PdbRaw_FeatureSig> Features;
56 std::vector<NamedStreamMapping> NamedStreams;
59 struct PdbSymbolRecord {
60 codeview::CVSymbol Record;
63 struct PdbModiStream {
65 std::vector<PdbSymbolRecord> Symbols;
68 struct PdbDbiModuleInfo {
71 std::vector<StringRef> SourceFiles;
72 Optional<PdbModiStream> Modi;
76 PdbRaw_DbiVer VerHeader = PdbDbiV70;
78 uint16_t BuildNumber = 0;
79 uint32_t PdbDllVersion = 0;
80 uint16_t PdbDllRbld = 0;
82 PDB_Machine MachineType = PDB_Machine::x86;
84 std::vector<PdbDbiModuleInfo> ModInfos;
88 codeview::CVType Record;
91 struct PdbTpiFieldListRecord {
92 codeview::CVMemberRecord Record;
96 PdbRaw_TpiVer Version = PdbTpiV80;
97 std::vector<PdbTpiRecord> Records;
101 explicit PdbObject(BumpPtrAllocator &Allocator) : Allocator(Allocator) {}
103 Optional<MSFHeaders> Headers;
104 Optional<std::vector<uint32_t>> StreamSizes;
105 Optional<std::vector<StreamBlockList>> StreamMap;
106 Optional<PdbInfoStream> PdbStream;
107 Optional<PdbDbiStream> DbiStream;
108 Optional<PdbTpiStream> TpiStream;
109 Optional<PdbTpiStream> IpiStream;
111 Optional<std::vector<StringRef>> StringTable;
113 BumpPtrAllocator &Allocator;
122 template <> struct MappingTraits<pdb::yaml::PdbObject> {
123 static void mapping(IO &IO, pdb::yaml::PdbObject &Obj);
126 template <> struct MappingTraits<pdb::yaml::MSFHeaders> {
127 static void mapping(IO &IO, pdb::yaml::MSFHeaders &Obj);
130 template <> struct MappingTraits<msf::SuperBlock> {
131 static void mapping(IO &IO, msf::SuperBlock &SB);
134 template <> struct MappingTraits<pdb::yaml::StreamBlockList> {
135 static void mapping(IO &IO, pdb::yaml::StreamBlockList &SB);
138 template <> struct MappingTraits<pdb::yaml::PdbInfoStream> {
139 static void mapping(IO &IO, pdb::yaml::PdbInfoStream &Obj);
142 template <> struct MappingContextTraits<pdb::yaml::PdbDbiStream, pdb::yaml::SerializationContext> {
143 static void mapping(IO &IO, pdb::yaml::PdbDbiStream &Obj, pdb::yaml::SerializationContext &Context);
147 struct MappingContextTraits<pdb::yaml::PdbTpiStream, pdb::yaml::SerializationContext> {
148 static void mapping(IO &IO, pdb::yaml::PdbTpiStream &Obj,
149 pdb::yaml::SerializationContext &Context);
152 template <> struct MappingTraits<pdb::yaml::NamedStreamMapping> {
153 static void mapping(IO &IO, pdb::yaml::NamedStreamMapping &Obj);
156 template <> struct MappingContextTraits<pdb::yaml::PdbSymbolRecord, pdb::yaml::SerializationContext> {
157 static void mapping(IO &IO, pdb::yaml::PdbSymbolRecord &Obj, pdb::yaml::SerializationContext &Context);
160 template <> struct MappingContextTraits<pdb::yaml::PdbModiStream, pdb::yaml::SerializationContext> {
161 static void mapping(IO &IO, pdb::yaml::PdbModiStream &Obj, pdb::yaml::SerializationContext &Context);
164 template <> struct MappingContextTraits<pdb::yaml::PdbDbiModuleInfo, pdb::yaml::SerializationContext> {
165 static void mapping(IO &IO, pdb::yaml::PdbDbiModuleInfo &Obj, pdb::yaml::SerializationContext &Context);
169 struct MappingContextTraits<pdb::yaml::PdbTpiRecord,
170 pdb::yaml::SerializationContext> {
171 static void mapping(IO &IO, pdb::yaml::PdbTpiRecord &Obj,
172 pdb::yaml::SerializationContext &Context);
177 #endif // LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H