Path: blob/main/contrib/llvm-project/llvm/tools/llvm-pdbutil/PdbYaml.h
35260 views
//===- PdbYAML.h ---------------------------------------------- *- C++ --*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H9#define LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H1011#include "OutputStyle.h"1213#include "llvm/DebugInfo/CodeView/SymbolRecord.h"14#include "llvm/DebugInfo/CodeView/TypeRecord.h"15#include "llvm/DebugInfo/MSF/MSFCommon.h"16#include "llvm/DebugInfo/PDB/Native/PDBFile.h"17#include "llvm/DebugInfo/PDB/Native/RawConstants.h"18#include "llvm/DebugInfo/PDB/PDBTypes.h"19#include "llvm/ObjectYAML/CodeViewYAMLDebugSections.h"20#include "llvm/ObjectYAML/CodeViewYAMLSymbols.h"21#include "llvm/ObjectYAML/CodeViewYAMLTypes.h"22#include "llvm/Support/Endian.h"23#include "llvm/Support/YAMLTraits.h"2425#include <optional>26#include <vector>2728namespace llvm {29namespace pdb {3031namespace yaml {3233struct MSFHeaders {34msf::SuperBlock SuperBlock;35uint32_t NumDirectoryBlocks = 0;36std::vector<uint32_t> DirectoryBlocks;37uint32_t NumStreams = 0;38uint64_t FileSize = 0;39};4041struct StreamBlockList {42std::vector<uint32_t> Blocks;43};4445struct NamedStreamMapping {46StringRef StreamName;47uint32_t StreamNumber;48};4950struct PdbInfoStream {51PdbRaw_ImplVer Version = PdbImplVC70;52uint32_t Signature = 0;53uint32_t Age = 1;54codeview::GUID Guid;55std::vector<PdbRaw_FeatureSig> Features;56std::vector<NamedStreamMapping> NamedStreams;57};5859struct PdbModiStream {60uint32_t Signature;61std::vector<CodeViewYAML::SymbolRecord> Symbols;62};6364struct PdbDbiModuleInfo {65StringRef Obj;66StringRef Mod;67std::vector<StringRef> SourceFiles;68std::vector<CodeViewYAML::YAMLDebugSubsection> Subsections;69std::optional<PdbModiStream> Modi;70};7172struct PdbDbiStream {73PdbRaw_DbiVer VerHeader = PdbDbiV70;74uint32_t Age = 1;75uint16_t BuildNumber = 0;76uint32_t PdbDllVersion = 0;77uint16_t PdbDllRbld = 0;78uint16_t Flags = 1;79PDB_Machine MachineType = PDB_Machine::x86;8081std::vector<PdbDbiModuleInfo> ModInfos;82};8384struct PdbTpiStream {85PdbRaw_TpiVer Version = PdbTpiV80;86std::vector<CodeViewYAML::LeafRecord> Records;87};8889struct PdbPublicsStream {90std::vector<CodeViewYAML::SymbolRecord> PubSyms;91};9293struct PdbObject {94explicit PdbObject(BumpPtrAllocator &Allocator) : Allocator(Allocator) {}9596std::optional<MSFHeaders> Headers;97std::optional<std::vector<uint32_t>> StreamSizes;98std::optional<std::vector<StreamBlockList>> StreamMap;99std::optional<PdbInfoStream> PdbStream;100std::optional<PdbDbiStream> DbiStream;101std::optional<PdbTpiStream> TpiStream;102std::optional<PdbTpiStream> IpiStream;103std::optional<PdbPublicsStream> PublicsStream;104105std::optional<std::vector<StringRef>> StringTable;106107BumpPtrAllocator &Allocator;108};109}110}111}112113LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbObject)114LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::MSFHeaders)115LLVM_YAML_DECLARE_MAPPING_TRAITS(msf::SuperBlock)116LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::StreamBlockList)117LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbInfoStream)118LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbDbiStream)119LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbTpiStream)120LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbPublicsStream)121LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::NamedStreamMapping)122LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbModiStream)123LLVM_YAML_DECLARE_MAPPING_TRAITS(pdb::yaml::PdbDbiModuleInfo)124125#endif // LLVM_TOOLS_LLVMPDBDUMP_PDBYAML_H126127128