35 using namespace llvm::msf;
36 using namespace llvm::pdb;
41 static const struct BuiltinTypeEntry {
60 NativeSession::NativeSession(std::unique_ptr<PDBFile> PdbFile,
61 std::unique_ptr<BumpPtrAllocator>
Allocator)
62 : Pdb(std::move(PdbFile)), Allocator(std::move(Allocator)) {}
67 std::unique_ptr<IPDBSession> &Session) {
74 std::unique_ptr<MemoryBuffer> Buffer = std::move(*ErrorOrBuffer);
75 auto Stream = llvm::make_unique<MemoryBufferByteStream>(
78 auto Allocator = llvm::make_unique<BumpPtrAllocator>();
79 auto File = llvm::make_unique<PDBFile>(Path, std::move(Stream), *Allocator);
80 if (
auto EC = File->parseFileHeaders())
82 if (
auto EC = File->parseStreamData())
86 llvm::make_unique<NativeSession>(std::move(File), std::move(Allocator));
92 std::unique_ptr<IPDBSession> &Session) {
96 std::unique_ptr<PDBSymbolCompiland>
98 const auto Id =
static_cast<SymIndexId>(SymbolCache.size());
99 SymbolCache.push_back(
100 llvm::make_unique<NativeCompilandSymbol>(*
this,
Id, MI));
101 return llvm::make_unique<PDBSymbolCompiland>(
102 *
this, std::unique_ptr<IPDBRawSymbol>(SymbolCache[
Id]->clone()));
107 const auto Entry = TypeIndexToSymbolId.find(Index);
108 if (Entry != TypeIndexToSymbolId.end())
109 return Entry->second;
120 [
Kind](
const BuiltinTypeEntry &Builtin) {
121 return Builtin.Kind ==
Kind;
126 SymbolCache.emplace_back(
127 llvm::make_unique<NativeBuiltinSymbol>(*
this, Id, It->Type, It->Size));
128 TypeIndexToSymbolId[Index] =
Id;
142 const auto Id =
static_cast<SymIndexId>(SymbolCache.size());
143 SymbolCache.push_back(llvm::make_unique<NativeExeSymbol>(*
this,
Id));
144 auto RawSymbol = SymbolCache[
Id]->clone();
146 std::unique_ptr<PDBSymbolExe> ExeSymbol(
147 static_cast<PDBSymbolExe *>(PdbSymbol.release()));
151 std::unique_ptr<PDBSymbol>
154 return SymbolId < SymbolCache.size()
159 std::unique_ptr<PDBSymbol>
164 std::unique_ptr<IPDBEnumLineNumbers>
170 std::unique_ptr<IPDBEnumLineNumbers>
176 std::unique_ptr<IPDBEnumSourceFiles>
183 std::unique_ptr<IPDBSourceFile>
190 std::unique_ptr<IPDBEnumChildren<PDBSymbolCompiland>>
196 std::unique_ptr<PDBSymbolCompiland>
211 std::unique_ptr<IPDBSourceFile>
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.
Represents either an error or a value T.
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
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
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)
static Error createFromPdb(StringRef Path, std::unique_ptr< IPDBSession > &Session)
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...
uint64_t getLoadAddress() const override
SimpleTypeKind getSimpleKind() const
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbers(const PDBSymbolCompiland &Compiland, const IPDBSourceFile &File) const override
static ErrorSuccess success()
Create a success value.
std::unique_ptr< IPDBEnumSourceFiles > getSourceFilesForCompiland(const PDBSymbolCompiland &Compiland) const override
std::unique_ptr< PDBSymbolExe > getGlobalScope() override
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFileOrSTDIN(const Twine &Filename, int64_t FileSize=-1, bool RequiresNullTerminator=true)
Open the specified file as a MemoryBuffer, or open stdin if the Filename is "-".
static std::vector< std::string > Flags
~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
void setLoadAddress(uint64_t Address) override
Lightweight error class with error context and mandatory checking.
SimpleTypeMode getSimpleMode() const
SymIndexId findSymbolByTypeIndex(codeview::TypeIndex TI)
StringRef - Represent a constant reference to a string, i.e.
std::unique_ptr< IPDBEnumDataStreams > getDebugStreams() const override
auto find_if(R &&Range, UnaryPredicate P) -> decltype(std::begin(Range))
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly...
std::unique_ptr< PDBSymbol > getSymbolById(uint32_t SymbolId) const override