Home | History | Annotate | Download | only in llvm-pdbdump
      1 //===- PdbYAML.h ---------------------------------------------- *- C++ --*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 #ifndef LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H
     11 #define LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H
     12 
     13 #include "OutputStyle.h"
     14 
     15 #include "llvm/ADT/Optional.h"
     16 #include "llvm/DebugInfo/PDB/PDBTypes.h"
     17 #include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
     18 #include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
     19 #include "llvm/Support/Endian.h"
     20 #include "llvm/Support/YAMLTraits.h"
     21 
     22 #include <vector>
     23 
     24 namespace llvm {
     25 namespace pdb {
     26 
     27 namespace yaml {
     28 struct MsfHeaders {
     29   PDBFile::SuperBlock SuperBlock;
     30   uint32_t NumDirectoryBlocks;
     31   uint32_t BlockMapOffset;
     32   std::vector<support::ulittle32_t> DirectoryBlocks;
     33   uint32_t NumStreams;
     34   uint32_t FileSize;
     35 };
     36 
     37 struct StreamBlockList {
     38   std::vector<support::ulittle32_t> Blocks;
     39 };
     40 
     41 struct PdbInfoStream {
     42   PdbRaw_ImplVer Version;
     43   uint32_t Signature;
     44   uint32_t Age;
     45   PDB_UniqueId Guid;
     46 };
     47 
     48 struct PdbDbiStream {
     49   PdbRaw_DbiVer VerHeader;
     50   uint32_t Age;
     51   uint16_t BuildNumber;
     52   uint32_t PdbDllVersion;
     53   uint16_t PdbDllRbld;
     54   uint16_t Flags;
     55   PDB_Machine MachineType;
     56 };
     57 
     58 struct PdbObject {
     59   Optional<MsfHeaders> Headers;
     60   Optional<std::vector<support::ulittle32_t>> StreamSizes;
     61   Optional<std::vector<StreamBlockList>> StreamMap;
     62   Optional<PdbInfoStream> PdbStream;
     63   Optional<PdbDbiStream> DbiStream;
     64 };
     65 }
     66 }
     67 }
     68 
     69 namespace llvm {
     70 namespace yaml {
     71 
     72 template <> struct MappingTraits<pdb::yaml::PdbObject> {
     73   static void mapping(IO &IO, pdb::yaml::PdbObject &Obj);
     74 };
     75 
     76 template <> struct MappingTraits<pdb::yaml::MsfHeaders> {
     77   static void mapping(IO &IO, pdb::yaml::MsfHeaders &Obj);
     78 };
     79 
     80 template <> struct MappingTraits<pdb::PDBFile::SuperBlock> {
     81   static void mapping(IO &IO, pdb::PDBFile::SuperBlock &SB);
     82 };
     83 
     84 template <> struct MappingTraits<pdb::yaml::StreamBlockList> {
     85   static void mapping(IO &IO, pdb::yaml::StreamBlockList &SB);
     86 };
     87 
     88 template <> struct MappingTraits<pdb::yaml::PdbInfoStream> {
     89   static void mapping(IO &IO, pdb::yaml::PdbInfoStream &Obj);
     90 };
     91 
     92 template <> struct MappingTraits<pdb::yaml::PdbDbiStream> {
     93   static void mapping(IO &IO, pdb::yaml::PdbDbiStream &Obj);
     94 };
     95 }
     96 }
     97 
     98 LLVM_YAML_IS_SEQUENCE_VECTOR(support::ulittle32_t)
     99 LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::StreamBlockList)
    100 
    101 #endif // LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H
    102