LLDB  mainline
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Attributes | List of all members
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:
Inheritance graph
[legend]
Collaboration diagram for lldb_private::SearchFilter:
Collaboration graph
[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. More...
 
 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. More...
 
virtual bool ModulePasses (const lldb::ModuleSP &module_sp)
 Call this method with a Module to see if that module passes the filter. More...
 
virtual bool AddressPasses (Address &addr)
 Call this method with a Address to see if address passes the filter. More...
 
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. More...
 
virtual bool CompUnitPasses (CompileUnit &compUnit)
 Call this method with a CompileUnit to see if comp unit passes the filter. More...
 
virtual bool FunctionPasses (Function &function)
 Call this method with a Function to see if function passes the filter. More...
 
virtual void Search (Searcher &searcher)
 Call this method to do the search using the Searcher. More...
 
virtual void SearchInModuleList (Searcher &searcher, ModuleList &modules)
 Call this method to do the search using the Searcher in the module list modules. More...
 
virtual uint32_t GetFilterRequiredItems ()
 This determines which items are REQUIRED for the filter to pass. More...
 
virtual void GetDescription (Stream *s)
 Prints a canonical description for the search filter to the stream s. More...
 
virtual void Dump (Stream *s) const
 Standard "Dump" method. At present it does nothing. More...
 
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]

lldb_private::SearchFilter::SearchFilter ( const lldb::TargetSP &  target_sp)

The basic constructor takes a Target, which gives the space to search.

Parameters
[in]target_spThe Target that provides the module list to search.

Referenced by lldb_private::Searcher::GetDescription().

◆ SearchFilter() [2/2]

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

◆ ~SearchFilter()

SearchFilter::~SearchFilter ( )
virtualdefault

Member Function Documentation

◆ AddressPasses()

bool SearchFilter::AddressPasses ( Address addr)
virtual

◆ CompUnitPasses() [1/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 143 of file SearchFilter.cpp.

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

◆ CompUnitPasses() [2/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 145 of file SearchFilter.cpp.

◆ CreateCopy()

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

Definition at line 164 of file SearchFilter.cpp.

◆ CreateFromStructuredData()

SearchFilterSP SearchFilter::CreateFromStructuredData ( const lldb::TargetSP &  target_sp,
const StructuredData::Dictionary data_dict,
Status error 
)
static

◆ DoCreateCopy()

virtual lldb::SearchFilterSP lldb_private::SearchFilter::DoCreateCopy ( )
protectedpure virtual

◆ DoCUIteration()

Searcher::CallbackReturn SearchFilter::DoCUIteration ( const lldb::ModuleSP &  module_sp,
const SymbolContext context,
Searcher searcher 
)
protected

◆ DoFunctionIteration()

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

Definition at line 355 of file SearchFilter.cpp.

References lldb_private::Searcher::eCallbackReturnContinue.

◆ DoModuleIteration() [1/2]

Searcher::CallbackReturn SearchFilter::DoModuleIteration ( const SymbolContext context,
Searcher searcher 
)
protected

◆ DoModuleIteration() [2/2]

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

Definition at line 244 of file SearchFilter.cpp.

◆ Dump()

void SearchFilter::Dump ( Stream s) const
virtual

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

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

Definition at line 162 of file SearchFilter.cpp.

◆ FilterTyToName()

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

Definition at line 51 of file SearchFilter.cpp.

◆ 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 147 of file SearchFilter.cpp.

◆ 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::SearchFilterByModuleListAndCU, lldb_private::SearchFilterByModuleList, lldb_private::SearchFilterByModule, and lldb_private::ExceptionSearchFilter.

Definition at line 160 of file SearchFilter.cpp.

◆ GetFilterName()

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

Definition at line 236 of file SearchFilter.h.

◆ 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::SearchFilterByModuleListAndCU, lldb_private::SearchFilterByModuleList, and lldb_private::SearchFilterByModule.

Definition at line 156 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.

◆ GetKey()

static const char* lldb_private::SearchFilter::GetKey ( enum OptionNames  enum_value)
inlinestaticprotected

◆ GetSerializationKey()

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

◆ GetSerializationSubclassKey()

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

Definition at line 213 of file SearchFilter.h.

◆ GetSerializationSubclassOptionsKey()

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

Definition at line 215 of file SearchFilter.h.

◆ 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::SearchFilterByModuleList, lldb_private::SearchFilterByModule, lldb_private::SearchFilterForUnconstrainedSearches, and lldb_private::ExceptionSearchFilter.

Definition at line 137 of file SearchFilter.cpp.

◆ ModulePasses() [2/2]

virtual bool lldb_private::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::SearchFilterByModuleList, lldb_private::SearchFilterByModule, lldb_private::SearchFilterForUnconstrainedSearches, and lldb_private::ExceptionSearchFilter.

◆ NameToFilterTy()

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

◆ Search()

void SearchFilter::Search ( Searcher searcher)
virtual

◆ SearchInModuleList()

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

◆ SerializeFileSpecList()

void SearchFilter::SerializeFileSpecList ( StructuredData::DictionarySP options_dict_sp,
OptionNames  name,
FileSpecList &  file_list 
)
protected

◆ SerializeToStructuredData()

virtual StructuredData::ObjectSP lldb_private::SearchFilter::SerializeToStructuredData ( )
inlinevirtual

◆ SetTarget()

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

Definition at line 276 of file SearchFilter.h.

◆ WrapOptionsDict()

StructuredData::DictionarySP SearchFilter::WrapOptionsDict ( StructuredData::DictionarySP  options_dict_sp)
protected

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.

◆ 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.

◆ m_target_sp

lldb::TargetSP lldb_private::SearchFilter::m_target_sp
protected

◆ SubclassID

unsigned char lldb_private::SearchFilter::SubclassID
private

Definition at line 282 of file SearchFilter.h.


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