10b57cec5SDimitry Andric //===-- SearchFilter.h ------------------------------------------*- C++ -*-===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric 95ffd83dbSDimitry Andric #ifndef LLDB_CORE_SEARCHFILTER_H 105ffd83dbSDimitry Andric #define LLDB_CORE_SEARCHFILTER_H 110b57cec5SDimitry Andric 1206c3fb27SDimitry Andric #include "lldb/Utility/FileSpecList.h" 130b57cec5SDimitry Andric #include "lldb/Utility/StructuredData.h" 140b57cec5SDimitry Andric 150b57cec5SDimitry Andric #include "lldb/Utility/FileSpec.h" 160b57cec5SDimitry Andric #include "lldb/lldb-forward.h" 170b57cec5SDimitry Andric 18fe6060f1SDimitry Andric #include <cstdint> 190b57cec5SDimitry Andric 200b57cec5SDimitry Andric namespace lldb_private { 210b57cec5SDimitry Andric class Address; 220b57cec5SDimitry Andric class Breakpoint; 230b57cec5SDimitry Andric class CompileUnit; 240b57cec5SDimitry Andric class Status; 250b57cec5SDimitry Andric class Function; 260b57cec5SDimitry Andric class ModuleList; 270b57cec5SDimitry Andric class SearchFilter; 280b57cec5SDimitry Andric class Stream; 290b57cec5SDimitry Andric class SymbolContext; 300b57cec5SDimitry Andric class Target; 310b57cec5SDimitry Andric } 320b57cec5SDimitry Andric 330b57cec5SDimitry Andric namespace lldb_private { 340b57cec5SDimitry Andric 350b57cec5SDimitry Andric /// \class Searcher SearchFilter.h "lldb/Core/SearchFilter.h" Class that is 360b57cec5SDimitry Andric /// driven by the SearchFilter to search the SymbolContext space of the target 370b57cec5SDimitry Andric /// program. 380b57cec5SDimitry Andric 390b57cec5SDimitry Andric /// General Outline: 400b57cec5SDimitry Andric /// Provides the callback and search depth for the SearchFilter search. 410b57cec5SDimitry Andric 420b57cec5SDimitry Andric class Searcher { 430b57cec5SDimitry Andric public: 440b57cec5SDimitry Andric enum CallbackReturn { 450b57cec5SDimitry Andric eCallbackReturnStop = 0, // Stop the iteration 460b57cec5SDimitry Andric eCallbackReturnContinue, // Continue the iteration 470b57cec5SDimitry Andric eCallbackReturnPop // Pop one level up and continue iterating 480b57cec5SDimitry Andric }; 490b57cec5SDimitry Andric 500b57cec5SDimitry Andric Searcher(); 510b57cec5SDimitry Andric 520b57cec5SDimitry Andric virtual ~Searcher(); 530b57cec5SDimitry Andric 540b57cec5SDimitry Andric virtual CallbackReturn SearchCallback(SearchFilter &filter, 559dba64beSDimitry Andric SymbolContext &context, 569dba64beSDimitry Andric Address *addr) = 0; 570b57cec5SDimitry Andric 580b57cec5SDimitry Andric virtual lldb::SearchDepth GetDepth() = 0; 590b57cec5SDimitry Andric 600b57cec5SDimitry Andric /// Prints a canonical description for the searcher to the stream \a s. 610b57cec5SDimitry Andric /// 620b57cec5SDimitry Andric /// \param[in] s 630b57cec5SDimitry Andric /// Stream to which the output is copied. 640b57cec5SDimitry Andric virtual void GetDescription(Stream *s); 650b57cec5SDimitry Andric }; 660b57cec5SDimitry Andric 670b57cec5SDimitry Andric /// \class SearchFilter SearchFilter.h "lldb/Core/SearchFilter.h" Class 680b57cec5SDimitry Andric /// descends through the SymbolContext space of the target, applying a filter 690b57cec5SDimitry Andric /// at each stage till it reaches the depth specified by the GetDepth method 700b57cec5SDimitry Andric /// of the searcher, and calls its callback at that point. 710b57cec5SDimitry Andric 720b57cec5SDimitry Andric /// General Outline: 730b57cec5SDimitry Andric /// Provides the callback and search depth for the SearchFilter search. 740b57cec5SDimitry Andric /// 750b57cec5SDimitry Andric /// The search is done by cooperation between the search filter and the 760b57cec5SDimitry Andric /// searcher. The search filter does the heavy work of recursing through the 770b57cec5SDimitry Andric /// SymbolContext space of the target program's symbol space. The Searcher 780b57cec5SDimitry Andric /// specifies the depth at which it wants its callback to be invoked. Note 790b57cec5SDimitry Andric /// that since the resolution of the Searcher may be greater than that of the 800b57cec5SDimitry Andric /// SearchFilter, before the Searcher qualifies an address it should pass it 810b57cec5SDimitry Andric /// to "AddressPasses." The default implementation is "Everything Passes." 820b57cec5SDimitry Andric 830b57cec5SDimitry Andric class SearchFilter { 840b57cec5SDimitry Andric public: 850b57cec5SDimitry Andric /// The basic constructor takes a Target, which gives the space to search. 860b57cec5SDimitry Andric /// 87480093f4SDimitry Andric /// \param[in] target_sp 880b57cec5SDimitry Andric /// The Target that provides the module list to search. 890b57cec5SDimitry Andric SearchFilter(const lldb::TargetSP &target_sp); 900b57cec5SDimitry Andric 910b57cec5SDimitry Andric SearchFilter(const lldb::TargetSP &target_sp, unsigned char filterType); 920b57cec5SDimitry Andric 930b57cec5SDimitry Andric virtual ~SearchFilter(); 940b57cec5SDimitry Andric 950b57cec5SDimitry Andric /// Call this method with a file spec to see if that spec passes the filter. 960b57cec5SDimitry Andric /// 970b57cec5SDimitry Andric /// \param[in] spec 980b57cec5SDimitry Andric /// The file spec to check against the filter. 990b57cec5SDimitry Andric /// \return 1000b57cec5SDimitry Andric /// \b true if \a spec passes, and \b false otherwise. 1015ffd83dbSDimitry Andric /// 1025ffd83dbSDimitry Andric /// \note the default implementation always returns \c true. 1030b57cec5SDimitry Andric virtual bool ModulePasses(const FileSpec &spec); 1040b57cec5SDimitry Andric 1050b57cec5SDimitry Andric /// Call this method with a Module to see if that module passes the filter. 1060b57cec5SDimitry Andric /// 107480093f4SDimitry Andric /// \param[in] module_sp 1080b57cec5SDimitry Andric /// The Module to check against the filter. 1090b57cec5SDimitry Andric /// 1100b57cec5SDimitry Andric /// \return 1110b57cec5SDimitry Andric /// \b true if \a module passes, and \b false otherwise. 1125ffd83dbSDimitry Andric /// 1135ffd83dbSDimitry Andric /// \note the default implementation always returns \c true. 1140b57cec5SDimitry Andric virtual bool ModulePasses(const lldb::ModuleSP &module_sp); 1150b57cec5SDimitry Andric 1160b57cec5SDimitry Andric /// Call this method with a Address to see if \a address passes the filter. 1170b57cec5SDimitry Andric /// 1180b57cec5SDimitry Andric /// \param[in] addr 1190b57cec5SDimitry Andric /// The address to check against the filter. 1200b57cec5SDimitry Andric /// 1210b57cec5SDimitry Andric /// \return 1220b57cec5SDimitry Andric /// \b true if \a address passes, and \b false otherwise. 1235ffd83dbSDimitry Andric /// 1245ffd83dbSDimitry Andric /// \note the default implementation always returns \c true. 1250b57cec5SDimitry Andric virtual bool AddressPasses(Address &addr); 1260b57cec5SDimitry Andric 1270b57cec5SDimitry Andric /// Call this method with a FileSpec to see if \a file spec passes the 1280b57cec5SDimitry Andric /// filter as the name of a compilation unit. 1290b57cec5SDimitry Andric /// 1300b57cec5SDimitry Andric /// \param[in] fileSpec 1310b57cec5SDimitry Andric /// The file spec to check against the filter. 1320b57cec5SDimitry Andric /// 1330b57cec5SDimitry Andric /// \return 1340b57cec5SDimitry Andric /// \b true if \a file spec passes, and \b false otherwise. 1355ffd83dbSDimitry Andric /// 1365ffd83dbSDimitry Andric /// \note the default implementation always returns \c true. 1370b57cec5SDimitry Andric virtual bool CompUnitPasses(FileSpec &fileSpec); 1380b57cec5SDimitry Andric 1390b57cec5SDimitry Andric /// Call this method with a CompileUnit to see if \a comp unit passes the 1400b57cec5SDimitry Andric /// filter. 1410b57cec5SDimitry Andric /// 1420b57cec5SDimitry Andric /// \param[in] compUnit 1430b57cec5SDimitry Andric /// The CompileUnit to check against the filter. 1440b57cec5SDimitry Andric /// 1450b57cec5SDimitry Andric /// \return 1460b57cec5SDimitry Andric /// \b true if \a Comp Unit passes, and \b false otherwise. 1475ffd83dbSDimitry Andric /// 1485ffd83dbSDimitry Andric /// \note the default implementation always returns \c true. 1490b57cec5SDimitry Andric virtual bool CompUnitPasses(CompileUnit &compUnit); 1500b57cec5SDimitry Andric 1510b57cec5SDimitry Andric /// Call this method with a Function to see if \a function passes the 1520b57cec5SDimitry Andric /// filter. 1530b57cec5SDimitry Andric /// 1540b57cec5SDimitry Andric /// \param[in] function 1550b57cec5SDimitry Andric /// The Functions to check against the filter. 1560b57cec5SDimitry Andric /// 1570b57cec5SDimitry Andric /// \return 1580b57cec5SDimitry Andric /// \b true if \a function passes, and \b false otherwise. 1590b57cec5SDimitry Andric virtual bool FunctionPasses(Function &function); 1600b57cec5SDimitry Andric 1610b57cec5SDimitry Andric /// Call this method to do the search using the Searcher. 1620b57cec5SDimitry Andric /// 1630b57cec5SDimitry Andric /// \param[in] searcher 1640b57cec5SDimitry Andric /// The searcher to drive with this search. 1650b57cec5SDimitry Andric /// 1660b57cec5SDimitry Andric virtual void Search(Searcher &searcher); 1670b57cec5SDimitry Andric 1680b57cec5SDimitry Andric /// Call this method to do the search using the Searcher in the module list 1690b57cec5SDimitry Andric /// \a modules. 1700b57cec5SDimitry Andric /// 1710b57cec5SDimitry Andric /// \param[in] searcher 1720b57cec5SDimitry Andric /// The searcher to drive with this search. 1730b57cec5SDimitry Andric /// 1740b57cec5SDimitry Andric /// \param[in] modules 1750b57cec5SDimitry Andric /// The module list within which to restrict the search. 1760b57cec5SDimitry Andric /// 1770b57cec5SDimitry Andric virtual void SearchInModuleList(Searcher &searcher, ModuleList &modules); 1780b57cec5SDimitry Andric 1790b57cec5SDimitry Andric /// This determines which items are REQUIRED for the filter to pass. For 1800b57cec5SDimitry Andric /// instance, if you are filtering by Compilation Unit, obviously symbols 1810b57cec5SDimitry Andric /// that have no compilation unit can't pass So return eSymbolContextCU and 1820b57cec5SDimitry Andric /// search callbacks can then short cut the search to avoid looking at 1830b57cec5SDimitry Andric /// things that obviously won't pass. 1840b57cec5SDimitry Andric /// 1850b57cec5SDimitry Andric /// \return 1860b57cec5SDimitry Andric /// The required elements for the search, which is an or'ed together 1870b57cec5SDimitry Andric /// set of lldb:SearchContextItem enum's. 1880b57cec5SDimitry Andric /// 1890b57cec5SDimitry Andric virtual uint32_t GetFilterRequiredItems(); 1900b57cec5SDimitry Andric 1910b57cec5SDimitry Andric /// Prints a canonical description for the search filter to the stream \a s. 1920b57cec5SDimitry Andric /// 1930b57cec5SDimitry Andric /// \param[in] s 1940b57cec5SDimitry Andric /// Stream to which the output is copied. 1950b57cec5SDimitry Andric virtual void GetDescription(Stream *s); 1960b57cec5SDimitry Andric 1970b57cec5SDimitry Andric /// Standard "Dump" method. At present it does nothing. 1980b57cec5SDimitry Andric virtual void Dump(Stream *s) const; 1990b57cec5SDimitry Andric 2005ffd83dbSDimitry Andric lldb::SearchFilterSP CreateCopy(lldb::TargetSP& target_sp); 2010b57cec5SDimitry Andric 2020b57cec5SDimitry Andric static lldb::SearchFilterSP 2035ffd83dbSDimitry Andric CreateFromStructuredData(const lldb::TargetSP& target_sp, 2040b57cec5SDimitry Andric const StructuredData::Dictionary &data_dict, 2050b57cec5SDimitry Andric Status &error); 2060b57cec5SDimitry Andric SerializeToStructuredData()2070b57cec5SDimitry Andric virtual StructuredData::ObjectSP SerializeToStructuredData() { 2080b57cec5SDimitry Andric return StructuredData::ObjectSP(); 2090b57cec5SDimitry Andric } 2100b57cec5SDimitry Andric GetSerializationKey()2110b57cec5SDimitry Andric static const char *GetSerializationKey() { return "SearchFilter"; } 2120b57cec5SDimitry Andric GetSerializationSubclassKey()2130b57cec5SDimitry Andric static const char *GetSerializationSubclassKey() { return "Type"; } 2140b57cec5SDimitry Andric GetSerializationSubclassOptionsKey()2150b57cec5SDimitry Andric static const char *GetSerializationSubclassOptionsKey() { return "Options"; } 2160b57cec5SDimitry Andric 2170b57cec5SDimitry Andric enum FilterTy { 2180b57cec5SDimitry Andric Unconstrained = 0, 2190b57cec5SDimitry Andric Exception, 2200b57cec5SDimitry Andric ByModule, 2210b57cec5SDimitry Andric ByModules, 2220b57cec5SDimitry Andric ByModulesAndCU, 2230b57cec5SDimitry Andric LastKnownFilterType = ByModulesAndCU, 2240b57cec5SDimitry Andric UnknownFilter 2250b57cec5SDimitry Andric }; 2260b57cec5SDimitry Andric 2270b57cec5SDimitry Andric static const char *g_ty_to_name[LastKnownFilterType + 2]; 2280b57cec5SDimitry Andric GetFilterTy()2290b57cec5SDimitry Andric enum FilterTy GetFilterTy() { 2300b57cec5SDimitry Andric if (SubclassID > FilterTy::LastKnownFilterType) 2310b57cec5SDimitry Andric return FilterTy::UnknownFilter; 2320b57cec5SDimitry Andric else 2330b57cec5SDimitry Andric return (enum FilterTy)SubclassID; 2340b57cec5SDimitry Andric } 2350b57cec5SDimitry Andric GetFilterName()2360b57cec5SDimitry Andric const char *GetFilterName() { return FilterTyToName(GetFilterTy()); } 2370b57cec5SDimitry Andric 2380b57cec5SDimitry Andric static const char *FilterTyToName(enum FilterTy); 2390b57cec5SDimitry Andric 2400b57cec5SDimitry Andric static FilterTy NameToFilterTy(llvm::StringRef name); 2410b57cec5SDimitry Andric 2420b57cec5SDimitry Andric protected: 2430b57cec5SDimitry Andric // Serialization of SearchFilter options: 2440b57cec5SDimitry Andric enum OptionNames { ModList = 0, CUList, LanguageName, LastOptionName }; 2450b57cec5SDimitry Andric static const char *g_option_names[LastOptionName]; 2460b57cec5SDimitry Andric GetKey(enum OptionNames enum_value)2470b57cec5SDimitry Andric static const char *GetKey(enum OptionNames enum_value) { 2480b57cec5SDimitry Andric return g_option_names[enum_value]; 2490b57cec5SDimitry Andric } 2500b57cec5SDimitry Andric 2510b57cec5SDimitry Andric StructuredData::DictionarySP 2520b57cec5SDimitry Andric WrapOptionsDict(StructuredData::DictionarySP options_dict_sp); 2530b57cec5SDimitry Andric 2540b57cec5SDimitry Andric void SerializeFileSpecList(StructuredData::DictionarySP &options_dict_sp, 2550b57cec5SDimitry Andric OptionNames name, FileSpecList &file_list); 2560b57cec5SDimitry Andric 2570b57cec5SDimitry Andric // These are utility functions to assist with the search iteration. They are 2580b57cec5SDimitry Andric // used by the default Search method. 2590b57cec5SDimitry Andric 2600b57cec5SDimitry Andric Searcher::CallbackReturn DoModuleIteration(const SymbolContext &context, 2610b57cec5SDimitry Andric Searcher &searcher); 2620b57cec5SDimitry Andric 2630b57cec5SDimitry Andric Searcher::CallbackReturn DoModuleIteration(const lldb::ModuleSP &module_sp, 2640b57cec5SDimitry Andric Searcher &searcher); 2650b57cec5SDimitry Andric 2660b57cec5SDimitry Andric Searcher::CallbackReturn DoCUIteration(const lldb::ModuleSP &module_sp, 2670b57cec5SDimitry Andric const SymbolContext &context, 2680b57cec5SDimitry Andric Searcher &searcher); 2690b57cec5SDimitry Andric 2700b57cec5SDimitry Andric Searcher::CallbackReturn DoFunctionIteration(Function *function, 2710b57cec5SDimitry Andric const SymbolContext &context, 2720b57cec5SDimitry Andric Searcher &searcher); 2730b57cec5SDimitry Andric 2745ffd83dbSDimitry Andric virtual lldb::SearchFilterSP DoCreateCopy() = 0; 2750b57cec5SDimitry Andric SetTarget(lldb::TargetSP & target_sp)2760b57cec5SDimitry Andric void SetTarget(lldb::TargetSP &target_sp) { m_target_sp = target_sp; } 2770b57cec5SDimitry Andric 2785ffd83dbSDimitry Andric lldb::TargetSP m_target_sp; // Every filter has to be associated with 2795ffd83dbSDimitry Andric // a target for now since you need a starting 2805ffd83dbSDimitry Andric // place for the search. 2810b57cec5SDimitry Andric private: 2820b57cec5SDimitry Andric unsigned char SubclassID; 2830b57cec5SDimitry Andric }; 2840b57cec5SDimitry Andric 2850b57cec5SDimitry Andric /// \class SearchFilterForUnconstrainedSearches SearchFilter.h 2860b57cec5SDimitry Andric /// "lldb/Core/SearchFilter.h" This is a SearchFilter that searches through 2870b57cec5SDimitry Andric /// all modules. It also consults the 2880b57cec5SDimitry Andric /// Target::ModuleIsExcludedForUnconstrainedSearches. 2890b57cec5SDimitry Andric class SearchFilterForUnconstrainedSearches : public SearchFilter { 2900b57cec5SDimitry Andric public: SearchFilterForUnconstrainedSearches(const lldb::TargetSP & target_sp)2910b57cec5SDimitry Andric SearchFilterForUnconstrainedSearches(const lldb::TargetSP &target_sp) 2920b57cec5SDimitry Andric : SearchFilter(target_sp, FilterTy::Unconstrained) {} 2930b57cec5SDimitry Andric 2940b57cec5SDimitry Andric ~SearchFilterForUnconstrainedSearches() override = default; 2950b57cec5SDimitry Andric 2960b57cec5SDimitry Andric bool ModulePasses(const FileSpec &module_spec) override; 2970b57cec5SDimitry Andric 2980b57cec5SDimitry Andric bool ModulePasses(const lldb::ModuleSP &module_sp) override; 2990b57cec5SDimitry Andric 3000b57cec5SDimitry Andric static lldb::SearchFilterSP 3015ffd83dbSDimitry Andric CreateFromStructuredData(const lldb::TargetSP& target_sp, 3020b57cec5SDimitry Andric const StructuredData::Dictionary &data_dict, 3030b57cec5SDimitry Andric Status &error); 3040b57cec5SDimitry Andric 3050b57cec5SDimitry Andric StructuredData::ObjectSP SerializeToStructuredData() override; 3060b57cec5SDimitry Andric 3070b57cec5SDimitry Andric protected: 3085ffd83dbSDimitry Andric lldb::SearchFilterSP DoCreateCopy() override; 3090b57cec5SDimitry Andric }; 3100b57cec5SDimitry Andric 3110b57cec5SDimitry Andric /// \class SearchFilterByModule SearchFilter.h "lldb/Core/SearchFilter.h" This 3120b57cec5SDimitry Andric /// is a SearchFilter that restricts the search to a given module. 3130b57cec5SDimitry Andric 3140b57cec5SDimitry Andric class SearchFilterByModule : public SearchFilter { 3150b57cec5SDimitry Andric public: 3160b57cec5SDimitry Andric /// The basic constructor takes a Target, which gives the space to search, 3170b57cec5SDimitry Andric /// and the module to restrict the search to. 3180b57cec5SDimitry Andric /// 319480093f4SDimitry Andric /// \param[in] targetSP 3200b57cec5SDimitry Andric /// The Target that provides the module list to search. 3210b57cec5SDimitry Andric /// 3220b57cec5SDimitry Andric /// \param[in] module 3230b57cec5SDimitry Andric /// The Module that limits the search. 3240b57cec5SDimitry Andric SearchFilterByModule(const lldb::TargetSP &targetSP, const FileSpec &module); 3250b57cec5SDimitry Andric 3260b57cec5SDimitry Andric ~SearchFilterByModule() override; 3270b57cec5SDimitry Andric 3280b57cec5SDimitry Andric bool ModulePasses(const lldb::ModuleSP &module_sp) override; 3290b57cec5SDimitry Andric 3300b57cec5SDimitry Andric bool ModulePasses(const FileSpec &spec) override; 3310b57cec5SDimitry Andric 3320b57cec5SDimitry Andric bool AddressPasses(Address &address) override; 3330b57cec5SDimitry Andric 3340b57cec5SDimitry Andric void GetDescription(Stream *s) override; 3350b57cec5SDimitry Andric 3360b57cec5SDimitry Andric uint32_t GetFilterRequiredItems() override; 3370b57cec5SDimitry Andric 3380b57cec5SDimitry Andric void Dump(Stream *s) const override; 3390b57cec5SDimitry Andric 3400b57cec5SDimitry Andric void Search(Searcher &searcher) override; 3410b57cec5SDimitry Andric 3420b57cec5SDimitry Andric static lldb::SearchFilterSP 3435ffd83dbSDimitry Andric CreateFromStructuredData(const lldb::TargetSP& target_sp, 3440b57cec5SDimitry Andric const StructuredData::Dictionary &data_dict, 3450b57cec5SDimitry Andric Status &error); 3460b57cec5SDimitry Andric 3470b57cec5SDimitry Andric StructuredData::ObjectSP SerializeToStructuredData() override; 3480b57cec5SDimitry Andric 3490b57cec5SDimitry Andric protected: 3505ffd83dbSDimitry Andric lldb::SearchFilterSP DoCreateCopy() override; 3510b57cec5SDimitry Andric 3520b57cec5SDimitry Andric private: 3530b57cec5SDimitry Andric FileSpec m_module_spec; 3540b57cec5SDimitry Andric }; 3550b57cec5SDimitry Andric 3560b57cec5SDimitry Andric class SearchFilterByModuleList : public SearchFilter { 3570b57cec5SDimitry Andric public: 3580b57cec5SDimitry Andric /// The basic constructor takes a Target, which gives the space to search, 3590b57cec5SDimitry Andric /// and the module list to restrict the search to. 3600b57cec5SDimitry Andric /// 361480093f4SDimitry Andric /// \param[in] targetSP 3620b57cec5SDimitry Andric /// The Target that provides the module list to search. 3630b57cec5SDimitry Andric /// 364480093f4SDimitry Andric /// \param[in] module_list 3650b57cec5SDimitry Andric /// The Module that limits the search. 3660b57cec5SDimitry Andric SearchFilterByModuleList(const lldb::TargetSP &targetSP, 3670b57cec5SDimitry Andric const FileSpecList &module_list); 3680b57cec5SDimitry Andric 3690b57cec5SDimitry Andric SearchFilterByModuleList(const lldb::TargetSP &targetSP, 3700b57cec5SDimitry Andric const FileSpecList &module_list, 3710b57cec5SDimitry Andric enum FilterTy filter_ty); 3720b57cec5SDimitry Andric 3730b57cec5SDimitry Andric ~SearchFilterByModuleList() override; 3740b57cec5SDimitry Andric 3750b57cec5SDimitry Andric bool ModulePasses(const lldb::ModuleSP &module_sp) override; 3760b57cec5SDimitry Andric 3770b57cec5SDimitry Andric bool ModulePasses(const FileSpec &spec) override; 3780b57cec5SDimitry Andric 3790b57cec5SDimitry Andric bool AddressPasses(Address &address) override; 3800b57cec5SDimitry Andric 3810b57cec5SDimitry Andric void GetDescription(Stream *s) override; 3820b57cec5SDimitry Andric 3830b57cec5SDimitry Andric uint32_t GetFilterRequiredItems() override; 3840b57cec5SDimitry Andric 3850b57cec5SDimitry Andric void Dump(Stream *s) const override; 3860b57cec5SDimitry Andric 3870b57cec5SDimitry Andric void Search(Searcher &searcher) override; 3880b57cec5SDimitry Andric 3890b57cec5SDimitry Andric static lldb::SearchFilterSP 3905ffd83dbSDimitry Andric CreateFromStructuredData(const lldb::TargetSP& target_sp, 3910b57cec5SDimitry Andric const StructuredData::Dictionary &data_dict, 3920b57cec5SDimitry Andric Status &error); 3930b57cec5SDimitry Andric 3940b57cec5SDimitry Andric StructuredData::ObjectSP SerializeToStructuredData() override; 3950b57cec5SDimitry Andric 3960b57cec5SDimitry Andric void SerializeUnwrapped(StructuredData::DictionarySP &options_dict_sp); 3970b57cec5SDimitry Andric 3980b57cec5SDimitry Andric protected: 3995ffd83dbSDimitry Andric lldb::SearchFilterSP DoCreateCopy() override; 4000b57cec5SDimitry Andric 4010b57cec5SDimitry Andric FileSpecList m_module_spec_list; 4020b57cec5SDimitry Andric }; 4030b57cec5SDimitry Andric 4040b57cec5SDimitry Andric class SearchFilterByModuleListAndCU : public SearchFilterByModuleList { 4050b57cec5SDimitry Andric public: 4060b57cec5SDimitry Andric /// The basic constructor takes a Target, which gives the space to search, 4070b57cec5SDimitry Andric /// and the module list to restrict the search to. 4080b57cec5SDimitry Andric SearchFilterByModuleListAndCU(const lldb::TargetSP &targetSP, 4090b57cec5SDimitry Andric const FileSpecList &module_list, 4100b57cec5SDimitry Andric const FileSpecList &cu_list); 4110b57cec5SDimitry Andric 4120b57cec5SDimitry Andric ~SearchFilterByModuleListAndCU() override; 4130b57cec5SDimitry Andric 4140b57cec5SDimitry Andric bool AddressPasses(Address &address) override; 4150b57cec5SDimitry Andric 4160b57cec5SDimitry Andric bool CompUnitPasses(FileSpec &fileSpec) override; 4170b57cec5SDimitry Andric 4180b57cec5SDimitry Andric bool CompUnitPasses(CompileUnit &compUnit) override; 4190b57cec5SDimitry Andric 4200b57cec5SDimitry Andric void GetDescription(Stream *s) override; 4210b57cec5SDimitry Andric 4220b57cec5SDimitry Andric uint32_t GetFilterRequiredItems() override; 4230b57cec5SDimitry Andric 4240b57cec5SDimitry Andric void Dump(Stream *s) const override; 4250b57cec5SDimitry Andric 4260b57cec5SDimitry Andric void Search(Searcher &searcher) override; 4270b57cec5SDimitry Andric 4280b57cec5SDimitry Andric static lldb::SearchFilterSP 4295ffd83dbSDimitry Andric CreateFromStructuredData(const lldb::TargetSP& target_sp, 4300b57cec5SDimitry Andric const StructuredData::Dictionary &data_dict, 4310b57cec5SDimitry Andric Status &error); 4320b57cec5SDimitry Andric 4330b57cec5SDimitry Andric StructuredData::ObjectSP SerializeToStructuredData() override; 4340b57cec5SDimitry Andric 4350b57cec5SDimitry Andric protected: 4365ffd83dbSDimitry Andric lldb::SearchFilterSP DoCreateCopy() override; 4370b57cec5SDimitry Andric 4380b57cec5SDimitry Andric private: 4390b57cec5SDimitry Andric FileSpecList m_cu_spec_list; 4400b57cec5SDimitry Andric }; 4410b57cec5SDimitry Andric 4420b57cec5SDimitry Andric } // namespace lldb_private 4430b57cec5SDimitry Andric 4445ffd83dbSDimitry Andric #endif // LLDB_CORE_SEARCHFILTER_H 445