LLVM  8.0.1
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  explicit DbiStream(std::unique_ptr<BinaryStream> Stream);
42  ~DbiStream();
43  Error reload(PDBFile *Pdb);
44 
45  PdbRaw_DbiVer getDbiVersion() const;
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 
62  uint32_t getSymRecordStreamIndex() const;
63 
64  PDB_Machine getMachineType() const;
65 
66  const DbiStreamHeader *getHeader() const { return Header; }
67 
68  BinarySubstreamRef getSectionContributionData() const;
69  BinarySubstreamRef getSecMapSubstreamData() const;
70  BinarySubstreamRef getModiSubstreamData() const;
71  BinarySubstreamRef getFileInfoSubstreamData() const;
72  BinarySubstreamRef getTypeServerMapSubstreamData() const;
73  BinarySubstreamRef getECSubstreamData() const;
74 
75  /// If the given stream type is present, returns its stream index. If it is
76  /// not present, returns InvalidStreamIndex.
77  uint32_t getDebugStreamIndex(DbgHeaderType Type) const;
78 
79  const DbiModuleList &modules() const;
80 
81  FixedStreamArray<object::coff_section> getSectionHeaders() const;
82 
83  FixedStreamArray<object::FpoData> getFpoRecords();
84 
85  FixedStreamArray<SecMapEntry> getSectionMap() const;
86  void visitSectionContributions(ISectionContribVisitor &Visitor) const;
87 
88  Expected<StringRef> getECName(uint32_t NI) const;
89 
90 private:
91  Error initializeSectionContributionData();
92  Error initializeSectionHeadersData(PDBFile *Pdb);
93  Error initializeSectionMapData();
94  Error initializeFpoRecords(PDBFile *Pdb);
95 
96  std::unique_ptr<BinaryStream> Stream;
97 
98  PDBStringTable ECNames;
99 
100  BinarySubstreamRef SecContrSubstream;
101  BinarySubstreamRef SecMapSubstream;
102  BinarySubstreamRef ModiSubstream;
103  BinarySubstreamRef FileInfoSubstream;
104  BinarySubstreamRef TypeServerMapSubstream;
105  BinarySubstreamRef ECSubstream;
106 
107  DbiModuleList Modules;
108 
110 
111  PdbRaw_DbiSecContribVer SectionContribVersion =
114  FixedStreamArray<SectionContrib2> SectionContribs2;
116 
117  std::unique_ptr<msf::MappedBlockStream> SectionHeaderStream;
119 
120  std::unique_ptr<msf::MappedBlockStream> FpoStream;
122 
123  const DbiStreamHeader *Header;
124 };
125 }
126 }
127 
128 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:24
FixedStreamArray is similar to VarStreamArray, except with each record having a fixed-length.
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:120
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
const DbiStreamHeader * getHeader() const
Definition: DbiStream.h:66
PdbRaw_DbiSecContribVer
Definition: RawConstants.h:68
Lightweight error class with error context and mandatory checking.
Definition: Error.h:158