LLVM  5.0.0
DbiStream.h
Go to the documentation of this file.
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 
23 #include "llvm/Support/Endian.h"
24 #include "llvm/Support/Error.h"
25 
26 namespace llvm {
27 namespace object {
28 struct FpoData;
29 struct coff_section;
30 }
31 
32 namespace pdb {
33 class DbiStreamBuilder;
34 class PDBFile;
35 class ISectionContribVisitor;
36 
37 class DbiStream {
38  friend class DbiStreamBuilder;
39 
40 public:
41  DbiStream(PDBFile &File, std::unique_ptr<msf::MappedBlockStream> Stream);
42  ~DbiStream();
43  Error reload();
44 
46  uint32_t getAge() const;
47  uint16_t getPublicSymbolStreamIndex() const;
48  uint16_t getGlobalSymbolStreamIndex() const;
49 
50  uint16_t getFlags() const;
51  bool isIncrementallyLinked() const;
52  bool hasCTypes() const;
53  bool isStripped() const;
54 
55  uint16_t getBuildNumber() const;
56  uint16_t getBuildMajorVersion() const;
57  uint16_t getBuildMinorVersion() const;
58 
59  uint16_t getPdbDllRbld() const;
60  uint32_t getPdbDllVersion() const;
61 
63 
65 
72 
73  /// If the given stream type is present, returns its stream index. If it is
74  /// not present, returns InvalidStreamIndex.
76 
77  const DbiModuleList &modules() const;
78 
80 
82 
85 
87 
88 private:
89  Error initializeSectionContributionData();
90  Error initializeSectionHeadersData();
91  Error initializeSectionMapData();
92  Error initializeFpoRecords();
93 
94  PDBFile &Pdb;
95  std::unique_ptr<msf::MappedBlockStream> Stream;
96 
97  PDBStringTable ECNames;
98 
99  BinarySubstreamRef SecContrSubstream;
100  BinarySubstreamRef SecMapSubstream;
101  BinarySubstreamRef ModiSubstream;
102  BinarySubstreamRef FileInfoSubstream;
103  BinarySubstreamRef TypeServerMapSubstream;
104  BinarySubstreamRef ECSubstream;
105 
106  DbiModuleList Modules;
107 
109 
110  PdbRaw_DbiSecContribVer SectionContribVersion =
112  FixedStreamArray<SectionContrib> SectionContribs;
113  FixedStreamArray<SectionContrib2> SectionContribs2;
115 
116  std::unique_ptr<msf::MappedBlockStream> SectionHeaderStream;
118 
119  std::unique_ptr<msf::MappedBlockStream> FpoStream;
121 
122  const DbiStreamHeader *Header;
123 };
124 }
125 }
126 
127 #endif
void visitSectionContributions(ISectionContribVisitor &Visitor) const
Definition: DbiStream.cpp:215
DbiStream(PDBFile &File, std::unique_ptr< msf::MappedBlockStream > Stream)
Definition: DbiStream.cpp:49
uint16_t getPublicSymbolStreamIndex() const
Definition: DbiStream.cpp:154
uint16_t getGlobalSymbolStreamIndex() const
Definition: DbiStream.cpp:158
uint32_t getPdbDllVersion() const
Definition: DbiStream.cpp:190
bool isStripped() const
Definition: DbiStream.cpp:172
bool isIncrementallyLinked() const
Definition: DbiStream.cpp:164
uint16_t getBuildMajorVersion() const
Definition: DbiStream.cpp:178
FixedStreamArray< object::FpoData > getFpoRecords()
Definition: DbiStream.cpp:205
Tagged union holding either a T or a Error.
Definition: CachePruning.h:23
The fixed size header that appears at the beginning of the DBI Stream.
Definition: RawTypes.h:104
FixedStreamArray< object::coff_section > getSectionHeaders()
Definition: DbiStream.cpp:201
uint32_t getAge() const
Definition: DbiStream.cpp:152
const DbiModuleList & modules() const
Definition: DbiStream.cpp:209
uint16_t getFlags() const
Definition: DbiStream.cpp:162
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
uint16_t getBuildNumber() const
Definition: DbiStream.cpp:176
PDB_Machine getMachineType() const
Definition: DbiStream.cpp:196
BinarySubstreamRef getFileInfoSubstreamData() const
Definition: DbiStream.cpp:322
FixedStreamArray< SecMapEntry > getSectionMap() const
Definition: DbiStream.cpp:211
uint32_t getSymRecordStreamIndex() const
Definition: DbiStream.cpp:192
BinarySubstreamRef getSectionContributionData() const
Definition: DbiStream.cpp:310
PdbRaw_DbiSecContribVer
Definition: RawConstants.h:66
BinarySubstreamRef getTypeServerMapSubstreamData() const
Definition: DbiStream.cpp:326
uint16_t getPdbDllRbld() const
Definition: DbiStream.cpp:188
uint32_t getDebugStreamIndex(DbgHeaderType Type) const
If the given stream type is present, returns its stream index.
Definition: DbiStream.cpp:345
BinarySubstreamRef getModiSubstreamData() const
Definition: DbiStream.cpp:318
PdbRaw_DbiVer getDbiVersion() const
Definition: DbiStream.cpp:147
uint16_t getBuildMinorVersion() const
Definition: DbiStream.cpp:183
Expected< StringRef > getECName(uint32_t NI) const
Definition: DbiStream.cpp:228
Lightweight error class with error context and mandatory checking.
Definition: Error.h:156
bool hasCTypes() const
Definition: DbiStream.cpp:168
BinarySubstreamRef getECSubstreamData() const
Definition: DbiStream.cpp:330
BinarySubstreamRef getSecMapSubstreamData() const
Definition: DbiStream.cpp:314