LLDB mainline
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
lldb_private::npdb::PdbIndex Class Reference

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
 
CompileUnitIndexcompilands ()
 
const CompileUnitIndexcompilands () const
 
lldb::addr_t MakeVirtualAddress (uint16_t segment, uint32_t offset) const
 
std::vector< SymbolAndUidFindSymbolsByVa (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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ PdbIndex()

PdbIndex::PdbIndex ( )
private

Definition at line 32 of file PdbIndex.cpp.

Referenced by create().

Member Function Documentation

◆ BuildAddrToSymbolMap()

void PdbIndex::BuildAddrToSymbolMap ( CompilandIndexItem cci)
private

◆ compilands() [1/2]

CompileUnitIndex & lldb_private::npdb::PdbIndex::compilands ( )
inline

◆ compilands() [2/2]

const CompileUnitIndex & lldb_private::npdb::PdbIndex::compilands ( ) const
inline

Definition at line 143 of file PdbIndex.h.

References m_cus.

◆ create()

llvm::Expected< std::unique_ptr< PdbIndex > > PdbIndex::create ( llvm::pdb::PDBFile *  file)
static

◆ dbi() [1/2]

llvm::pdb::DbiStream & lldb_private::npdb::PdbIndex::dbi ( )
inline

◆ dbi() [2/2]

const llvm::pdb::DbiStream & lldb_private::npdb::PdbIndex::dbi ( ) const
inline

Definition at line 122 of file PdbIndex.h.

References m_dbi.

◆ FindSymbolsByVa()

std::vector< SymbolAndUid > PdbIndex::FindSymbolsByVa ( lldb::addr_t  va)

◆ GetLoadAddress()

lldb::addr_t lldb_private::npdb::PdbIndex::GetLoadAddress ( ) const
inline

Definition at line 115 of file PdbIndex.h.

References m_load_address.

Referenced by GetFrameDataProgram().

◆ GetModuleIndexForAddr()

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().

◆ GetModuleIndexForVa()

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().

◆ globals() [1/2]

llvm::pdb::GlobalsStream & lldb_private::npdb::PdbIndex::globals ( )
inline

Definition at line 136 of file PdbIndex.h.

References m_globals.

◆ globals() [2/2]

const llvm::pdb::GlobalsStream & lldb_private::npdb::PdbIndex::globals ( ) const
inline

Definition at line 137 of file PdbIndex.h.

References m_globals.

◆ info() [1/2]

llvm::pdb::InfoStream & lldb_private::npdb::PdbIndex::info ( )
inline

Definition at line 130 of file PdbIndex.h.

References m_info.

◆ info() [2/2]

const llvm::pdb::InfoStream & lldb_private::npdb::PdbIndex::info ( ) const
inline

Definition at line 131 of file PdbIndex.h.

References m_info.

◆ ipi() [1/2]

llvm::pdb::TpiStream & lldb_private::npdb::PdbIndex::ipi ( )
inline

◆ ipi() [2/2]

const llvm::pdb::TpiStream & lldb_private::npdb::PdbIndex::ipi ( ) const
inline

Definition at line 128 of file PdbIndex.h.

References m_ipi.

◆ MakeVirtualAddress()

lldb::addr_t PdbIndex::MakeVirtualAddress ( uint16_t  segment,
uint32_t  offset 
) const

◆ ParseSectionContribs()

void PdbIndex::ParseSectionContribs ( )

Definition at line 89 of file PdbIndex.cpp.

References dbi(), LLDB_INVALID_ADDRESS, m_va_to_modi, and MakeVirtualAddress().

◆ pdb() [1/2]

llvm::pdb::PDBFile & lldb_private::npdb::PdbIndex::pdb ( )
inline

◆ pdb() [2/2]

const llvm::pdb::PDBFile & lldb_private::npdb::PdbIndex::pdb ( ) const
inline

Definition at line 119 of file PdbIndex.h.

References m_file.

◆ publics() [1/2]

llvm::pdb::PublicsStream & lldb_private::npdb::PdbIndex::publics ( )
inline

Definition at line 133 of file PdbIndex.h.

References m_publics.

◆ publics() [2/2]

const llvm::pdb::PublicsStream & lldb_private::npdb::PdbIndex::publics ( ) const
inline

Definition at line 134 of file PdbIndex.h.

References m_publics.

◆ ReadSymbolRecord() [1/2]

CVSymbol PdbIndex::ReadSymbolRecord ( PdbCompilandSymId  cu_sym) const

◆ ReadSymbolRecord() [2/2]

CVSymbol PdbIndex::ReadSymbolRecord ( PdbGlobalSymId  global) const

Definition at line 194 of file PdbIndex.cpp.

References lldb_private::npdb::PdbGlobalSymId::offset, and symrecords().

◆ SetLoadAddress()

void lldb_private::npdb::PdbIndex::SetLoadAddress ( lldb::addr_t  addr)
inline

Definition at line 114 of file PdbIndex.h.

References m_load_address.

◆ symrecords() [1/2]

llvm::pdb::SymbolStream & lldb_private::npdb::PdbIndex::symrecords ( )
inline

Definition at line 139 of file PdbIndex.h.

References m_symrecords.

Referenced by ReadSymbolRecord().

◆ symrecords() [2/2]

const llvm::pdb::SymbolStream & lldb_private::npdb::PdbIndex::symrecords ( ) const
inline

Definition at line 140 of file PdbIndex.h.

References m_symrecords.

◆ tpi() [1/2]

llvm::pdb::TpiStream & lldb_private::npdb::PdbIndex::tpi ( )
inline

◆ tpi() [2/2]

const llvm::pdb::TpiStream & lldb_private::npdb::PdbIndex::tpi ( ) const
inline

Definition at line 125 of file PdbIndex.h.

References m_tpi.

Member Data Documentation

◆ m_allocator

llvm::IntervalMap<lldb::addr_t,uint32_t>::Allocator lldb_private::npdb::PdbIndex::m_allocator
private

An allocator for the interval maps.

Definition at line 99 of file PdbIndex.h.

◆ m_cus

CompileUnitIndex lldb_private::npdb::PdbIndex::m_cus
private

Index of all compile units, mapping identifier to |CompilandIndexItem| instance.

Definition at line 96 of file PdbIndex.h.

Referenced by compilands().

◆ m_dbi

llvm::pdb::DbiStream* lldb_private::npdb::PdbIndex::m_dbi = nullptr
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().

◆ m_file

llvm::pdb::PDBFile* lldb_private::npdb::PdbIndex::m_file = nullptr
private

The underlying PDB file.

Definition at line 50 of file PdbIndex.h.

Referenced by pdb().

◆ m_globals

llvm::pdb::GlobalsStream* lldb_private::npdb::PdbIndex::m_globals = nullptr
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().

◆ m_info

llvm::pdb::InfoStream* lldb_private::npdb::PdbIndex::m_info = nullptr
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().

◆ m_ipi

llvm::pdb::TpiStream* lldb_private::npdb::PdbIndex::m_ipi = nullptr
private

Definition at line 65 of file PdbIndex.h.

Referenced by ipi().

◆ m_load_address

lldb::addr_t lldb_private::npdb::PdbIndex::m_load_address = 0
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().

◆ m_publics

llvm::pdb::PublicsStream* lldb_private::npdb::PdbIndex::m_publics = nullptr
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().

◆ m_symrecords

llvm::pdb::SymbolStream* lldb_private::npdb::PdbIndex::m_symrecords = nullptr
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().

◆ m_tpi

llvm::pdb::TpiStream* lldb_private::npdb::PdbIndex::m_tpi = nullptr
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().

◆ m_va_to_modi

llvm::IntervalMap<lldb::addr_t, uint16_t> lldb_private::npdb::PdbIndex::m_va_to_modi
private

Maps virtual address to module index.

Definition at line 102 of file PdbIndex.h.

Referenced by GetModuleIndexForVa(), and ParseSectionContribs().


The documentation for this class was generated from the following files: