LLVM 20.0.0git
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_NATIVE_DBISTREAM_H
10#define LLVM_DEBUGINFO_PDB_NATIVE_DBISTREAM_H
11
19#include "llvm/Support/Endian.h"
20#include "llvm/Support/Error.h"
21
22namespace llvm {
23class BinaryStream;
24namespace object {
25struct FpoData;
26struct coff_section;
27}
28namespace msf {
29class MappedBlockStream;
30}
31namespace pdb {
32struct DbiStreamHeader;
33struct SecMapEntry;
34struct SectionContrib2;
35struct SectionContrib;
36class PDBFile;
37class ISectionContribVisitor;
38
39class DbiStream {
40 friend class DbiStreamBuilder;
41
42public:
43 explicit DbiStream(std::unique_ptr<BinaryStream> Stream);
45 Error reload(PDBFile *Pdb);
46
48 uint32_t getAge() const;
51
52 uint16_t getFlags() const;
53 bool isIncrementallyLinked() const;
54 bool hasCTypes() const;
55 bool isStripped() const;
56
60
61 uint16_t getPdbDllRbld() const;
63
65
67
68 const DbiStreamHeader *getHeader() const { return Header; }
69
76
77 /// If the given stream type is present, returns its stream index. If it is
78 /// not present, returns InvalidStreamIndex.
80
81 const DbiModuleList &modules() const;
82
84
85 bool hasOldFpoRecords() const;
87 bool hasNewFpoRecords() const;
89
92
94
95private:
96 Error initializeSectionContributionData();
97 Error initializeSectionHeadersData(PDBFile *Pdb);
98 Error initializeSectionMapData();
99 Error initializeOldFpoRecords(PDBFile *Pdb);
100 Error initializeNewFpoRecords(PDBFile *Pdb);
101
103 createIndexedStreamForHeaderType(PDBFile *Pdb, DbgHeaderType Type) const;
104
105 std::unique_ptr<BinaryStream> Stream;
106
107 PDBStringTable ECNames;
108
109 BinarySubstreamRef SecContrSubstream;
110 BinarySubstreamRef SecMapSubstream;
111 BinarySubstreamRef ModiSubstream;
112 BinarySubstreamRef FileInfoSubstream;
113 BinarySubstreamRef TypeServerMapSubstream;
114 BinarySubstreamRef ECSubstream;
115
116 DbiModuleList Modules;
117
119
120 PdbRaw_DbiSecContribVer SectionContribVersion =
122 FixedStreamArray<SectionContrib> SectionContribs;
123 FixedStreamArray<SectionContrib2> SectionContribs2;
125
126 std::unique_ptr<msf::MappedBlockStream> SectionHeaderStream;
128
129 std::unique_ptr<msf::MappedBlockStream> OldFpoStream;
131
132 std::unique_ptr<msf::MappedBlockStream> NewFpoStream;
134
135 const DbiStreamHeader *Header;
136};
137}
138}
139
140#endif
Lightweight arrays that are backed by an arbitrary BinaryStream.
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
Tagged union holding either a T or a Error.
Definition: Error.h:481
FixedStreamArray is similar to VarStreamArray, except with each record having a fixed-length.
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
Expected< StringRef > getECName(uint32_t NI) const
Definition: DbiStream.cpp:234
BinarySubstreamRef getSecMapSubstreamData() const
Definition: DbiStream.cpp:345
PDB_Machine getMachineType() const
Definition: DbiStream.cpp:194
BinarySubstreamRef getFileInfoSubstreamData() const
Definition: DbiStream.cpp:353
void visitSectionContributions(ISectionContribVisitor &Visitor) const
Definition: DbiStream.cpp:221
uint32_t getAge() const
Definition: DbiStream.cpp:150
bool isIncrementallyLinked() const
Definition: DbiStream.cpp:162
uint16_t getFlags() const
Definition: DbiStream.cpp:160
PdbRaw_DbiVer getDbiVersion() const
Definition: DbiStream.cpp:145
bool isStripped() const
Definition: DbiStream.cpp:170
bool hasNewFpoRecords() const
Definition: DbiStream.cpp:209
uint16_t getBuildMajorVersion() const
Definition: DbiStream.cpp:176
FixedStreamArray< object::coff_section > getSectionHeaders() const
Definition: DbiStream.cpp:199
uint16_t getGlobalSymbolStreamIndex() const
Definition: DbiStream.cpp:156
Error reload(PDBFile *Pdb)
Definition: DbiStream.cpp:50
BinarySubstreamRef getTypeServerMapSubstreamData() const
Definition: DbiStream.cpp:357
BinarySubstreamRef getModiSubstreamData() const
Definition: DbiStream.cpp:349
const DbiStreamHeader * getHeader() const
Definition: DbiStream.h:68
const DbiModuleList & modules() const
Definition: DbiStream.cpp:215
uint16_t getBuildNumber() const
Definition: DbiStream.cpp:174
const codeview::DebugFrameDataSubsectionRef & getNewFpoRecords() const
Definition: DbiStream.cpp:211
uint16_t getBuildMinorVersion() const
Definition: DbiStream.cpp:181
uint32_t getDebugStreamIndex(DbgHeaderType Type) const
If the given stream type is present, returns its stream index.
Definition: DbiStream.cpp:376
FixedStreamArray< object::FpoData > getOldFpoRecords() const
Definition: DbiStream.cpp:205
uint32_t getPdbDllVersion() const
Definition: DbiStream.cpp:188
uint32_t getSymRecordStreamIndex() const
Definition: DbiStream.cpp:190
uint16_t getPublicSymbolStreamIndex() const
Definition: DbiStream.cpp:152
BinarySubstreamRef getECSubstreamData() const
Definition: DbiStream.cpp:361
bool hasCTypes() const
Definition: DbiStream.cpp:166
uint16_t getPdbDllRbld() const
Definition: DbiStream.cpp:186
FixedStreamArray< SecMapEntry > getSectionMap() const
Definition: DbiStream.cpp:217
BinarySubstreamRef getSectionContributionData() const
Definition: DbiStream.cpp:341
bool hasOldFpoRecords() const
Definition: DbiStream.cpp:203
PdbRaw_DbiSecContribVer
Definition: RawConstants.h:67
@ DbiSecContribVer60
Definition: RawConstants.h:68
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
The fixed size header that appears at the beginning of the DBI Stream.
Definition: RawTypes.h:119