LLVM  4.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 
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 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 
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 
62 
64 
65  /// If the given stream type is present, returns its stream index. If it is
66  /// not present, returns InvalidStreamIndex.
68 
70 
72 
74 
76 
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  NameHashTable 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 
104 
105  PdbRaw_DbiSecContribVer SectionContribVersion;
110 
111  std::unique_ptr<msf::MappedBlockStream> SectionHeaderStream;
113 
114  std::unique_ptr<msf::MappedBlockStream> FpoStream;
116 
117  const DbiStreamHeader *Header;
118 };
119 }
120 }
121 
122 #endif
void visitSectionContributions(ISectionContribVisitor &Visitor) const
Definition: DbiStream.cpp:225
DbiStream(PDBFile &File, std::unique_ptr< msf::MappedBlockStream > Stream)
Definition: DbiStream.cpp:50
uint16_t getPublicSymbolStreamIndex() const
Definition: DbiStream.cpp:165
uint16_t getGlobalSymbolStreamIndex() const
Definition: DbiStream.cpp:169
uint32_t getPdbDllVersion() const
Definition: DbiStream.cpp:201
bool isStripped() const
Definition: DbiStream.cpp:183
bool isIncrementallyLinked() const
Definition: DbiStream.cpp:175
uint16_t getBuildMajorVersion() const
Definition: DbiStream.cpp:189
Tagged union holding either a T or a Error.
The fixed size header that appears at the beginning of the DBI Stream.
Definition: RawTypes.h:110
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
uint32_t getAge() const
Definition: DbiStream.cpp:163
uint16_t getFlags() const
Definition: DbiStream.cpp:173
msf::FixedStreamArray< SecMapEntry > getSectionMap() const
Definition: DbiStream.cpp:221
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:45
uint16_t getBuildNumber() const
Definition: DbiStream.cpp:187
PDB_Machine getMachineType() const
Definition: DbiStream.cpp:207
Expected< StringRef > getFileNameForIndex(uint32_t Index) const
Definition: DbiStream.cpp:415
msf::FixedStreamArray< object::FpoData > getFpoRecords()
Definition: DbiStream.cpp:216
ArrayRef< ModuleInfoEx > modules() const
Definition: DbiStream.cpp:220
uint32_t getSymRecordStreamIndex() const
Definition: DbiStream.cpp:203
PdbRaw_DbiSecContribVer
Definition: RawConstants.h:51
uint16_t getPdbDllRbld() const
Definition: DbiStream.cpp:199
uint32_t getDebugStreamIndex(DbgHeaderType Type) const
If the given stream type is present, returns its stream index.
Definition: DbiStream.cpp:408
PdbRaw_DbiVer getDbiVersion() const
Definition: DbiStream.cpp:158
msf::FixedStreamArray< object::coff_section > getSectionHeaders()
Definition: DbiStream.cpp:212
uint16_t getBuildMinorVersion() const
Definition: DbiStream.cpp:194
Lightweight error class with error context and mandatory checking.
bool hasCTypes() const
Definition: DbiStream.cpp:179