Line data Source code
1 : //===- DbiStream.h - PDB Dbi Stream (Stream 3) Access -----------*- 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_DEBUGINFO_PDB_RAW_PDBDBISTREAM_H
11 : #define LLVM_DEBUGINFO_PDB_RAW_PDBDBISTREAM_H
12 :
13 : #include "llvm/DebugInfo/CodeView/ModuleSubstream.h"
14 : #include "llvm/DebugInfo/MSF/MappedBlockStream.h"
15 : #include "llvm/DebugInfo/MSF/StreamArray.h"
16 : #include "llvm/DebugInfo/MSF/StreamRef.h"
17 : #include "llvm/DebugInfo/PDB/PDBTypes.h"
18 : #include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
19 : #include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
20 : #include "llvm/DebugInfo/PDB/Raw/RawTypes.h"
21 : #include "llvm/DebugInfo/PDB/Raw/StringTable.h"
22 : #include "llvm/Support/Endian.h"
23 : #include "llvm/Support/Error.h"
24 :
25 : namespace llvm {
26 : namespace object {
27 : struct FpoData;
28 : struct coff_section;
29 : }
30 :
31 : namespace pdb {
32 : class DbiStreamBuilder;
33 : class PDBFile;
34 : class ISectionContribVisitor;
35 :
36 36 : class DbiStream {
37 : friend class DbiStreamBuilder;
38 :
39 : public:
40 : DbiStream(PDBFile &File, std::unique_ptr<msf::MappedBlockStream> Stream);
41 : ~DbiStream();
42 : Error reload();
43 :
44 : PdbRaw_DbiVer getDbiVersion() const;
45 : uint32_t getAge() const;
46 : uint16_t getPublicSymbolStreamIndex() const;
47 : uint16_t getGlobalSymbolStreamIndex() const;
48 :
49 : uint16_t getFlags() const;
50 : bool isIncrementallyLinked() const;
51 : bool hasCTypes() const;
52 : bool isStripped() const;
53 :
54 : uint16_t getBuildNumber() const;
55 : uint16_t getBuildMajorVersion() const;
56 : uint16_t getBuildMinorVersion() const;
57 :
58 : uint16_t getPdbDllRbld() const;
59 : uint32_t getPdbDllVersion() const;
60 :
61 : uint32_t getSymRecordStreamIndex() const;
62 :
63 : PDB_Machine getMachineType() const;
64 :
65 : /// If the given stream type is present, returns its stream index. If it is
66 : /// not present, returns InvalidStreamIndex.
67 : uint32_t getDebugStreamIndex(DbgHeaderType Type) const;
68 :
69 : ArrayRef<ModuleInfoEx> modules() const;
70 :
71 : Expected<StringRef> getFileNameForIndex(uint32_t Index) const;
72 :
73 : msf::FixedStreamArray<object::coff_section> getSectionHeaders();
74 :
75 : msf::FixedStreamArray<object::FpoData> getFpoRecords();
76 :
77 : msf::FixedStreamArray<SecMapEntry> getSectionMap() const;
78 : void visitSectionContributions(ISectionContribVisitor &Visitor) const;
79 :
80 : private:
81 : Error initializeModInfoArray();
82 : Error initializeSectionContributionData();
83 : Error initializeSectionHeadersData();
84 : Error initializeSectionMapData();
85 : Error initializeFileInfo();
86 : Error initializeFpoRecords();
87 :
88 : PDBFile &Pdb;
89 : std::unique_ptr<msf::MappedBlockStream> Stream;
90 :
91 : std::vector<ModuleInfoEx> ModuleInfos;
92 : StringTable ECNames;
93 :
94 : msf::ReadableStreamRef ModInfoSubstream;
95 : msf::ReadableStreamRef SecContrSubstream;
96 : msf::ReadableStreamRef SecMapSubstream;
97 : msf::ReadableStreamRef FileInfoSubstream;
98 : msf::ReadableStreamRef TypeServerMapSubstream;
99 : msf::ReadableStreamRef ECSubstream;
100 :
101 : msf::ReadableStreamRef NamesBuffer;
102 :
103 : msf::FixedStreamArray<support::ulittle16_t> DbgStreams;
104 :
105 : PdbRaw_DbiSecContribVer SectionContribVersion;
106 : msf::FixedStreamArray<SectionContrib> SectionContribs;
107 : msf::FixedStreamArray<SectionContrib2> SectionContribs2;
108 : msf::FixedStreamArray<SecMapEntry> SectionMap;
109 : msf::FixedStreamArray<support::little32_t> FileNameOffsets;
110 :
111 : std::unique_ptr<msf::MappedBlockStream> SectionHeaderStream;
112 : msf::FixedStreamArray<object::coff_section> SectionHeaders;
113 :
114 : std::unique_ptr<msf::MappedBlockStream> FpoStream;
115 : msf::FixedStreamArray<object::FpoData> FpoRecords;
116 :
117 : const DbiStreamHeader *Header;
118 : };
119 : }
120 : }
121 :
122 : #endif
|