LLVM: lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
22#include
23
24using namespace llvm;
28
31 std::unique_ptr Stream)
33
35
38
40 if (Error E = reloadSerialize(Reader))
41 return E;
42 }
45 "Unexpected bytes in module stream.");
47}
48
50 uint32_t SymbolSize = Mod.getSymbolDebugInfoByteSize();
51 uint32_t C11Size = Mod.getC11LineInfoByteSize();
52 uint32_t C13Size = Mod.getC13LineInfoByteSize();
53
54 if (C11Size > 0 && C13Size > 0)
56 "Module has both C11 and C13 line info");
57
59
61 return EC;
63 if (auto EC = Reader.readSubstream(SymbolsSubstream, SymbolSize))
64 return EC;
65 if (auto EC = Reader.readSubstream(C11LinesSubstream, C11Size))
66 return EC;
67 if (auto EC = Reader.readSubstream(C13LinesSubstream, C13Size))
68 return EC;
69
71 if (auto EC = SymbolReader.readArray(
72 SymbolArray, SymbolReader.bytesRemaining(), sizeof(uint32_t)))
73 return EC;
74
76 if (auto EC = SubsectionsReader.readArray(Subsections,
77 SubsectionsReader.bytesRemaining()))
78 return EC;
79
82 return EC;
83 if (auto EC = Reader.readSubstream(GlobalRefsSubstream, GlobalRefsSize))
84 return EC;
86}
87
92
94 return SymbolsSubstream;
95}
96
98 return C11LinesSubstream;
99}
100
102 return C13LinesSubstream;
103}
104
106 return GlobalRefsSubstream;
107}
108
111 return make_range(SymbolArray.begin(HadError), SymbolArray.end());
112}
113
115 auto Iter = SymbolArray.at(Offset);
116 assert(Iter != SymbolArray.end());
117 return *Iter;
118}
119
122 return make_range(Subsections.begin(), Subsections.end());
123}
124
126 return !C13LinesSubstream.empty();
127}
128
130
136 continue;
137
138 if (auto EC = Result.initialize(SS.getRecordData()))
139 return std::move(EC);
140 return Result;
141 }
142 return Result;
143}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Lightweight arrays that are backed by an arbitrary BinaryStream.
if(auto Err=PB.parsePassPipeline(MPM, Passes)) return wrap(std MPM run * Mod
Provides read only access to a subclass of BinaryStream.
LLVM_ABI Error readSubstream(BinarySubstreamRef &Ref, uint32_t Length)
Read Length bytes from the underlying stream into Ref.
Error readInteger(T &Dest)
Read an integer of the specified endianness into Dest and update the stream's offset.
uint64_t bytesRemaining() const
void setOffset(uint64_t Off)
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
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.
A Module instance is used to store all the information related to an LLVM module.
A range adaptor for a pair of iterators.
LLVM_ABI Error reload()
Definition ModuleDebugStream.cpp:36
LLVM_ABI iterator_range< codeview::CVSymbolArray::Iterator > symbols(bool *HadError) const
Definition ModuleDebugStream.cpp:110
LLVM_ABI codeview::CVSymbol readSymbolAtOffset(uint32_t Offset) const
Definition ModuleDebugStream.cpp:114
LLVM_ABI ModuleDebugStreamRef(const DbiModuleDescriptor &Module, std::unique_ptr< msf::MappedBlockStream > Stream)
LLVM_ABI bool hasDebugSubsections() const
Definition ModuleDebugStream.cpp:125
LLVM_ABI BinarySubstreamRef getSymbolsSubstream() const
Definition ModuleDebugStream.cpp:93
LLVM_ABI Error commit()
Definition ModuleDebugStream.cpp:129
LLVM_ABI BinarySubstreamRef getGlobalRefsSubstream() const
Definition ModuleDebugStream.cpp:105
LLVM_ABI Expected< codeview::DebugChecksumsSubsectionRef > findChecksumsSubsection() const
Definition ModuleDebugStream.cpp:132
LLVM_ABI BinarySubstreamRef getC11LinesSubstream() const
Definition ModuleDebugStream.cpp:97
LLVM_ABI BinarySubstreamRef getC13LinesSubstream() const
Definition ModuleDebugStream.cpp:101
LLVM_ABI const codeview::CVSymbolArray getSymbolArrayForScope(uint32_t ScopeBegin) const
Definition ModuleDebugStream.cpp:89
LLVM_ABI ~ModuleDebugStreamRef()
LLVM_ABI iterator_range< DebugSubsectionIterator > subsections() const
Definition ModuleDebugStream.cpp:121
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
VarStreamArray< CVSymbol > CVSymbolArray
CVRecord< SymbolKind > CVSymbol
LLVM_ABI CVSymbolArray limitSymbolArrayToScope(const CVSymbolArray &Symbols, uint32_t ScopeBegin)
const uint16_t kInvalidStreamIndex
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
@ Mod
The access may modify the value stored in memory.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Implement std::hash so that hash_code can be used in STL containers.
BinaryStreamRef StreamData