1 //===- DbiStream.h - PDB Dbi Stream (Stream 3) Access -----------*- 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_DEBUGINFO_PDB_RAW_PDBDBISTREAM_H
11 #define LLVM_DEBUGINFO_PDB_RAW_PDBDBISTREAM_H
13 #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
14 #include "llvm/DebugInfo/MSF/MappedBlockStream.h"
15 #include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"
16 #include "llvm/DebugInfo/PDB/Native/DbiModuleList.h"
17 #include "llvm/DebugInfo/PDB/Native/PDBStringTable.h"
18 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
19 #include "llvm/DebugInfo/PDB/Native/RawTypes.h"
20 #include "llvm/DebugInfo/PDB/PDBTypes.h"
21 #include "llvm/Support/BinaryStreamArray.h"
22 #include "llvm/Support/BinaryStreamRef.h"
23 #include "llvm/Support/Endian.h"
24 #include "llvm/Support/Error.h"
33 class DbiStreamBuilder;
35 class ISectionContribVisitor;
38 friend class DbiStreamBuilder;
41 DbiStream(PDBFile &File, std::unique_ptr<msf::MappedBlockStream> Stream);
45 PdbRaw_DbiVer getDbiVersion() const;
46 uint32_t getAge() const;
47 uint16_t getPublicSymbolStreamIndex() const;
48 uint16_t getGlobalSymbolStreamIndex() const;
50 uint16_t getFlags() const;
51 bool isIncrementallyLinked() const;
52 bool hasCTypes() const;
53 bool isStripped() const;
55 uint16_t getBuildNumber() const;
56 uint16_t getBuildMajorVersion() const;
57 uint16_t getBuildMinorVersion() const;
59 uint16_t getPdbDllRbld() const;
60 uint32_t getPdbDllVersion() const;
62 uint32_t getSymRecordStreamIndex() const;
64 PDB_Machine getMachineType() const;
66 BinarySubstreamRef getSectionContributionData() const;
67 BinarySubstreamRef getSecMapSubstreamData() const;
68 BinarySubstreamRef getModiSubstreamData() const;
69 BinarySubstreamRef getFileInfoSubstreamData() const;
70 BinarySubstreamRef getTypeServerMapSubstreamData() const;
71 BinarySubstreamRef getECSubstreamData() const;
73 /// If the given stream type is present, returns its stream index. If it is
74 /// not present, returns InvalidStreamIndex.
75 uint32_t getDebugStreamIndex(DbgHeaderType Type) const;
77 const DbiModuleList &modules() const;
79 FixedStreamArray<object::coff_section> getSectionHeaders();
81 FixedStreamArray<object::FpoData> getFpoRecords();
83 FixedStreamArray<SecMapEntry> getSectionMap() const;
84 void visitSectionContributions(ISectionContribVisitor &Visitor) const;
86 Expected<StringRef> getECName(uint32_t NI) const;
89 Error initializeSectionContributionData();
90 Error initializeSectionHeadersData();
91 Error initializeSectionMapData();
92 Error initializeFpoRecords();
95 std::unique_ptr<msf::MappedBlockStream> Stream;
97 PDBStringTable ECNames;
99 BinarySubstreamRef SecContrSubstream;
100 BinarySubstreamRef SecMapSubstream;
101 BinarySubstreamRef ModiSubstream;
102 BinarySubstreamRef FileInfoSubstream;
103 BinarySubstreamRef TypeServerMapSubstream;
104 BinarySubstreamRef ECSubstream;
106 DbiModuleList Modules;
108 FixedStreamArray<support::ulittle16_t> DbgStreams;
110 PdbRaw_DbiSecContribVer SectionContribVersion =
111 PdbRaw_DbiSecContribVer::DbiSecContribVer60;
112 FixedStreamArray<SectionContrib> SectionContribs;
113 FixedStreamArray<SectionContrib2> SectionContribs2;
114 FixedStreamArray<SecMapEntry> SectionMap;
116 std::unique_ptr<msf::MappedBlockStream> SectionHeaderStream;
117 FixedStreamArray<object::coff_section> SectionHeaders;
119 std::unique_ptr<msf::MappedBlockStream> FpoStream;
120 FixedStreamArray<object::FpoData> FpoRecords;
122 const DbiStreamHeader *Header;