46 static const struct BuiltinTypeEntry {
65 NativeSession::NativeSession(std::unique_ptr<PDBFile> PdbFile,
66 std::unique_ptr<BumpPtrAllocator>
Allocator)
67 : Pdb(
std::move(PdbFile)), Allocator(
std::move(Allocator)) {}
72 std::unique_ptr<IPDBSession> &Session) {
73 StringRef Path = Buffer->getBufferIdentifier();
74 auto Stream = llvm::make_unique<MemoryBufferByteStream>(
77 auto Allocator = llvm::make_unique<BumpPtrAllocator>();
78 auto File = llvm::make_unique<PDBFile>(Path, std::move(Stream), *Allocator);
79 if (
auto EC = File->parseFileHeaders())
81 if (
auto EC = File->parseStreamData())
85 llvm::make_unique<NativeSession>(std::move(File), std::move(Allocator));
91 std::unique_ptr<IPDBSession> &Session) {
95 std::unique_ptr<PDBSymbolCompiland>
97 const auto Id =
static_cast<SymIndexId>(SymbolCache.size());
98 SymbolCache.push_back(
99 llvm::make_unique<NativeCompilandSymbol>(*
this,
Id, MI));
100 return llvm::make_unique<PDBSymbolCompiland>(
101 *
this, std::unique_ptr<IPDBRawSymbol>(SymbolCache[
Id]->clone()));
104 std::unique_ptr<PDBSymbolTypeEnum>
107 return llvm::make_unique<PDBSymbolTypeEnum>(
108 *
this, std::unique_ptr<IPDBRawSymbol>(SymbolCache[
Id]->clone()));
111 std::unique_ptr<IPDBEnumSymbols>
113 auto Tpi = Pdb->getPDBTpiStream();
118 auto &Types = Tpi->typeCollection();
119 return std::unique_ptr<IPDBEnumSymbols>(
125 const auto Entry = TypeIndexToSymbolId.find(Index);
126 if (Entry != TypeIndexToSymbolId.end())
127 return Entry->second;
138 [
Kind](
const BuiltinTypeEntry &Builtin) {
139 return Builtin.Kind ==
Kind;
144 SymbolCache.emplace_back(
145 llvm::make_unique<NativeBuiltinSymbol>(*
this, Id, It->Type, It->Size));
146 TypeIndexToSymbolId[
Index] =
Id;
151 auto Tpi = Pdb->getPDBTpiStream();
156 auto &Types = Tpi->typeCollection();
157 const auto &
I = Types.getType(Index);
158 const auto Id =
static_cast<SymIndexId>(SymbolCache.size());
160 assert(
I.kind() == codeview::LF_ENUM);
161 SymbolCache.emplace_back(llvm::make_unique<NativeEnumSymbol>(*
this,
Id,
I));
162 TypeIndexToSymbolId[
Index] =
Id;
171 const auto Id =
static_cast<SymIndexId>(SymbolCache.size());
172 SymbolCache.push_back(llvm::make_unique<NativeExeSymbol>(*
this,
Id));
173 auto RawSymbol = SymbolCache[
Id]->clone();
175 std::unique_ptr<PDBSymbolExe> ExeSymbol(
176 static_cast<PDBSymbolExe *>(PdbSymbol.release()));
180 std::unique_ptr<PDBSymbol>
183 return SymbolId < SymbolCache.size()
198 std::unique_ptr<PDBSymbol>
203 std::unique_ptr<PDBSymbol>
208 std::unique_ptr<PDBSymbol>
214 std::unique_ptr<IPDBEnumLineNumbers>
220 std::unique_ptr<IPDBEnumLineNumbers>
226 std::unique_ptr<IPDBEnumLineNumbers>
231 std::unique_ptr<IPDBEnumLineNumbers>
237 std::unique_ptr<IPDBEnumSourceFiles>
244 std::unique_ptr<IPDBSourceFile>
251 std::unique_ptr<IPDBEnumChildren<PDBSymbolCompiland>>
257 std::unique_ptr<PDBSymbolCompiland>
272 std::unique_ptr<IPDBSourceFile>
285 std::unique_ptr<IPDBEnumInjectedSources>
290 std::unique_ptr<IPDBEnumSectionContribs>
std::unique_ptr< IPDBEnumSourceFiles > getAllSourceFiles() const override
static Error createFromExe(StringRef Path, std::unique_ptr< IPDBSession > &Session)
const_iterator end(StringRef path)
Get end iterator over path.
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersBySectOffset(uint32_t Section, uint32_t Offset, uint32_t Length) const override
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Compute iterated dominance frontiers using a linear time algorithm.
std::unique_ptr< IPDBEnumSectionContribs > getSectionContribs() const override
TypeLeafKind
Duplicate copy of the above enum, but using the official CV names.
SimpleTypeKind getSimpleKind() const
PDB_NameSearchFlags
Defines flags used for enumerating child symbols.
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
std::unique_ptr< PDBSymbol > findSymbolByAddress(uint64_t Address, PDB_SymType Type) const override
SimpleTypeMode getSimpleMode() const
IPDBSourceFile defines an interface used to represent source files whose information are stored in th...
std::unique_ptr< IPDBEnumSourceFiles > findSourceFiles(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
static std::unique_ptr< PDBSymbol > create(const IPDBSession &PDBSession, std::unique_ptr< IPDBRawSymbol > Symbol)
std::unique_ptr< IPDBEnumTables > getEnumTables() const override
std::unique_ptr< PDBSymbolTypeEnum > createEnumSymbol(codeview::TypeIndex Index)
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersByRVA(uint32_t RVA, uint32_t Length) const override
PDB_SymType
These values correspond to the SymTagEnum enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/bkedss5f.aspx.
* if(!EatIfPresent(lltok::kw_thread_local)) return false
ParseOptionalThreadLocal := /*empty.
The instances of the Type class are immutable: once they are created, they are never changed...
std::unique_ptr< PDBSymbol > findSymbolByRVA(uint32_t RVA, PDB_SymType Type) const override
uint64_t getLoadAddress() const override
auto find_if(R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range))
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly...
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbers(const PDBSymbolCompiland &Compiland, const IPDBSourceFile &File) const override
void consumeError(Error Err)
Consume a Error without doing anything.
std::unique_ptr< PDBSymbol > findSymbolBySectOffset(uint32_t Sect, uint32_t Offset, PDB_SymType Type) const override
static ErrorSuccess success()
Create a success value.
std::unique_ptr< IPDBEnumSourceFiles > getSourceFilesForCompiland(const PDBSymbolCompiland &Compiland) const override
std::unique_ptr< IPDBEnumSymbols > createTypeEnumerator(codeview::TypeLeafKind Kind)
std::unique_ptr< PDBSymbolExe > getGlobalScope() override
bool setLoadAddress(uint64_t Address) override
~NativeSession() override
std::unique_ptr< PDBSymbolCompiland > createCompilandSymbol(DbiModuleDescriptor MI)
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersByAddress(uint64_t Address, uint32_t Length) const override
std::unique_ptr< PDBSymbolCompiland > findOneCompilandForSourceFile(llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
std::unique_ptr< IPDBSourceFile > getSourceFileById(uint32_t FileId) const override
PDB_BuiltinType
These values correspond to the Basictype enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/4szdtzc3.aspx.
std::unique_ptr< IPDBEnumChildren< PDBSymbolCompiland > > findCompilandsForSourceFile(llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Provides ErrorOr<T> smart pointer.
std::unique_ptr< IPDBSourceFile > findOneSourceFile(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
Lightweight error class with error context and mandatory checking.
SymIndexId findSymbolByTypeIndex(codeview::TypeIndex TI)
static Error createFromPdb(std::unique_ptr< MemoryBuffer > MB, std::unique_ptr< IPDBSession > &Session)
bool addressForRVA(uint32_t RVA, uint32_t &Section, uint32_t &Offset) const override
StringRef - Represent a constant reference to a string, i.e.
std::unique_ptr< IPDBEnumDataStreams > getDebugStreams() const override
bool addressForVA(uint64_t VA, uint32_t &Section, uint32_t &Offset) const override
std::unique_ptr< IPDBEnumInjectedSources > getInjectedSources() const override
std::unique_ptr< PDBSymbol > getSymbolById(uint32_t SymbolId) const override