LLDB mainline
lldb_private::SearchFilter Class Referenceabstract

General Outline: Provides the callback and search depth for the SearchFilter search. More...

#include "lldb/Core/SearchFilter.h"

Inheritance diagram for lldb_private::SearchFilter:
[legend]

Public Types

enum  FilterTy {
  Unconstrained = 0 , Exception , ByModule , ByModules ,
  ByModulesAndCU , LastKnownFilterType = ByModulesAndCU , UnknownFilter
}

Public Member Functions

 SearchFilter (const lldb::TargetSP &target_sp)
 The basic constructor takes a Target, which gives the space to search.
 SearchFilter (const lldb::TargetSP &target_sp, unsigned char filterType)
virtual ~SearchFilter ()
virtual bool ModulePasses (const FileSpec &spec)
 Call this method with a file spec to see if that spec passes the filter.
virtual bool ModulePasses (const lldb::ModuleSP &module_sp)
 Call this method with a Module to see if that module passes the filter.
virtual bool AddressPasses (Address &addr)
 Call this method with a Address to see if address passes the filter.
virtual bool CompUnitPasses (FileSpec &fileSpec)
 Call this method with a FileSpec to see if file spec passes the filter as the name of a compilation unit.
virtual bool CompUnitPasses (CompileUnit &compUnit)
 Call this method with a CompileUnit to see if comp unit passes the filter.
virtual bool FunctionPasses (Function &function)
 Call this method with a Function to see if function passes the filter.
virtual void Search (Searcher &searcher)
 Call this method to do the search using the Searcher.
virtual void SearchInModuleList (Searcher &searcher, ModuleList &modules)
 Call this method to do the search using the Searcher in the module list modules.
virtual uint32_t GetFilterRequiredItems ()
 This determines which items are REQUIRED for the filter to pass.
virtual void GetDescription (Stream *s)
 Prints a canonical description for the search filter to the stream s.
virtual void Dump (Stream *s) const
 Standard "Dump" method. At present it does nothing.
lldb::SearchFilterSP CreateCopy (lldb::TargetSP &target_sp)
virtual StructuredData::ObjectSP SerializeToStructuredData ()
enum FilterTy GetFilterTy ()
const char * GetFilterName ()

Static Public Member Functions

static lldb::SearchFilterSP CreateFromStructuredData (const lldb::TargetSP &target_sp, const StructuredData::Dictionary &data_dict, Status &error)
static const char * GetSerializationKey ()
static const char * GetSerializationSubclassKey ()
static const char * GetSerializationSubclassOptionsKey ()
static const char * FilterTyToName (enum FilterTy)
static FilterTy NameToFilterTy (llvm::StringRef name)

Static Public Attributes

static const char * g_ty_to_name [LastKnownFilterType+2]

Protected Types

enum  OptionNames { ModList = 0 , CUList , LanguageName , LastOptionName }

Protected Member Functions

StructuredData::DictionarySP WrapOptionsDict (StructuredData::DictionarySP options_dict_sp)
void SerializeFileSpecList (StructuredData::DictionarySP &options_dict_sp, OptionNames name, FileSpecList &file_list)
Searcher::CallbackReturn DoModuleIteration (const SymbolContext &context, Searcher &searcher)
Searcher::CallbackReturn DoModuleIteration (const lldb::ModuleSP &module_sp, Searcher &searcher)
Searcher::CallbackReturn DoCUIteration (const lldb::ModuleSP &module_sp, const SymbolContext &context, Searcher &searcher)
Searcher::CallbackReturn DoFunctionIteration (Function *function, const SymbolContext &context, Searcher &searcher)
virtual lldb::SearchFilterSP DoCreateCopy ()=0
void SetTarget (lldb::TargetSP &target_sp)

Static Protected Member Functions

static const char * GetKey (enum OptionNames enum_value)

Protected Attributes

lldb::TargetSP m_target_sp

Static Protected Attributes

static const char * g_option_names [LastOptionName]

Private Attributes

unsigned char SubclassID

Detailed Description

General Outline: Provides the callback and search depth for the SearchFilter search.

Class descends through the SymbolContext space of the target, applying a filter at each stage till it reaches the depth specified by the GetDepth method of the searcher, and calls its callback at that point.

The search is done by cooperation between the search filter and the searcher. The search filter does the heavy work of recursing through the SymbolContext space of the target program's symbol space. The Searcher specifies the depth at which it wants its callback to be invoked. Note that since the resolution of the Searcher may be greater than that of the SearchFilter, before the Searcher qualifies an address it should pass it to "AddressPasses." The default implementation is "Everything Passes."

Definition at line 83 of file SearchFilter.h.

Member Enumeration Documentation

◆ FilterTy

Enumerator
Unconstrained 
Exception 
ByModule 
ByModules 
ByModulesAndCU 
LastKnownFilterType 
UnknownFilter 

Definition at line 217 of file SearchFilter.h.

◆ OptionNames

Enumerator
ModList 
CUList 
LanguageName 
LastOptionName 

Definition at line 244 of file SearchFilter.h.

Constructor & Destructor Documentation

◆ SearchFilter() [1/2]

