LLDB mainline
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
lldb_private::plugin::dwarf::DebugNamesDWARFIndex Class Reference

#include <DebugNamesDWARFIndex.h>

Inheritance diagram for lldb_private::plugin::dwarf::DebugNamesDWARFIndex:
Inheritance graph
[legend]

Public Member Functions

void Preload () override
 
void GetGlobalVariables (ConstString basename, llvm::function_ref< bool(DWARFDIE die)> callback) override
 Finds global variables with the given base name.
 
void GetGlobalVariables (const RegularExpression &regex, llvm::function_ref< bool(DWARFDIE die)> callback) override
 
void GetGlobalVariables (DWARFUnit &cu, llvm::function_ref< bool(DWARFDIE die)> callback) override
 cu must be the skeleton unit if possible, not GetNonSkeletonUnit().
 
void GetObjCMethods (ConstString class_name, llvm::function_ref< bool(DWARFDIE die)> callback) override
 
void GetCompleteObjCClass (ConstString class_name, bool must_be_implementation, llvm::function_ref< bool(DWARFDIE die)> callback) override
 
void GetFullyQualifiedType (const DWARFDeclContext &context, llvm::function_ref< bool(DWARFDIE die)> callback) override
 Uses DWARF5's IDX_parent fields, when available, to speed up this query.
 
void GetTypes (ConstString name, llvm::function_ref< bool(DWARFDIE die)> callback) override
 
void GetTypes (const DWARFDeclContext &context, llvm::function_ref< bool(DWARFDIE die)> callback) override
 
void GetNamespaces (ConstString name, llvm::function_ref< bool(DWARFDIE die)> callback) override
 
void GetTypesWithQuery (TypeQuery &query, llvm::function_ref< bool(DWARFDIE die)> callback) override
 Get type DIEs meeting requires of query.
 
void GetNamespacesWithParents (ConstString name, const CompilerDeclContext &parent_decl_ctx, llvm::function_ref< bool(DWARFDIE die)> callback) override
 Get namespace DIEs whose base name match.
 
void GetFunctions (const Module::LookupInfo &lookup_info, SymbolFileDWARF &dwarf, const CompilerDeclContext &parent_decl_ctx, llvm::function_ref< bool(DWARFDIE die)> callback) override
 
void GetFunctions (const RegularExpression &regex, llvm::function_ref< bool(DWARFDIE die)> callback) override
 
void Dump (Stream &s) override
 
- Public Member Functions inherited from lldb_private::plugin::dwarf::DWARFIndex
 DWARFIndex (Module &module)
 
virtual ~DWARFIndex ()
 
virtual void Preload ()=0
 
virtual void GetGlobalVariables (ConstString basename, llvm::function_ref< bool(DWARFDIE die)> callback)=0
 Finds global variables with the given base name.
 
virtual void GetGlobalVariables (const RegularExpression &regex, llvm::function_ref< bool(DWARFDIE die)> callback)=0
 
virtual void GetGlobalVariables (DWARFUnit &cu, llvm::function_ref< bool(DWARFDIE die)> callback)=0
 cu must be the skeleton unit if possible, not GetNonSkeletonUnit().
 
virtual void GetObjCMethods (ConstString class_name, llvm::function_ref< bool(DWARFDIE die)> callback)=0
 
virtual void GetCompleteObjCClass (ConstString class_name, bool must_be_implementation, llvm::function_ref< bool(DWARFDIE die)> callback)=0
 
virtual void GetTypes (ConstString name, llvm::function_ref< bool(DWARFDIE die)> callback)=0
 
virtual void GetTypes (const DWARFDeclContext &context, llvm::function_ref< bool(DWARFDIE die)> callback)=0
 
virtual void GetFullyQualifiedType (const DWARFDeclContext &context, llvm::function_ref< bool(DWARFDIE die)> callback)
 Finds all DIEs whose fully qualified name matches context.
 
virtual void GetNamespaces (ConstString name, llvm::function_ref< bool(DWARFDIE die)> callback)=0
 
virtual void GetTypesWithQuery (TypeQuery &query, llvm::function_ref< bool(DWARFDIE die)> callback)
 Get type DIEs meeting requires of query.
 
virtual void GetNamespacesWithParents (ConstString name, const CompilerDeclContext &parent_decl_ctx, llvm::function_ref< bool(DWARFDIE die)> callback)
 Get namespace DIEs whose base name match.
 
