LLVM 23.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
99
100private:
101 Error initializeSectionContributionData();
102 Error initializeSectionHeadersData(PDBFile *Pdb);
103 Error initializeSectionMapData();
104 Error initializeOldFpoRecords(PDBFile *Pdb);
105 Error initializeNewFpoRecords(PDBFile *Pdb);
106
108 createIndexedStreamForHeaderType(PDBFile *Pdb, DbgHeaderType Type) const;
109
110 std::unique_ptr<BinaryStream> Stream;
111
112 PDBStringTable ECNames;
113
114 BinarySubstreamRef SecContrSubstream;
115 BinarySubstreamRef SecMapSubstream;
116 BinarySubstreamRef ModiSubstream;
117 BinarySubstreamRef FileInfoSubstream;
118 BinarySubstreamRef TypeServerMapSubstream;
119 BinarySubstreamRef ECSubstream;
120
121 DbiModuleList Modules;
122
124
125 PdbRaw_DbiSecContribVer SectionContribVersion =
128 FixedStreamArray<SectionContrib2> SectionContribs2;
130
131 std::unique_ptr<msf::MappedBlockStream> SectionHeaderStream;
133
134 std::unique_ptr<msf::MappedBlockStream> OldFpoStream;
136
137 std::unique_ptr<msf::MappedBlockStream> NewFpoStream;
139
140 const DbiStreamHeader *Header;
141};
142}
143}
144
145#endif
Lightweight arrays that are backed by an arbitrary BinaryStream.
#define LLVM_ABI
Definition Compiler.h:215
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 PdbRaw_DbiSecContribVer getSectionContributionsVersion() 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