LLVM: include/llvm/DebugInfo/PDB/Native/InputFile.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9#ifndef LLVM_DEBUGINFO_PDB_NATIVE_INPUTFILE_H
10#define LLVM_DEBUGINFO_PDB_NATIVE_INPUTFILE_H
11
23
24namespace llvm {
27}
30}
31
32namespace pdb {
39
40class InputFile {
41 InputFile();
42
43 std::unique_ptr PdbSession;
45 std::unique_ptr UnknownFile;
47
48 using TypeCollectionPtr = std::unique_ptrcodeview::LazyRandomTypeCollection;
49
50 TypeCollectionPtr Types;
51 TypeCollectionPtr Ids;
52
53 enum TypeCollectionKind { kTypes, kIds };
55 getOrCreateTypeCollection(TypeCollectionKind Kind);
56
57public:
63
65 bool AllowUnknownFile = false);
66
73
75
78
81
85
89};
90
93
94public:
96
99
101 bool Append = false) const;
102
104 bool Append = false) const;
105
107
109 return Subsections;
110 }
112
115
117
118private:
119 void initializeForPdb(uint32_t Modi);
120 void updatePdbModi(uint32_t Modi);
122
123 void rebuildChecksumMap();
127 std::shared_ptr DebugStream;
130};
131
134 std::forward_iterator_tag, SymbolGroup> {
135public:
140
143
146
147private:
148 void scanToNextDebugS();
149 bool isEnd() const;
150
152 std::optionalobject::section\_iterator SectionIter;
154};
155
160
163
164
165template
168 CallbackT Callback) {
170 "Mod {0:4} | `{1}`: ",
172
174 return Callback(Modi, SG);
175}
176
177template
179 CallbackT Callback) {
181
187 SG, Modi, Callback);
188 }
189
191
192 for (const auto &SG : Input.symbol_groups()) {
194 if (auto Err =
196 SG, I, Callback))
197 return Err;
198
199 ++I;
200 }
202}
203
204template
208 Callback) {
209
213 SubsectionT Subsection;
214
215 if (SS.kind() != Subsection.kind())
216 continue;
217
219 if (auto Err = Subsection.initialize(Reader))
220 continue;
221 if (auto Err = Callback(Modi, SG, Subsection))
222 return Err;
223 }
225 });
226}
227
228}
229}
230
231#endif
This file defines the StringMap class.
dxil pretty DXIL Metadata Pretty Printer
This file defines the PointerUnion class, which is a discriminated union of pointer types.
The Input class is used to parse a yaml document into in-memory structs and vectors.
Provides read only access to a subclass of BinaryStream.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
This interface provides simple read-only access to a block of memory, and provides simple methods for...
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
StringRef - Represent a constant reference to a string, i.e.
Provides amortized O(1) random access to a CodeView type stream.
An efficient, type-erasing, non-owning reference to a callable.
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
A range adaptor for a pair of iterators.
Definition InputFile.h:40
LLVM_ABI bool hasIds() const
LLVM_ABI MemoryBuffer & unknown()
LLVM_ABI SymbolGroupIterator symbol_groups_begin()
LLVM_ABI iterator_range< SymbolGroupIterator > symbol_groups()
InputFile(InputFile &&Other)=default
LLVM_ABI StringRef getFilePath() const
LLVM_ABI codeview::LazyRandomTypeCollection & types()
static LLVM_ABI Expected< InputFile > open(StringRef Path, bool AllowUnknownFile=false)
LLVM_ABI SymbolGroupIterator symbol_groups_end()
LLVM_ABI bool isUnknown() const
LLVM_ABI bool hasTypes() const
LLVM_ABI codeview::LazyRandomTypeCollection & ids()
LLVM_ABI object::COFFObjectFile & obj()
LLVM_ABI bool isObj() const
LLVM_ABI bool isPdb() const
const FilterOptions & getFilters() const
void formatLine(const char *Fmt, Ts &&...Items)
Definition InputFile.h:134
LLVM_ABI SymbolGroupIterator & operator++()
SymbolGroupIterator(const SymbolGroupIterator &Other)=default
LLVM_ABI const SymbolGroup & operator*() const
SymbolGroupIterator & operator=(const SymbolGroupIterator &R)=default
LLVM_ABI SymbolGroupIterator()
LLVM_ABI bool operator==(const SymbolGroupIterator &R) const
Definition InputFile.h:91
LLVM_ABI Expected< StringRef > getNameFromChecksums(uint32_t Offset) const
LLVM_ABI Expected< StringRef > getNameFromStringTable(uint32_t Offset) const
LLVM_ABI SymbolGroup(InputFile *File, uint32_t GroupIndex=0)
LLVM_ABI void formatFromFileName(LinePrinter &Printer, StringRef File, bool Append=false) const
LLVM_ABI const ModuleDebugStreamRef & getPdbModuleStream() const
friend class SymbolGroupIterator
Definition InputFile.h:92
LLVM_ABI void formatFromChecksumsOffset(LinePrinter &Printer, uint32_t Offset, bool Append=false) const
codeview::DebugSubsectionArray getDebugSubsections() const
Definition InputFile.h:108
LLVM_ABI StringRef name() const
bool hasDebugStream() const
Definition InputFile.h:116
const InputFile & getFile() const
Definition InputFile.h:113
InputFile & getFile()
Definition InputFile.h:114
VarStreamArray< DebugSubsectionRecord > DebugSubsectionArray
LLVM_ABI bool shouldDumpSymbolGroup(uint32_t Idx, const SymbolGroup &Group, const FilterOptions &Filters)
PrintScope withLabelWidth(const PrintScope &Scope, uint32_t W)
LLVM_ABI Expected< ModuleDebugStreamRef > getModuleDebugStream(PDBFile &File, StringRef &ModuleName, uint32_t Index)
int NumDigits(uint64_t N)
Returns the number of digits in the given integer.
Error iterateModuleSubsections(InputFile &File, const PrintScope &HeaderScope, llvm::function_ref< Error(uint32_t, const SymbolGroup &, SubsectionT &)> Callback)
Definition InputFile.h:205
Error iterateOneModule(InputFile &File, const PrintScope &HeaderScope, const SymbolGroup &SG, uint32_t Modi, CallbackT Callback)
Definition InputFile.h:166
Error iterateSymbolGroups(InputFile &Input, const PrintScope &HeaderScope, CallbackT Callback)
Definition InputFile.h:178
This is an optimization pass for GlobalISel generic memory operations.
support::detail::AlignAdapter< T > fmt_align(T &&Item, AlignStyle Where, size_t Amount, char Fill=' ')
std::optional< uint32_t > DumpModi