virtual void GetFunctions (const Module::LookupInfo &lookup_info, SymbolFileDWARF &dwarf, const CompilerDeclContext &parent_decl_ctx, llvm::function_ref< bool(DWARFDIE die)> callback)=0
 
virtual void GetFunctions (const RegularExpression &regex, llvm::function_ref< bool(DWARFDIE die)> callback)=0
 
virtual void Dump (Stream &s)=0
 
StatsDuration::Duration GetIndexTime ()
 
void ResetStatistics ()
 

Static Public Member Functions

static llvm::Expected< std::unique_ptr< DebugNamesDWARFIndex > > Create (Module &module, DWARFDataExtractor debug_names, DWARFDataExtractor debug_str, SymbolFileDWARF &dwarf)
 

Private Types

using DebugNames = llvm::DWARFDebugNames
 

Private Member Functions

 DebugNamesDWARFIndex (Module &module, std::unique_ptr< llvm::DWARFDebugNames > debug_names_up, DWARFDataExtractor debug_names_data, DWARFDataExtractor debug_str_data, SymbolFileDWARF &dwarf)
 
DWARFUnitGetNonSkeletonUnit (const DebugNames::Entry &entry) const
 
DWARFDIE GetDIE (const DebugNames::Entry &entry) const
 
std::optional< DWARFTypeUnit * > GetForeignTypeUnit (const DebugNames::Entry &entry) const
 Checks if an entry is a foreign TU and fetch the type unit.
 
bool ProcessEntry (const DebugNames::Entry &entry, llvm::function_ref< bool(DWARFDIE die)> callback)
 
bool SameParentChain (llvm::ArrayRef< llvm::StringRef > parent_names, llvm::ArrayRef< DebugNames::Entry > parent_entries) const
 Returns true if parent_entries have identical names to parent_names.
 
bool SameParentChain (llvm::ArrayRef< CompilerContext > parent_contexts, llvm::ArrayRef< DebugNames::Entry > parent_entries) const
 
bool WithinParentChain (llvm::ArrayRef< CompilerContext > parent_contexts, llvm::ArrayRef< DebugNames::Entry > parent_chain) const
 Returns true if parent_contexts entries are within parent_chain.
 
bool SameAsEntryContext (const CompilerContext &query_context, const DebugNames::Entry &entry) const
 Returns true if .debug_names pool entry entry matches query_context.
 
llvm::SmallVector< CompilerContextGetTypeQueryParentContexts (TypeQuery &query)
 

Static Private Member Functions

static void MaybeLogLookupError (llvm::Error error, const DebugNames::NameIndex &ni, llvm::StringRef name)
 
static llvm::DenseSet< dw_offset_tGetUnits (const DebugNames &debug_names)
 
static llvm::DenseSet< uint64_t > GetTypeUnitSignatures (const DebugNames &debug_names)
 

Private Attributes

DWARFDebugInfom_debug_info
 
DWARFDataExtractor m_debug_names_data
 
DWARFDataExtractor m_debug_str_data
 
std::unique_ptr< DebugNamesm_debug_names_up
 
ManualDWARFIndex m_fallback
 

Additional Inherited Members

- Protected Member Functions inherited from lldb_private::plugin::dwarf::DWARFIndex
bool ProcessFunctionDIE (const Module::LookupInfo &lookup_info, DWARFDIE die, const CompilerDeclContext &parent_decl_ctx, llvm::function_ref< bool(DWARFDIE die)> callback)
 Helper function implementing common logic for processing function dies.
 
DIERefCallbackImpl DIERefCallback (llvm::function_ref< bool(DWARFDIE die)> callback, llvm::StringRef name={}) const
 
void ReportInvalidDIERef (DIERef ref, llvm::StringRef name) const
 
bool GetFullyQualifiedTypeImpl (const DWARFDeclContext &context, DWARFDIE die, llvm::function_ref< bool(DWARFDIE die)> callback)
 Implementation of GetFullyQualifiedType to check a single entry, shareable with derived classes.
 
bool ProcessTypeDIEMatchQuery (TypeQuery &query, DWARFDIE die, llvm::function_ref< bool(DWARFDIE die)> callback)
 Check if the type die can meet the requirements of query.
 
bool ProcessNamespaceDieMatchParents (const CompilerDeclContext &parent_decl_ctx, DWARFDIE die, llvm::function_ref< bool(DWARFDIE die)> callback)
 
- Protected Attributes inherited from lldb_private::plugin::dwarf::DWARFIndex
Modulem_module
 
StatsDuration m_index_time
 

Detailed Description

