LLVM 22.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
20#include "llvm/Support/Endian.h"
21#include "llvm/Support/Error.h"
22
23namespace llvm {
24class BinaryStream;
25namespace object {
26struct FpoData;
27struct coff_section;
28}
29namespace msf {
31}
32namespace pdb {
33struct DbiStreamHeader;
34struct SecMapEntry;
35struct SectionContrib2;
36struct SectionContrib;
37class PDBFile;
39
40class DbiStream {
41 friend class DbiStreamBuilder;
42
43public:
44 LLVM_ABI explicit DbiStream(std::unique_ptr<BinaryStream> Stream);
47
49 LLVM_ABI uint32_t getAge() const;
52
55 LLVM_ABI bool hasCTypes() const;
56 LLVM_ABI bool isStripped() const;
57
61
64
66
68
69 const DbiStreamHeader *getHeader() const { return Header; }
70
77
78 /// If the given stream type is present, returns its stream index. If it is
79 /// not present, returns InvalidStreamIndex.
81
82 LLVM_ABI const DbiModuleList &modules() const;
83
85
86 LLVM_ABI bool hasOldFpoRecords() const;
88 LLVM_ABI bool hasNewFpoRecords() const;
90 getNewFpoRecords() const;
91
93 LLVM_ABI void
95
97
98private:
99 Error initializeSectionContributionData();
100 Error initializeSectionHeadersData(PDBFile *Pdb);
101 Error initializeSectionMapData();
102 Error initializeOldFpoRecords(PDBFile *Pdb);
103 Error initializeNewFpoRecords(PDBFile *Pdb);
104
106 createIndexedStreamForHeaderType(PDBFile *Pdb, DbgHeaderType Type) const;
107
108 std::unique_ptr<BinaryStream> Stream;
109
110 PDBStringTable ECNames;
111
112 BinarySubstreamRef SecContrSubstream;
113 BinarySubstreamRef SecMapSubstream;
114 BinarySubstreamRef ModiSubstream;
115 BinarySubstreamRef FileInfoSubstream;
116 BinarySubstreamRef TypeServerMapSubstream;
117 BinarySubstreamRef ECSubstream;
118
119 DbiModuleList Modules;
120
122
123 PdbRaw_DbiSecContribVer SectionContribVersion =
126 FixedStreamArray<SectionContrib2> SectionContribs2;
128
129 std::unique_ptr<msf::MappedBlockStream> SectionHeaderStream;
131
132 std::unique_ptr<msf::MappedBlockStream> OldFpoStream;
134
135 std::unique_ptr<msf::MappedBlockStream> NewFpoStream;
137
138 const DbiStreamHeader *Header;
139};
140}
141}
142
143#endif
Lightweight arrays that are backed by an arbitrary BinaryStream.
#define LLVM_ABI
Definition Compiler.h:213
An interface for accessing data in a stream-like format, but which discourages copying.
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
Tagged union holding either a T or a Error.
Definition Error.h:485
FixedStreamArray is similar to VarStreamArray, except with each record having a fixed-length.
MappedBlockStream represents data stored in an MSF file into chunks of a particular size (called the ...
LLVM_ABI Expected< StringRef > getECName(uint32_t NI) const
LLVM_ABI BinarySubstreamRef getSecMapSubstreamData() const
LLVM_ABI PDB_Machine getMachineType() const
LLVM_ABI BinarySubstreamRef getFileInfoSubstreamData() const
LLVM_ABI void visitSectionContributions(ISectionContribVisitor &Visitor) const
LLVM_ABI uint32_t getAge() const
LLVM_ABI bool isIncrementallyLinked() const
LLVM_ABI uint16_t getFlags() const
LLVM_ABI PdbRaw_DbiVer getDbiVersion() const
LLVM_ABI bool isStripped() const
LLVM_ABI bool hasNewFpoRecords() const
LLVM_ABI uint16_t getBuildMajorVersion() const
LLVM_ABI FixedStreamArray< object::coff_section > getSectionHeaders() const
LLVM_ABI uint16_t getGlobalSymbolStreamIndex() const
LLVM_ABI DbiStream(std::unique_ptr< BinaryStream > Stream)
Definition DbiStream.cpp:45
LLVM_ABI Error reload(PDBFile *Pdb)
Definition DbiStream.cpp:50
LLVM_ABI BinarySubstreamRef getTypeServerMapSubstreamData() const
LLVM_ABI BinarySubstreamRef getModiSubstreamData() const
const DbiStreamHeader * getHeader() const
Definition DbiStream.h:69
LLVM_ABI const DbiModuleList & modules() const
LLVM_ABI uint16_t getBuildNumber() const
LLVM_ABI const codeview::DebugFrameDataSubsectionRef & getNewFpoRecords() const
LLVM_ABI uint16_t getBuildMinorVersion() const
LLVM_ABI uint32_t getDebugStreamIndex(DbgHeaderType Type) const
If the given stream type is present, returns its stream index.
LLVM_ABI FixedStreamArray< object::FpoData > getOldFpoRecords() const
LLVM_ABI uint32_t getPdbDllVersion() const
LLVM_ABI uint32_t getSymRecordStreamIndex() const
LLVM_ABI uint16_t getPublicSymbolStreamIndex() const
friend class DbiStreamBuilder
Definition DbiStream.h:41
LLVM_ABI BinarySubstreamRef getECSubstreamData() const
LLVM_ABI bool hasCTypes() const
LLVM_ABI uint16_t getPdbDllRbld() const
LLVM_ABI FixedStreamArray< SecMapEntry > getSectionMap() const
LLVM_ABI BinarySubstreamRef getSectionContributionData() const
LLVM_ABI bool hasOldFpoRecords() const
PdbRaw_DbiSecContribVer
@ DbiSecContribVer60
This is an optimization pass for GlobalISel generic memory operations.
The fixed size header that appears at the beginning of the DBI Stream.
Definition RawTypes.h:119