LLVM  9.0.0svn
DbiStream.h
Go to the documentation of this file.
1 //===- DbiStream.h - PDB Dbi Stream (Stream 3) Access -----------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_DEBUGINFO_PDB_RAW_PDBDBISTREAM_H
10 #define LLVM_DEBUGINFO_PDB_RAW_PDBDBISTREAM_H
11 
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  explicit DbiStream(std::unique_ptr<BinaryStream> Stream);
41  ~DbiStream();
42  Error reload(PDBFile *Pdb);
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  const DbiStreamHeader *getHeader() const { return Header; }
66 
67  BinarySubstreamRef getSectionContributionData() const;
68  BinarySubstreamRef getSecMapSubstreamData() const;
69  BinarySubstreamRef getModiSubstreamData() const;
70  BinarySubstreamRef getFileInfoSubstreamData() const;
71  BinarySubstreamRef getTypeServerMapSubstreamData() const;
72  BinarySubstreamRef getECSubstreamData() const;
73 
74  /// If the given stream type is present, returns its stream index. If it is
75  /// not present, returns InvalidStreamIndex.
76  uint32_t getDebugStreamIndex(DbgHeaderType Type) const;
77 
78  const DbiModuleList &modules() const;
79 
80  FixedStreamArray<object::coff_section> getSectionHeaders() const;
81 
82  FixedStreamArray<object::FpoData> getFpoRecords();
83 
84  FixedStreamArray<SecMapEntry> getSectionMap() const;
85  void visitSectionContributions(ISectionContribVisitor &Visitor) const;
86 
87  Expected<StringRef> getECName(uint32_t NI) const;
88 
89 private:
90  Error initializeSectionContributionData();
91  Error initializeSectionHeadersData(PDBFile *Pdb);
92  Error initializeSectionMapData();
93  Error initializeFpoRecords(PDBFile *Pdb);
94 
95  std::unique_ptr<BinaryStream> 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 =
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
This class represents lattice values for constants.
Definition: AllocatorList.h:23
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:22
The fixed size header that appears at the beginning of the DBI Stream.
Definition: RawTypes.h:119
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:45
const DbiStreamHeader * getHeader() const
Definition: DbiStream.h:65
PdbRaw_DbiSecContribVer
Definition: RawConstants.h:67
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157