Definition at line 21 of file DebugNamesDWARFIndex.h.

Member Typedef Documentation

◆ DebugNames

Definition at line 89 of file DebugNamesDWARFIndex.h.

Constructor & Destructor Documentation

◆ DebugNamesDWARFIndex()

lldb_private::plugin::dwarf::DebugNamesDWARFIndex::DebugNamesDWARFIndex ( Module module,
std::unique_ptr< llvm::DWARFDebugNames >  debug_names_up,
DWARFDataExtractor  debug_names_data,
DWARFDataExtractor  debug_str_data,
SymbolFileDWARF dwarf 
)
inlineprivate

Definition at line 71 of file DebugNamesDWARFIndex.h.

Member Function Documentation

◆ Create()

llvm::Expected< std::unique_ptr< DebugNamesDWARFIndex > > DebugNamesDWARFIndex::Create ( Module module,
DWARFDataExtractor  debug_names,
DWARFDataExtractor  debug_str,
SymbolFileDWARF dwarf 
)
static

◆ Dump()

void DebugNamesDWARFIndex::Dump ( Stream s)
overridevirtual

◆ GetCompleteObjCClass()

void DebugNamesDWARFIndex::GetCompleteObjCClass ( ConstString  class_name,
bool  must_be_implementation,
llvm::function_ref< bool(DWARFDIE die)>  callback 
)
overridevirtual

◆ GetDIE()

DWARFDIE DebugNamesDWARFIndex::GetDIE ( const DebugNames::Entry &  entry) const
private

◆ GetForeignTypeUnit()

std::optional< DWARFTypeUnit * > DebugNamesDWARFIndex::GetForeignTypeUnit ( const DebugNames::Entry &  entry) const
private

Checks if an entry is a foreign TU and fetch the type unit.

This function checks if the DebugNames::Entry refers to a foreign TU and returns an optional with a value of the entry is a foreign type unit entry. A valid pointer will be returned if this entry is from a .dwo file or if it is from a .dwp file and it matches the type unit's originating .dwo file by verifying that the DW_TAG_type_unit DIE has a DW_AT_dwo_name that matches the DWO name from the originating skeleton compile unit.

Parameters
[in]entryThe accelerator table entry to check.
Returns
A std::optional that has a value if this entry represents a foreign type unit. If the pointer is valid, then we were able to find and match the entry to the type unit in the .dwo or .dwp file. The returned value can have a valid, yet contain NULL in the following cases:
  • we were not able to load the .dwo file (missing or DWO ID mismatch)
  • we were able to load the .dwp file, but the type units DWO name doesn't match the originating skeleton compile unit's entry Returns std::nullopt if this entry is not a foreign type unit entry.

Definition at line 64 of file DebugNamesDWARFIndex.cpp.

References lldb_private::plugin::dwarf::DIERef::DebugInfo, lldb_private::plugin::dwarf::SymbolFileDWARF::DebugInfo(), lldb_private::plugin::dwarf::DWARFBaseDIE::GetAttributeValueAsString(), lldb_private::plugin::dwarf::DWARFDebugInfo::GetDwpSymbolFile(), lldb_private::plugin::dwarf::DWARFUnit::GetNonSkeletonUnit(), lldb_private::plugin::dwarf::DWARFUnit::GetSymbolFileDWARF(), lldb_private::plugin::dwarf::DWARFDebugInfo::GetTypeUnitForHash(), lldb_private::plugin::dwarf::DWARFDebugInfo::GetUnitAtOffset(), lldb_private::plugin::dwarf::DWARFUnit::GetUnitDIEOnly(), lldb_private::plugin::dwarf::DWARFUnit::IsDWOUnit(), and m_debug_info.

Referenced by GetFullyQualifiedType(), GetNonSkeletonUnit(), and GetTypesWithQuery().

◆ GetFullyQualifiedType()

void DebugNamesDWARFIndex::GetFullyQualifiedType ( const DWARFDeclContext context,
llvm::function_ref< bool(DWARFDIE die)>  callback 
)
overridevirtual

◆ GetFunctions() [1/2]

void DebugNamesDWARFIndex::GetFunctions ( const Module::LookupInfo lookup_info,
SymbolFileDWARF dwarf,
const CompilerDeclContext parent_decl_ctx,
llvm::function_ref< bool(DWARFDIE die)>  callback 
)
overridevirtual

◆ GetFunctions() [2/2]