◆ SearchFilter() [2/2]

SearchFilter::SearchFilter ( const lldb::TargetSP & target_sp,
unsigned char filterType )

Definition at line 72 of file SearchFilter.cpp.

References m_target_sp, and SubclassID.

◆ ~SearchFilter()

SearchFilter::~SearchFilter ( )
virtualdefault

References error().

Member Function Documentation

◆ AddressPasses()

bool SearchFilter::AddressPasses ( Address & addr)
virtual

Call this method with a Address to see if address passes the filter.

Parameters
[in]addrThe address to check against the filter.
Returns
true if address passes, and false otherwise.
Note
the default implementation always returns true.

Reimplemented in lldb_private::SearchFilterByModule, lldb_private::SearchFilterByModuleList, and lldb_private::SearchFilterByModuleListAndCU.

Definition at line 145 of file SearchFilter.cpp.

Referenced by lldb_private::BreakpointResolver::AddLocation(), FunctionPasses(), lldb_private::BreakpointResolverAddress::SearchCallback(), and lldb_private::BreakpointResolverName::SearchCallback().

◆ CompUnitPasses() [1/2]

bool SearchFilter::CompUnitPasses ( CompileUnit & compUnit)
virtual

Call this method with a CompileUnit to see if comp unit passes the filter.

Parameters
[in]compUnitThe CompileUnit to check against the filter.
Returns
true if Comp Unit passes, and false otherwise.
Note
the default implementation always returns true.

Reimplemented in lldb_private::SearchFilterByModuleListAndCU.

Definition at line 149 of file SearchFilter.cpp.

◆ CompUnitPasses() [2/2]

bool SearchFilter::CompUnitPasses ( FileSpec & fileSpec)
virtual

Call this method with a FileSpec to see if file spec passes the filter as the name of a compilation unit.

Parameters
[in]fileSpecThe file spec to check against the filter.
Returns
true if file spec passes, and false otherwise.
Note
the default implementation always returns true.

Reimplemented in lldb_private::SearchFilterByModuleListAndCU.

Definition at line 147 of file SearchFilter.cpp.

Referenced by DoCUIteration(), lldb_private::BreakpointResolverFileLine::SearchCallback(), and lldb_private::BreakpointResolverName::SearchCallback().

◆ CreateCopy()

lldb::SearchFilterSP SearchFilter::CreateCopy ( lldb::TargetSP & target_sp)

Definition at line 168 of file SearchFilter.cpp.

References DoCreateCopy().

◆ CreateFromStructuredData()

◆ DoCreateCopy()

◆ DoCUIteration()

◆ DoFunctionIteration()

Searcher::CallbackReturn SearchFilter::DoFunctionIteration ( Function * function,
const SymbolContext & context,
Searcher & searcher )
protected

Definition at line 350 of file SearchFilter.cpp.

References lldb_private::Searcher::eCallbackReturnContinue.

Referenced by DoCUIteration().

◆ DoModuleIteration() [1/2]

Searcher::CallbackReturn SearchFilter::DoModuleIteration ( const lldb::ModuleSP & module_sp,
Searcher & searcher )
protected

Definition at line 244 of file SearchFilter.cpp.

References DoModuleIteration(), and m_target_sp.

◆ DoModuleIteration() [2/2]

◆ Dump()

void SearchFilter::Dump ( Stream * s) const
virtual

Standard "Dump" method. At present it does nothing.

Reimplemented in lldb_private::SearchFilterByModule, lldb_private::SearchFilterByModuleList, and lldb_private::SearchFilterByModuleListAndCU.

Definition at line 166 of file SearchFilter.cpp.

◆ FilterTyToName()

const char * SearchFilter::FilterTyToName ( enum FilterTy type)
static

Definition at line 51 of file SearchFilter.cpp.

References g_ty_to_name, LastKnownFilterType, and UnknownFilter.

Referenced by GetFilterName().

◆ FunctionPasses()

bool SearchFilter::FunctionPasses ( Function & function)
virtual

Call this method with a Function to see if function passes the filter.

Parameters
[in]functionThe Functions to check against the filter.
Returns
true if function passes, and false otherwise.

Definition at line 151 of file SearchFilter.cpp.

References AddressPasses(), and lldb_private::Function::GetAddress().

Referenced by DoCUIteration().

◆ GetDescription()

void SearchFilter::GetDescription ( Stream * s)
virtual

Prints a canonical description for the search filter to the stream s.

Parameters
[in]sStream to which the output is copied.

Reimplemented in lldb_private::ExceptionSearchFilter, lldb_private::SearchFilterByModule, lldb_private::SearchFilterByModuleList, and lldb_private::SearchFilterByModuleListAndCU.

Definition at line 164 of file SearchFilter.cpp.

◆ GetFilterName()

const char * lldb_private::SearchFilter::GetFilterName ( )
inline

Definition at line 236 of file SearchFilter.h.

References FilterTyToName(), and GetFilterTy().

Referenced by WrapOptionsDict().

◆ GetFilterRequiredItems()

uint32_t SearchFilter::GetFilterRequiredItems ( )
virtual

