LLDB mainline
|
PdbIndex - Lazy access to the important parts of a PDB file. More...
#include <PdbIndex.h>
Public Member Functions | |
void | SetLoadAddress (lldb::addr_t addr) |
lldb::addr_t | GetLoadAddress () const |
void | ParseSectionContribs () |
llvm::pdb::PDBFile & | pdb () |
const llvm::pdb::PDBFile & | pdb () const |
llvm::pdb::DbiStream & | dbi () |
const llvm::pdb::DbiStream & | dbi () const |
llvm::pdb::TpiStream & | tpi () |
const llvm::pdb::TpiStream & | tpi () const |
llvm::pdb::TpiStream & | ipi () |
const llvm::pdb::TpiStream & | ipi () const |
llvm::pdb::InfoStream & | info () |
const llvm::pdb::InfoStream & | info () const |
llvm::pdb::PublicsStream & | publics () |
const llvm::pdb::PublicsStream & | publics () const |
llvm::pdb::GlobalsStream & | globals () |
const llvm::pdb::GlobalsStream & | globals () const |
llvm::pdb::SymbolStream & | symrecords () |
const llvm::pdb::SymbolStream & | symrecords () const |
CompileUnitIndex & | compilands () |
const CompileUnitIndex & | compilands () const |
lldb::addr_t | MakeVirtualAddress (uint16_t segment, uint32_t offset) const |
std::vector< SymbolAndUid > | FindSymbolsByVa (lldb::addr_t va) |
llvm::codeview::CVSymbol | ReadSymbolRecord (PdbCompilandSymId cu_sym) const |
llvm::codeview::CVSymbol | ReadSymbolRecord (PdbGlobalSymId global) const |
std::optional< uint16_t > | GetModuleIndexForAddr (uint16_t segment, uint32_t offset) const |
std::optional< uint16_t > | GetModuleIndexForVa (lldb::addr_t va) const |
Static Public Member Functions | |
static llvm::Expected< std::unique_ptr< PdbIndex > > | create (llvm::pdb::PDBFile *) |
Private Member Functions | |
PdbIndex () | |
void | BuildAddrToSymbolMap (CompilandIndexItem &cci) |
Private Attributes | |
llvm::pdb::PDBFile * | m_file = nullptr |
The underlying PDB file. | |
llvm::pdb::DbiStream * | m_dbi = nullptr |
The DBI stream. | |
llvm::pdb::TpiStream * | m_tpi = nullptr |
TPI (types) and IPI (indices) streams. | |
llvm::pdb::TpiStream * | m_ipi = nullptr |
llvm::pdb::InfoStream * | m_info = nullptr |
This is called the "PDB Stream" in the Microsoft reference implementation. | |
llvm::pdb::PublicsStream * | m_publics = nullptr |
Publics stream. | |
llvm::pdb::GlobalsStream * | m_globals = nullptr |
Globals stream. | |
llvm::pdb::SymbolStream * | m_symrecords = nullptr |
Symbol records stream. | |
CompileUnitIndex | m_cus |
Index of all compile units, mapping identifier to |CompilandIndexItem| instance. | |
llvm::IntervalMap< lldb::addr_t, uint32_t >::Allocator | m_allocator |
An allocator for the interval maps. | |
llvm::IntervalMap< lldb::addr_t, uint16_t > | m_va_to_modi |
Maps virtual address to module index. | |
lldb::addr_t | m_load_address = 0 |
The address at which the program has been loaded into memory. | |
PdbIndex - Lazy access to the important parts of a PDB file.
This is a layer on top of LLVM's native PDB support libraries which cache certain data when it is accessed the first time. The entire PDB file is mapped into memory, and the underlying support libraries vend out memory that is always backed by the file, so it is safe to hold StringRefs and ArrayRefs into the backing memory as long as the PdbIndex instance is alive.
Definition at line 47 of file PdbIndex.h.
|
private |
Definition at line 32 of file PdbIndex.cpp.
Referenced by create().
|
private |
Definition at line 116 of file PdbIndex.cpp.
References lldb_private::npdb::GetSegmentAndOffset(), LLDB_INVALID_ADDRESS, lldbassert, lldb_private::npdb::CompilandIndexItem::m_debug_stream, lldb_private::npdb::CompilandIndexItem::m_id, lldb_private::npdb::CompilandIndexItem::m_symbols_by_va, MakeVirtualAddress(), lldb_private::npdb::PdbCompilandId::modi, lldb_private::npdb::SegmentOffset::offset, lldb_private::npdb::SegmentOffset::segment, and lldb_private::npdb::SymbolHasAddress().
Referenced by FindSymbolsByVa().
|
inline |
Definition at line 142 of file PdbIndex.h.
References m_cus.
Referenced by lldb_private::npdb::PdbAstBuilder::CreateFunctionParameters(), FindSymbolsByVa(), GetBaseFrameRegister(), lldb_private::npdb::PdbAstBuilder::GetOrCreateInlinedFunctionDecl(), lldb_private::npdb::PdbAstBuilder::ParseAllFunctionsAndNonLocalVars(), lldb_private::npdb::PdbAstBuilder::ParseBlockChildren(), and ReadSymbolRecord().
|
inline |
Definition at line 143 of file PdbIndex.h.
References m_cus.
|
static |
Definition at line 43 of file PdbIndex.cpp.
References ASSIGN_PTR_OR_RETURN, lldbassert, and PdbIndex().
Referenced by lldb_private::npdb::SymbolFileNativePDB::CalculateAbilities().
|
inline |
Definition at line 121 of file PdbIndex.h.
References m_dbi.
Referenced by GetFrameDataProgram(), lldb_private::npdb::CompileUnitIndex::GetOrCreateCompiland(), MakeVirtualAddress(), lldb_private::npdb::PdbAstBuilder::ParseAllFunctionsAndNonLocalVars(), and ParseSectionContribs().
|
inline |
Definition at line 122 of file PdbIndex.h.
References m_dbi.
std::vector< SymbolAndUid > PdbIndex::FindSymbolsByVa | ( | lldb::addr_t | va | ) |
Definition at line 138 of file PdbIndex.cpp.
References BuildAddrToSymbolMap(), compilands(), GetModuleIndexForVa(), lldb_private::npdb::CompileUnitIndex::GetOrCreateCompiland(), lldb_private::npdb::GetSegmentAndOffset(), lldb_private::npdb::GetSegmentOffsetAndLength(), lldb_private::npdb::SegmentOffsetLength::length, LLDB_INVALID_ADDRESS, lldb_private::npdb::CompilandIndexItem::m_symbols_by_va, MakeVirtualAddress(), lldb_private::npdb::SegmentOffset::offset, ReadSymbolRecord(), lldb_private::npdb::SegmentOffset::segment, lldb_private::npdb::SegmentOffsetLength::so, and lldb_private::npdb::SymbolIsCode().
|
inline |
Definition at line 115 of file PdbIndex.h.
References m_load_address.
Referenced by GetFrameDataProgram().
std::optional< uint16_t > PdbIndex::GetModuleIndexForAddr | ( | uint16_t | segment, |
uint32_t | offset | ||
) | const |
Definition at line 76 of file PdbIndex.cpp.
References GetModuleIndexForVa(), and MakeVirtualAddress().
std::optional< uint16_t > PdbIndex::GetModuleIndexForVa | ( | lldb::addr_t | va | ) | const |
Definition at line 81 of file PdbIndex.cpp.
References m_va_to_modi.
Referenced by FindSymbolsByVa(), and GetModuleIndexForAddr().
|
inline |
Definition at line 136 of file PdbIndex.h.
References m_globals.
|
inline |
Definition at line 137 of file PdbIndex.h.
References m_globals.
|
inline |
Definition at line 130 of file PdbIndex.h.
References m_info.
|
inline |
Definition at line 131 of file PdbIndex.h.
References m_info.
|
inline |
Definition at line 127 of file PdbIndex.h.
References m_ipi.
Referenced by lldb_private::npdb::PdbAstBuilder::CreateFunctionDeclFromId(), lldb_private::npdb::CompileUnitIndex::GetMainSourceFile(), and ParseBuildInfo().
|
inline |
Definition at line 128 of file PdbIndex.h.
References m_ipi.
lldb::addr_t PdbIndex::MakeVirtualAddress | ( | uint16_t | segment, |
uint32_t | offset | ||
) | const |
Definition at line 62 of file PdbIndex.cpp.
References dbi(), LLDB_INVALID_ADDRESS, and m_load_address.
Referenced by BuildAddrToSymbolMap(), FindSymbolsByVa(), GetModuleIndexForAddr(), MakeRangeList(), and ParseSectionContribs().
void PdbIndex::ParseSectionContribs | ( | ) |
Definition at line 89 of file PdbIndex.cpp.
References dbi(), LLDB_INVALID_ADDRESS, m_va_to_modi, and MakeVirtualAddress().
|
inline |
Definition at line 118 of file PdbIndex.h.
References m_file.
Referenced by GetFrameDataProgram(), and lldb_private::npdb::CompileUnitIndex::GetOrCreateCompiland().
|
inline |
Definition at line 119 of file PdbIndex.h.
References m_file.
|
inline |
Definition at line 133 of file PdbIndex.h.
References m_publics.
|
inline |
Definition at line 134 of file PdbIndex.h.
References m_publics.
CVSymbol PdbIndex::ReadSymbolRecord | ( | PdbCompilandSymId | cu_sym | ) | const |
Definition at line 187 of file PdbIndex.cpp.
References compilands(), lldb_private::npdb::CompileUnitIndex::GetCompiland(), lldbassert, lldb_private::npdb::CompilandIndexItem::m_debug_stream, lldb_private::npdb::PdbCompilandSymId::modi, and lldb_private::npdb::PdbCompilandSymId::offset.
Referenced by FindSymbolsByVa(), GetBaseFrameRegister(), lldb_private::npdb::PdbAstBuilder::GetOrCreateFunctionDecl(), lldb_private::npdb::PdbAstBuilder::GetOrCreateSymbolForId(), lldb_private::npdb::PdbAstBuilder::GetOrCreateTypedefDecl(), lldb_private::npdb::PdbAstBuilder::GetOrCreateVariableDecl(), lldb_private::npdb::PdbAstBuilder::GetParentDeclContext(), lldb_private::npdb::GetVariableLocationInfo(), and lldb_private::npdb::PdbAstBuilder::ParseBlockChildren().
CVSymbol PdbIndex::ReadSymbolRecord | ( | PdbGlobalSymId | global | ) | const |
Definition at line 194 of file PdbIndex.cpp.
References lldb_private::npdb::PdbGlobalSymId::offset, and symrecords().
|
inline |
Definition at line 114 of file PdbIndex.h.
References m_load_address.
|
inline |
Definition at line 139 of file PdbIndex.h.
References m_symrecords.
Referenced by ReadSymbolRecord().
|
inline |
Definition at line 140 of file PdbIndex.h.
References m_symrecords.
|
inline |
Definition at line 124 of file PdbIndex.h.
References m_tpi.
Referenced by lldb_private::npdb::UdtRecordCompleter::AddBaseClassForTypeIndex(), lldb_private::npdb::SymbolFileNativePDB::BuildParentMap(), lldb_private::npdb::PdbAstBuilder::CompleteTagDecl(), lldb_private::npdb::PdbAstBuilder::CreateArrayType(), lldb_private::npdb::PdbAstBuilder::CreateDeclInfoForUndecoratedName(), lldb_private::npdb::PdbAstBuilder::CreateFunctionDecl(), lldb_private::npdb::PdbAstBuilder::CreateFunctionType(), lldb_private::npdb::PdbAstBuilder::CreateType(), lldb_private::npdb::PdbAstBuilder::GetOrCreateType(), lldb_private::npdb::GetVariableLocationInfo(), lldb_private::npdb::PdbAstBuilder::ParseAllTypes(), lldb_private::npdb::PdbAstBuilder::ParseNamespace(), and lldb_private::npdb::UdtRecordCompleter::UdtRecordCompleter().
|
inline |
Definition at line 125 of file PdbIndex.h.
References m_tpi.
|
private |
An allocator for the interval maps.
Definition at line 99 of file PdbIndex.h.
|
private |
Index of all compile units, mapping identifier to |CompilandIndexItem| instance.
Definition at line 96 of file PdbIndex.h.
Referenced by compilands().
|
private |
The DBI stream.
This contains general high level information about the features present in the PDB file, compile units (such as the information necessary to locate full symbol information for each compile unit), section contributions, and other data which is not specifically symbol or type records.
Definition at line 57 of file PdbIndex.h.
Referenced by dbi().
|
private |
|
private |
Globals stream.
Contrary to its name, this does not contain information about all "global variables" or "global functions". Rather, it is the "global symbol table", i.e. it contains information about every symbol in the executable. It is a hash table keyed on name, whose values are indices into the symbol records stream to find the full record.
Definition at line 84 of file PdbIndex.h.
Referenced by globals().
|
private |
This is called the "PDB Stream" in the Microsoft reference implementation.
It contains information about the structure of the file, as well as fields used to match EXE and PDB.
Definition at line 70 of file PdbIndex.h.
Referenced by info().
|
private |
Definition at line 65 of file PdbIndex.h.
Referenced by ipi().
|
private |
The address at which the program has been loaded into memory.
Definition at line 105 of file PdbIndex.h.
Referenced by GetLoadAddress(), MakeVirtualAddress(), and SetLoadAddress().
|
private |
Publics stream.
Is actually a serialized hash table where the keys are addresses of symbols in the executable, and values are a record containing mangled names and an index which can be used to locate more detailed info about the symbol in the Symbol Records stream. The publics stream only contains info about externally visible symbols.
Definition at line 77 of file PdbIndex.h.
Referenced by publics().
|
private |
Symbol records stream.
The publics and globals stream refer to records in this stream. For some records, like constants and typedefs, the complete record lives in this stream. For other symbol types, such as functions, data, and other things that have been materialied into a specific compile unit, the records here simply provide a reference necessary to locate the full information.
Definition at line 92 of file PdbIndex.h.
Referenced by symrecords().
|
private |
TPI (types) and IPI (indices) streams.
These are both in the exact same format with different data. Most type records are stored in the TPI stream but certain specific types of records are stored in the IPI stream. The IPI stream records can refer to the records in the TPI stream, but not the other way around.
Definition at line 64 of file PdbIndex.h.
Referenced by tpi().
|
private |
Maps virtual address to module index.
Definition at line 102 of file PdbIndex.h.
Referenced by GetModuleIndexForVa(), and ParseSectionContribs().