void DebugNamesDWARFIndex::GetFunctions ( const RegularExpression regex,
llvm::function_ref< bool(DWARFDIE die)>  callback 
)
overridevirtual

◆ GetGlobalVariables() [1/3]

void DebugNamesDWARFIndex::GetGlobalVariables ( const RegularExpression regex,
llvm::function_ref< bool(DWARFDIE die)>  callback 
)
overridevirtual

◆ GetGlobalVariables() [2/3]

void DebugNamesDWARFIndex::GetGlobalVariables ( ConstString  basename,
llvm::function_ref< bool(DWARFDIE die)>  callback 
)
overridevirtual

Finds global variables with the given base name.

Any additional filtering (e.g., to only retrieve variables from a given context) should be done by the consumer.

Implements lldb_private::plugin::dwarf::DWARFIndex.

Definition at line 179 of file DebugNamesDWARFIndex.cpp.

References lldb_private::plugin::dwarf::ManualDWARFIndex::GetGlobalVariables(), lldb_private::ConstString::GetStringRef(), m_debug_names_up, m_fallback, and ProcessEntry().

◆ GetGlobalVariables() [3/3]

void DebugNamesDWARFIndex::GetGlobalVariables ( DWARFUnit cu,
llvm::function_ref< bool(DWARFDIE die)>  callback 
)
overridevirtual

◆ GetNamespaces()

void DebugNamesDWARFIndex::GetNamespaces ( ConstString  name,
llvm::function_ref< bool(DWARFDIE die)>  callback 
)
overridevirtual

◆ GetNamespacesWithParents()

void DebugNamesDWARFIndex::GetNamespacesWithParents ( ConstString  name,
const CompilerDeclContext parent_decl_ctx,
llvm::function_ref< bool(DWARFDIE die)>  callback 
)
overridevirtual

Get namespace DIEs whose base name match.

Parameters
namewith
parent_decl_ctxin its decl parent chain. A base implementation is provided. Specializations should override this if they are able to provide a faster implementation.

Reimplemented from lldb_private::plugin::dwarf::DWARFIndex.

Definition at line 566 of file DebugNamesDWARFIndex.cpp.

References lldb_private::CompilerDeclContext::GetCompilerContext(), lldb_private::plugin::dwarf::DWARFIndex::GetNamespacesWithParents(), lldb_private::ConstString::GetStringRef(), m_debug_names_up, m_fallback, ProcessEntry(), lldb_private::plugin::dwarf::DWARFIndex::ProcessNamespaceDieMatchParents(), and WithinParentChain().

◆ GetNonSkeletonUnit()

DWARFUnit * DebugNamesDWARFIndex::GetNonSkeletonUnit ( const DebugNames::Entry &  entry) const
private

◆ GetObjCMethods()

void lldb_private::plugin::dwarf::DebugNamesDWARFIndex::GetObjCMethods ( ConstString  class_name,
llvm::function_ref< bool(DWARFDIE die)>  callback 
)
inlineoverridevirtual

Implements lldb_private::plugin::dwarf::DWARFIndex.

Definition at line 39 of file DebugNamesDWARFIndex.h.

◆ GetTypeQueryParentContexts()

llvm::SmallVector< CompilerContext > DebugNamesDWARFIndex::GetTypeQueryParentContexts ( TypeQuery query)
private

◆ GetTypes() [1/2]

void DebugNamesDWARFIndex::GetTypes ( const DWARFDeclContext context,
llvm::function_ref< bool(DWARFDIE die)>  callback 
)
overridevirtual

◆ GetTypes() [2/2]

void DebugNamesDWARFIndex::GetTypes ( ConstString  name,
llvm::function_ref< bool(DWARFDIE die)>  callback 
)
overridevirtual

◆ GetTypesWithQuery()

void DebugNamesDWARFIndex::GetTypesWithQuery ( TypeQuery query,
llvm::function_ref< bool(DWARFDIE die)>  callback 
)
overridevirtual

Get type DIEs meeting requires of query.

in its decl parent chain as subset. A base implementation is provided, Specializations should override this if they are able to provide a faster implementation.

Reimplemented from lldb_private::plugin::dwarf::DWARFIndex.

Definition at line 520 of file DebugNamesDWARFIndex.cpp.

References lldb_private::TypeQuery::GetContextRef(), lldb_private::TypeQuery::GetExactMatch(), GetForeignTypeUnit(), lldb_private::TypeQuery::GetTypeBasename(), GetTypeQueryParentContexts(), GetTypes(), lldb_private::plugin::dwarf::DWARFIndex::GetTypesWithQuery(), m_debug_names_up, m_fallback, ProcessEntry(), lldb_private::plugin::dwarf::DWARFIndex::ProcessTypeDIEMatchQuery(), and WithinParentChain().