This determines which items are REQUIRED for the filter to pass.

For instance, if you are filtering by Compilation Unit, obviously symbols that have no compilation unit can't pass So return eSymbolContextCU and search callbacks can then short cut the search to avoid looking at things that obviously won't pass.

Returns
The required elements for the search, which is an or'ed together set of lldb:SearchContextItem enum's.

Reimplemented in lldb_private::SearchFilterByModule, lldb_private::SearchFilterByModuleList, and lldb_private::SearchFilterByModuleListAndCU.

Definition at line 160 of file SearchFilter.cpp.

Referenced by lldb_private::BreakpointResolverName::SearchCallback().

◆ GetFilterTy()

enum FilterTy lldb_private::SearchFilter::GetFilterTy ( )
inline

Definition at line 229 of file SearchFilter.h.

References LastKnownFilterType, SubclassID, and UnknownFilter.

Referenced by GetFilterName().

◆ GetKey()

◆ GetSerializationKey()

const char * lldb_private::SearchFilter::GetSerializationKey ( )
inlinestatic

◆ GetSerializationSubclassKey()

const char * lldb_private::SearchFilter::GetSerializationSubclassKey ( )
inlinestatic

Definition at line 213 of file SearchFilter.h.

Referenced by CreateFromStructuredData(), and WrapOptionsDict().

◆ GetSerializationSubclassOptionsKey()

const char * lldb_private::SearchFilter::GetSerializationSubclassOptionsKey ( )
inlinestatic

Definition at line 215 of file SearchFilter.h.

Referenced by CreateFromStructuredData(), and WrapOptionsDict().

◆ ModulePasses() [1/2]

bool SearchFilter::ModulePasses ( const FileSpec & spec)
virtual

Call this method with a file spec to see if that spec passes the filter.

Parameters
[in]specThe file spec to check against the filter.
Returns
true if spec passes, and false otherwise.
Note
the default implementation always returns true.

Reimplemented in lldb_private::ExceptionSearchFilter, lldb_private::SearchFilterByModule, lldb_private::SearchFilterByModuleList, and lldb_private::SearchFilterForUnconstrainedSearches.

Definition at line 141 of file SearchFilter.cpp.

Referenced by DoModuleIteration(), and SearchInModuleList().

◆ ModulePasses() [2/2]

bool SearchFilter::ModulePasses ( const lldb::ModuleSP & module_sp)
virtual

Call this method with a Module to see if that module passes the filter.

Parameters
[in]module_spThe Module to check against the filter.
Returns
true if module passes, and false otherwise.
Note
the default implementation always returns true.

Reimplemented in lldb_private::ExceptionSearchFilter, lldb_private::SearchFilterByModule, lldb_private::SearchFilterByModuleList, and lldb_private::SearchFilterForUnconstrainedSearches.

Definition at line 143 of file SearchFilter.cpp.

◆ NameToFilterTy()

SearchFilter::FilterTy SearchFilter::NameToFilterTy ( llvm::StringRef name)
static

Definition at line 58 of file SearchFilter.cpp.

References g_ty_to_name, LastKnownFilterType, and UnknownFilter.

Referenced by CreateFromStructuredData().

◆ Search()

◆ SearchInModuleList()

void SearchFilter::SearchInModuleList ( Searcher & searcher,
ModuleList & modules )
virtual

Call this method to do the search using the Searcher in the module list modules.

Parameters
[in]searcherThe searcher to drive with this search.
[in]modulesThe module list within which to restrict the search.

Definition at line 223 of file SearchFilter.cpp.

References DoModuleIteration(), lldb_private::Searcher::eCallbackReturnStop, lldb::eSearchDepthTarget, lldb_private::Searcher::GetDepth(), m_target_sp, ModulePasses(), lldb_private::ModuleList::Modules(), lldb_private::Searcher::SearchCallback(), and lldb_private::SymbolContext::target_sp.

Referenced by lldb_private::AddressResolver::ResolveAddressInModules(), and lldb_private::BreakpointResolver::ResolveBreakpointInModules().

◆ SerializeFileSpecList()

◆ SerializeToStructuredData()

◆ SetTarget()

void lldb_private::SearchFilter::SetTarget ( lldb::TargetSP & target_sp)
inlineprotected

Definition at line 276 of file SearchFilter.h.

References m_target_sp.

◆ WrapOptionsDict()

Member Data Documentation

◆ g_option_names

const char * SearchFilter::g_option_names
staticprotected
Initial value:
= {
"ModuleList", "CUList"}

Definition at line 245 of file SearchFilter.h.

Referenced by GetKey().

◆ g_ty_to_name

const char * SearchFilter::g_ty_to_name
static
Initial value:
= {"Unconstrained", "Exception",
"Module", "Modules",
"ModulesAndCU", "Unknown"}

Definition at line 227 of file SearchFilter.h.

Referenced by FilterTyToName(), and NameToFilterTy().

◆ m_target_sp

◆ SubclassID

unsigned char lldb_private::SearchFilter::SubclassID
private

Definition at line 282 of file SearchFilter.h.

Referenced by GetFilterTy(), and SearchFilter().


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