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/PDBTypes.h"
20 #include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
21 #include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
22 #include "llvm/Support/Endian.h"
23 #include "llvm/Support/YAMLTraits.h"
31 struct SerializationContext;
34 msf::SuperBlock SuperBlock;
35 uint32_t NumDirectoryBlocks;
36 std::vector<uint32_t> DirectoryBlocks;
41 struct StreamBlockList {
42 std::vector<uint32_t> Blocks;
45 struct NamedStreamMapping {
47 uint32_t StreamNumber;
50 struct PdbInfoStream {
51 PdbRaw_ImplVer Version;
55 std::vector<NamedStreamMapping> NamedStreams;
58 struct PdbSymbolRecord {
59 codeview::CVSymbol Record;
62 struct PdbModiStream {
64 std::vector<PdbSymbolRecord> Symbols;
67 struct PdbDbiModuleInfo {
70 std::vector<StringRef> SourceFiles;
71 Optional<PdbModiStream> Modi;
75 PdbRaw_DbiVer VerHeader;
78 uint32_t PdbDllVersion;
81 PDB_Machine MachineType;
83 std::vector<PdbDbiModuleInfo> ModInfos;
87 codeview::CVType Record;
90 struct PdbTpiFieldListRecord {
91 codeview::CVMemberRecord Record;
95 PdbRaw_TpiVer Version;
96 std::vector<PdbTpiRecord> Records;
100 explicit PdbObject(BumpPtrAllocator &Allocator) : Allocator(Allocator) {}
102 Optional<MSFHeaders> Headers;
103 Optional<std::vector<uint32_t>> StreamSizes;
104 Optional<std::vector<StreamBlockList>> StreamMap;
105 Optional<PdbInfoStream> PdbStream;
106 Optional<PdbDbiStream> DbiStream;
107 Optional<PdbTpiStream> TpiStream;
108 Optional<PdbTpiStream> IpiStream;
110 BumpPtrAllocator &Allocator;
119 template <> struct MappingTraits<pdb::yaml::PdbObject> {
120 static void mapping(IO &IO, pdb::yaml::PdbObject &Obj);
123 template <> struct MappingTraits<pdb::yaml::MSFHeaders> {
124 static void mapping(IO &IO, pdb::yaml::MSFHeaders &Obj);
127 template <> struct MappingTraits<msf::SuperBlock> {
128 static void mapping(IO &IO, msf::SuperBlock &SB);
131 template <> struct MappingTraits<pdb::yaml::StreamBlockList> {
132 static void mapping(IO &IO, pdb::yaml::StreamBlockList &SB);
135 template <> struct MappingTraits<pdb::yaml::PdbInfoStream> {
136 static void mapping(IO &IO, pdb::yaml::PdbInfoStream &Obj);
139 template <> struct MappingTraits<pdb::yaml::PdbDbiStream> {
140 static void mapping(IO &IO, pdb::yaml::PdbDbiStream &Obj);
144 struct MappingContextTraits<pdb::yaml::PdbTpiStream, llvm::BumpPtrAllocator> {
145 static void mapping(IO &IO, pdb::yaml::PdbTpiStream &Obj,
146 llvm::BumpPtrAllocator &Allocator);
149 template <> struct MappingTraits<pdb::yaml::NamedStreamMapping> {
150 static void mapping(IO &IO, pdb::yaml::NamedStreamMapping &Obj);
153 template <> struct MappingTraits<pdb::yaml::PdbSymbolRecord> {
154 static void mapping(IO &IO, pdb::yaml::PdbSymbolRecord &Obj);
157 template <> struct MappingTraits<pdb::yaml::PdbModiStream> {
158 static void mapping(IO &IO, pdb::yaml::PdbModiStream &Obj);
161 template <> struct MappingTraits<pdb::yaml::PdbDbiModuleInfo> {
162 static void mapping(IO &IO, pdb::yaml::PdbDbiModuleInfo &Obj);
166 struct MappingContextTraits<pdb::yaml::PdbTpiRecord,
167 pdb::yaml::SerializationContext> {
168 static void mapping(IO &IO, pdb::yaml::PdbTpiRecord &Obj,
169 pdb::yaml::SerializationContext &Context);
174 #endif // LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H