◆ GetTypeUnitSignatures()

llvm::DenseSet< uint64_t > DebugNamesDWARFIndex::GetTypeUnitSignatures ( const DebugNames debug_names)
staticprivate

Definition at line 39 of file DebugNamesDWARFIndex.cpp.

◆ GetUnits()

llvm::DenseSet< dw_offset_t > DebugNamesDWARFIndex::GetUnits ( const DebugNames debug_names)
staticprivate

Definition at line 50 of file DebugNamesDWARFIndex.cpp.

◆ MaybeLogLookupError()

void DebugNamesDWARFIndex::MaybeLogLookupError ( llvm::Error  error,
const DebugNames::NameIndex &  ni,
llvm::StringRef  name 
)
staticprivate

◆ Preload()

void lldb_private::plugin::dwarf::DebugNamesDWARFIndex::Preload ( )
inlineoverridevirtual

◆ ProcessEntry()

bool DebugNamesDWARFIndex::ProcessEntry ( const DebugNames::Entry &  entry,
llvm::function_ref< bool(DWARFDIE die)>  callback 
)
private

◆ SameAsEntryContext()

bool DebugNamesDWARFIndex::SameAsEntryContext ( const CompilerContext query_context,
const DebugNames::Entry &  entry 
) const
private

◆ SameParentChain() [1/2]

bool DebugNamesDWARFIndex::SameParentChain ( llvm::ArrayRef< CompilerContext parent_contexts,
llvm::ArrayRef< DebugNames::Entry >  parent_entries 
) const
private

Definition at line 417 of file DebugNamesDWARFIndex.cpp.

References SameAsEntryContext().

◆ SameParentChain() [2/2]

bool DebugNamesDWARFIndex::SameParentChain ( llvm::ArrayRef< llvm::StringRef >  parent_names,
llvm::ArrayRef< DebugNames::Entry >  parent_entries 
) const
private

Returns true if parent_entries have identical names to parent_names.

Definition at line 389 of file DebugNamesDWARFIndex.cpp.

References GetNonSkeletonUnit(), lldb_private::plugin::dwarf::DWARFUnit::GetOffset(), and lldb_private::plugin::dwarf::DWARFUnit::PeekDIEName().

Referenced by GetFullyQualifiedType(), and WithinParentChain().

◆ WithinParentChain()

bool DebugNamesDWARFIndex::WithinParentChain ( llvm::ArrayRef< CompilerContext parent_contexts,
llvm::ArrayRef< DebugNames::Entry >  parent_chain 
) const
private

Returns true if parent_contexts entries are within parent_chain.

This is diffferent from SameParentChain() which checks for exact match. This function is required because parent_chain can contain inline namespace entries which may not be specified in parent_contexts by client.

Parameters
[in]parent_contextsThe list of parent contexts to check for.
[in]parent_chainThe fully qualified parent chain entries from .debug_names index table to check against.
Returns
True if all parent_contexts entries are can be sequentially found inside parent_chain, otherwise False.

Definition at line 432 of file DebugNamesDWARFIndex.cpp.

References SameAsEntryContext(), and SameParentChain().

Referenced by GetNamespacesWithParents(), and GetTypesWithQuery().

Member Data Documentation

◆ m_debug_info

DWARFDebugInfo& lldb_private::plugin::dwarf::DebugNamesDWARFIndex::m_debug_info
private

Definition at line 82 of file DebugNamesDWARFIndex.h.

Referenced by GetForeignTypeUnit(), and GetNonSkeletonUnit().

◆ m_debug_names_data

DWARFDataExtractor lldb_private::plugin::dwarf::DebugNamesDWARFIndex::m_debug_names_data
private

Definition at line 86 of file DebugNamesDWARFIndex.h.

◆ m_debug_names_up

std::unique_ptr<DebugNames> lldb_private::plugin::dwarf::DebugNamesDWARFIndex::m_debug_names_up
private

◆ m_debug_str_data

DWARFDataExtractor lldb_private::plugin::dwarf::DebugNamesDWARFIndex::m_debug_str_data
private

Definition at line 87 of file DebugNamesDWARFIndex.h.

◆ m_fallback

ManualDWARFIndex lldb_private::plugin::dwarf::DebugNamesDWARFIndex::m_fallback
private

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