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/ModuleSubstream.h"
14 #include "llvm/DebugInfo/MSF/MappedBlockStream.h"
15 #include "llvm/DebugInfo/PDB/Native/ModInfo.h"
16 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
17 #include "llvm/DebugInfo/PDB/Native/RawTypes.h"
18 #include "llvm/DebugInfo/PDB/Native/StringTable.h"
19 #include "llvm/DebugInfo/PDB/PDBTypes.h"
20 #include "llvm/Support/BinaryStreamArray.h"
21 #include "llvm/Support/BinaryStreamArray.h"
22 #include "llvm/Support/BinaryStreamRef.h"
23 #include "llvm/Support/BinaryStreamRef.h"
24 #include "llvm/Support/Endian.h"
25 #include "llvm/Support/Error.h"
34 class DbiStreamBuilder;
36 class ISectionContribVisitor;
39 friend class DbiStreamBuilder;
42 DbiStream(PDBFile &File, std::unique_ptr<msf::MappedBlockStream> Stream);
46 PdbRaw_DbiVer getDbiVersion() const;
47 uint32_t getAge() const;
48 uint16_t getPublicSymbolStreamIndex() const;
49 uint16_t getGlobalSymbolStreamIndex() const;
51 uint16_t getFlags() const;
52 bool isIncrementallyLinked() const;
53 bool hasCTypes() const;
54 bool isStripped() const;
56 uint16_t getBuildNumber() const;
57 uint16_t getBuildMajorVersion() const;
58 uint16_t getBuildMinorVersion() const;
60 uint16_t getPdbDllRbld() const;
61 uint32_t getPdbDllVersion() const;
63 uint32_t getSymRecordStreamIndex() const;
65 PDB_Machine getMachineType() const;
67 /// If the given stream type is present, returns its stream index. If it is
68 /// not present, returns InvalidStreamIndex.
69 uint32_t getDebugStreamIndex(DbgHeaderType Type) const;
71 ArrayRef<ModuleInfoEx> modules() const;
73 Expected<StringRef> getFileNameForIndex(uint32_t Index) const;
75 FixedStreamArray<object::coff_section> getSectionHeaders();
77 FixedStreamArray<object::FpoData> getFpoRecords();
79 FixedStreamArray<SecMapEntry> getSectionMap() const;
80 void visitSectionContributions(ISectionContribVisitor &Visitor) const;
83 Error initializeModInfoArray();
84 Error initializeSectionContributionData();
85 Error initializeSectionHeadersData();
86 Error initializeSectionMapData();
87 Error initializeFileInfo();
88 Error initializeFpoRecords();
91 std::unique_ptr<msf::MappedBlockStream> Stream;
93 std::vector<ModuleInfoEx> ModuleInfos;
96 BinaryStreamRef ModInfoSubstream;
97 BinaryStreamRef SecContrSubstream;
98 BinaryStreamRef SecMapSubstream;
99 BinaryStreamRef FileInfoSubstream;
100 BinaryStreamRef TypeServerMapSubstream;
101 BinaryStreamRef ECSubstream;
103 BinaryStreamRef NamesBuffer;
105 FixedStreamArray<support::ulittle16_t> DbgStreams;
107 PdbRaw_DbiSecContribVer SectionContribVersion;
108 FixedStreamArray<SectionContrib> SectionContribs;
109 FixedStreamArray<SectionContrib2> SectionContribs2;
110 FixedStreamArray<SecMapEntry> SectionMap;
111 FixedStreamArray<support::little32_t> FileNameOffsets;
113 std::unique_ptr<msf::MappedBlockStream> SectionHeaderStream;
114 FixedStreamArray<object::coff_section> SectionHeaders;
116 std::unique_ptr<msf::MappedBlockStream> FpoStream;
117 FixedStreamArray<object::FpoData> FpoRecords;
119 const DbiStreamHeader *Header;