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>

Collaboration diagram for lldb_private::npdb::PdbIndex:
Collaboration graph
[legend]

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
 
lldb::addr_t MakeVirtualAddress (const SegmentOffset &so) const
 
std::vector< SymbolAndUidFindSymbolsByVa (lldb::addr_t va)
 
llvm::codeview::CVSymbol ReadSymbolRecord (PdbCompilandSymId cu_sym) const
 
llvm::codeview::CVSymbol ReadSymbolRecord (PdbGlobalSymId global) const
 
llvm::Optional< uint16_tGetModuleIndexForAddr (uint16_t segment, uint32_t offset) const
 
llvm::Optional< uint16_tGetModuleIndexForVa (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. More...
 
llvm::pdb::DbiStream * m_dbi = nullptr
 The DBI stream. More...
 
llvm::pdb::TpiStream * m_tpi = nullptr
 TPI (types) and IPI (indices) streams. More...
 
llvm::pdb::TpiStream * m_ipi = nullptr
 
llvm::pdb::InfoStream * m_info = nullptr
 This is called the "PDB Stream" in the Microsoft reference implementation. More...
 
llvm::pdb::PublicsStream * m_publics = nullptr
 Publics stream. More...
 
llvm::pdb::GlobalsStream * m_globals = nullptr
 Globals stream. More...
 
llvm::pdb::SymbolStream * m_symrecords = nullptr
 Symbol records stream. More...
 
CompileUnitIndex m_cus
 Index of all compile units, mapping identifier to |CompilandIndexItem| instance. More...
 
llvm::IntervalMap< lldb::addr_t, uint32_t >::Allocator m_allocator
 An allocator for the interval maps. More...
 
llvm::IntervalMap< lldb::addr_t, uint16_tm_va_to_modi
 Maps virtual address to module index. More...
 
lldb::addr_t m_load_address = 0
 The address at which the program has been loaded into memory. More...
 

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 48 of file PdbIndex.h.

Constructor & Destructor Documentation

◆ PdbIndex()

PdbIndex::PdbIndex ( )
private

Definition at line 31 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 144 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 123 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 116 of file PdbIndex.h.

References m_load_address.

Referenced by GetFrameDataProgram().

◆ GetModuleIndexForAddr()

llvm::Optional< uint16_t > PdbIndex::GetModuleIndexForAddr ( uint16_t  segment,
uint32_t  offset 
) const

Definition at line 84 of file PdbIndex.cpp.

References GetModuleIndexForVa(), and MakeVirtualAddress().

◆ GetModuleIndexForVa()

llvm::Optional< uint16_t > PdbIndex::GetModuleIndexForVa ( lldb::addr_t  va) const

Definition at line 88 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 137 of file PdbIndex.h.

References m_globals.

◆ globals() [2/2]

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

Definition at line 138 of file PdbIndex.h.

References m_globals.

◆ info() [1/2]

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

Definition at line 131 of file PdbIndex.h.

References m_info.

◆ info() [2/2]

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

Definition at line 132 of file PdbIndex.h.

References m_info.

◆ ipi() [1/2]

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

Definition at line 128 of file PdbIndex.h.

References m_ipi.

Referenced by lldb_private::npdb::CompileUnitIndex::GetMainSourceFile(), and ParseBuildInfo().

◆ ipi() [2/2]

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

Definition at line 129 of file PdbIndex.h.

References m_ipi.

◆ MakeVirtualAddress() [1/2]

lldb::addr_t PdbIndex::MakeVirtualAddress ( const SegmentOffset so) const

◆ MakeVirtualAddress() [2/2]

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

◆ ParseSectionContribs()

void PdbIndex::ParseSectionContribs ( )

Definition at line 96 of file PdbIndex.cpp.

References dbi(), 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 120 of file PdbIndex.h.

References m_file.

◆ publics() [1/2]

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

Definition at line 134 of file PdbIndex.h.

References m_publics.

Referenced by lldb_private::npdb::PdbAstBuilder::GetParentDeclContextForSymbol().

◆ publics() [2/2]

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

Definition at line 135 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 115 of file PdbIndex.h.

References m_load_address.

◆ symrecords() [1/2]

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

◆ symrecords() [2/2]

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

Definition at line 141 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 126 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 100 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 97 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 58 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 51 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 85 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 71 of file PdbIndex.h.

Referenced by info().

◆ m_ipi

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

Definition at line 66 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 106 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 78 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 93 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 65 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 103 of file PdbIndex.h.

Referenced by GetModuleIndexForVa(), and ParseSectionContribs().


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