2016-06-06 22:37:05 +02:00
|
|
|
//===- PdbYAML.h ---------------------------------------------- *- C++ --*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H
|
|
|
|
#define LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H
|
|
|
|
|
|
|
|
#include "OutputStyle.h"
|
|
|
|
|
|
|
|
#include "llvm/ADT/Optional.h"
|
2016-07-29 22:56:36 +02:00
|
|
|
#include "llvm/DebugInfo/MSF/MSFCommon.h"
|
2016-07-06 20:05:57 +02:00
|
|
|
#include "llvm/DebugInfo/PDB/PDBTypes.h"
|
2016-06-14 22:48:36 +02:00
|
|
|
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
2016-07-06 20:05:57 +02:00
|
|
|
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
|
2016-06-06 22:37:05 +02:00
|
|
|
#include "llvm/Support/Endian.h"
|
|
|
|
#include "llvm/Support/YAMLTraits.h"
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
namespace pdb {
|
|
|
|
|
|
|
|
namespace yaml {
|
2016-09-09 19:46:17 +02:00
|
|
|
struct SerializationContext;
|
|
|
|
|
2016-07-29 22:56:36 +02:00
|
|
|
struct MSFHeaders {
|
2016-07-16 00:16:56 +02:00
|
|
|
msf::SuperBlock SuperBlock;
|
2016-06-06 22:37:05 +02:00
|
|
|
uint32_t NumDirectoryBlocks;
|
2016-07-16 00:16:56 +02:00
|
|
|
std::vector<uint32_t> DirectoryBlocks;
|
2016-06-06 22:37:05 +02:00
|
|
|
uint32_t NumStreams;
|
2016-06-14 22:48:36 +02:00
|
|
|
uint32_t FileSize;
|
2016-06-06 22:37:05 +02:00
|
|
|
};
|
|
|
|
|
2016-06-14 22:48:36 +02:00
|
|
|
struct StreamBlockList {
|
2016-07-16 00:16:56 +02:00
|
|
|
std::vector<uint32_t> Blocks;
|
2016-06-06 22:37:17 +02:00
|
|
|
};
|
|
|
|
|
2016-07-16 00:17:08 +02:00
|
|
|
struct NamedStreamMapping {
|
|
|
|
StringRef StreamName;
|
|
|
|
uint32_t StreamNumber;
|
|
|
|
};
|
|
|
|
|
2016-07-06 20:05:57 +02:00
|
|
|
struct PdbInfoStream {
|
2016-07-11 23:45:26 +02:00
|
|
|
PdbRaw_ImplVer Version;
|
2016-07-06 20:05:57 +02:00
|
|
|
uint32_t Signature;
|
|
|
|
uint32_t Age;
|
|
|
|
PDB_UniqueId Guid;
|
2016-07-16 00:17:08 +02:00
|
|
|
std::vector<NamedStreamMapping> NamedStreams;
|
2016-07-06 20:05:57 +02:00
|
|
|
};
|
|
|
|
|
2016-07-22 17:46:37 +02:00
|
|
|
struct PdbDbiModuleInfo {
|
|
|
|
StringRef Obj;
|
|
|
|
StringRef Mod;
|
|
|
|
std::vector<StringRef> SourceFiles;
|
|
|
|
};
|
|
|
|
|
2016-07-11 23:45:26 +02:00
|
|
|
struct PdbDbiStream {
|
|
|
|
PdbRaw_DbiVer VerHeader;
|
|
|
|
uint32_t Age;
|
|
|
|
uint16_t BuildNumber;
|
|
|
|
uint32_t PdbDllVersion;
|
|
|
|
uint16_t PdbDllRbld;
|
|
|
|
uint16_t Flags;
|
|
|
|
PDB_Machine MachineType;
|
2016-07-22 17:46:37 +02:00
|
|
|
|
|
|
|
std::vector<PdbDbiModuleInfo> ModInfos;
|
2016-07-11 23:45:26 +02:00
|
|
|
};
|
|
|
|
|
2016-08-18 18:49:29 +02:00
|
|
|
struct PdbTpiRecord {
|
|
|
|
codeview::CVType Record;
|
|
|
|
};
|
|
|
|
|
2016-09-15 01:00:16 +02:00
|
|
|
struct PdbTpiFieldListRecord {
|
|
|
|
codeview::CVMemberRecord Record;
|
|
|
|
};
|
|
|
|
|
2016-08-18 18:49:29 +02:00
|
|
|
struct PdbTpiStream {
|
|
|
|
PdbRaw_TpiVer Version;
|
|
|
|
std::vector<PdbTpiRecord> Records;
|
|
|
|
};
|
|
|
|
|
2016-06-06 22:37:05 +02:00
|
|
|
struct PdbObject {
|
2016-09-09 19:46:17 +02:00
|
|
|
explicit PdbObject(BumpPtrAllocator &Allocator) : Allocator(Allocator) {}
|
|
|
|
|
2016-07-29 22:56:36 +02:00
|
|
|
Optional<MSFHeaders> Headers;
|
2016-07-16 00:16:56 +02:00
|
|
|
Optional<std::vector<uint32_t>> StreamSizes;
|
2016-06-14 22:48:36 +02:00
|
|
|
Optional<std::vector<StreamBlockList>> StreamMap;
|
2016-07-06 20:05:57 +02:00
|
|
|
Optional<PdbInfoStream> PdbStream;
|
2016-07-11 23:45:26 +02:00
|
|
|
Optional<PdbDbiStream> DbiStream;
|
2016-08-18 18:49:29 +02:00
|
|
|
Optional<PdbTpiStream> TpiStream;
|
2016-09-09 19:46:17 +02:00
|
|
|
|
|
|
|
BumpPtrAllocator &Allocator;
|
2016-06-06 22:37:05 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
2016-06-06 22:37:17 +02:00
|
|
|
}
|
2016-06-06 22:37:05 +02:00
|
|
|
|
2016-06-06 22:37:17 +02:00
|
|
|
namespace llvm {
|
2016-06-06 22:37:05 +02:00
|
|
|
namespace yaml {
|
2016-06-14 22:48:36 +02:00
|
|
|
|
2016-07-11 23:45:26 +02:00
|
|
|
template <> struct MappingTraits<pdb::yaml::PdbObject> {
|
|
|
|
static void mapping(IO &IO, pdb::yaml::PdbObject &Obj);
|
2016-06-06 22:37:17 +02:00
|
|
|
};
|
|
|
|
|
2016-07-29 22:56:36 +02:00
|
|
|
template <> struct MappingTraits<pdb::yaml::MSFHeaders> {
|
|
|
|
static void mapping(IO &IO, pdb::yaml::MSFHeaders &Obj);
|
2016-06-06 22:37:05 +02:00
|
|
|
};
|
2016-06-14 22:48:36 +02:00
|
|
|
|
2016-07-22 21:56:05 +02:00
|
|
|
template <> struct MappingTraits<msf::SuperBlock> {
|
|
|
|
static void mapping(IO &IO, msf::SuperBlock &SB);
|
2016-07-11 23:45:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
template <> struct MappingTraits<pdb::yaml::StreamBlockList> {
|
|
|
|
static void mapping(IO &IO, pdb::yaml::StreamBlockList &SB);
|
2016-06-06 22:37:05 +02:00
|
|
|
};
|
2016-07-06 20:05:57 +02:00
|
|
|
|
|
|
|
template <> struct MappingTraits<pdb::yaml::PdbInfoStream> {
|
|
|
|
static void mapping(IO &IO, pdb::yaml::PdbInfoStream &Obj);
|
|
|
|
};
|
2016-07-11 23:45:26 +02:00
|
|
|
|
|
|
|
template <> struct MappingTraits<pdb::yaml::PdbDbiStream> {
|
|
|
|
static void mapping(IO &IO, pdb::yaml::PdbDbiStream &Obj);
|
|
|
|
};
|
2016-07-16 00:17:08 +02:00
|
|
|
|
2016-09-09 19:46:17 +02:00
|
|
|
template <>
|
|
|
|
struct MappingContextTraits<pdb::yaml::PdbTpiStream, llvm::BumpPtrAllocator> {
|
|
|
|
static void mapping(IO &IO, pdb::yaml::PdbTpiStream &Obj,
|
|
|
|
llvm::BumpPtrAllocator &Allocator);
|
2016-08-18 18:49:29 +02:00
|
|
|
};
|
|
|
|
|
2016-07-16 00:17:08 +02:00
|
|
|
template <> struct MappingTraits<pdb::yaml::NamedStreamMapping> {
|
|
|
|
static void mapping(IO &IO, pdb::yaml::NamedStreamMapping &Obj);
|
|
|
|
};
|
2016-07-22 17:46:37 +02:00
|
|
|
|
|
|
|
template <> struct MappingTraits<pdb::yaml::PdbDbiModuleInfo> {
|
|
|
|
static void mapping(IO &IO, pdb::yaml::PdbDbiModuleInfo &Obj);
|
|
|
|
};
|
2016-08-18 18:49:29 +02:00
|
|
|
|
2016-09-09 19:46:17 +02:00
|
|
|
template <>
|
|
|
|
struct MappingContextTraits<pdb::yaml::PdbTpiRecord,
|
|
|
|
pdb::yaml::SerializationContext> {
|
|
|
|
static void mapping(IO &IO, pdb::yaml::PdbTpiRecord &Obj,
|
|
|
|
pdb::yaml::SerializationContext &Context);
|
2016-08-18 18:49:29 +02:00
|
|
|
};
|
2016-06-06 22:37:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H
|