1 //===-- BreakpointResolverName.h --------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef liblldb_BreakpointResolverName_h_ 10 #define liblldb_BreakpointResolverName_h_ 11 12 #include <string> 13 #include <vector> 14 15 #include "lldb/Breakpoint/BreakpointResolver.h" 16 #include "lldb/Core/Module.h" 17 18 namespace lldb_private { 19 20 /// \class BreakpointResolverName BreakpointResolverName.h 21 /// "lldb/Breakpoint/BreakpointResolverName.h" This class sets breakpoints on 22 /// a given function name, either by exact match or by regular expression. 23 24 class BreakpointResolverName : public BreakpointResolver { 25 public: 26 BreakpointResolverName(Breakpoint *bkpt, const char *name, 27 lldb::FunctionNameType name_type_mask, 28 lldb::LanguageType language, 29 Breakpoint::MatchType type, lldb::addr_t offset, 30 bool skip_prologue); 31 32 // This one takes an array of names. It is always MatchType = Exact. 33 BreakpointResolverName(Breakpoint *bkpt, const char *names[], 34 size_t num_names, 35 lldb::FunctionNameType name_type_mask, 36 lldb::LanguageType language, lldb::addr_t offset, 37 bool skip_prologue); 38 39 // This one takes a C++ array of names. It is always MatchType = Exact. 40 BreakpointResolverName(Breakpoint *bkpt, std::vector<std::string> names, 41 lldb::FunctionNameType name_type_mask, 42 lldb::LanguageType language, lldb::addr_t offset, 43 bool skip_prologue); 44 45 // Creates a function breakpoint by regular expression. Takes over control 46 // of the lifespan of func_regex. 47 BreakpointResolverName(Breakpoint *bkpt, RegularExpression &func_regex, 48 lldb::LanguageType language, lldb::addr_t offset, 49 bool skip_prologue); 50 51 static BreakpointResolver * 52 CreateFromStructuredData(Breakpoint *bkpt, 53 const StructuredData::Dictionary &data_dict, 54 Status &error); 55 56 StructuredData::ObjectSP SerializeToStructuredData() override; 57 58 ~BreakpointResolverName() override; 59 60 Searcher::CallbackReturn SearchCallback(SearchFilter &filter, 61 SymbolContext &context, Address *addr, 62 bool containing) override; 63 64 lldb::SearchDepth GetDepth() override; 65 66 void GetDescription(Stream *s) override; 67 68 void Dump(Stream *s) const override; 69 70 /// Methods for support type inquiry through isa, cast, and dyn_cast: 71 static inline bool classof(const BreakpointResolverName *) { return true; } 72 static inline bool classof(const BreakpointResolver *V) { 73 return V->getResolverID() == BreakpointResolver::NameResolver; 74 } 75 76 lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override; 77 78 protected: 79 BreakpointResolverName(const BreakpointResolverName &rhs); 80 81 std::vector<Module::LookupInfo> m_lookups; 82 ConstString m_class_name; 83 RegularExpression m_regex; 84 Breakpoint::MatchType m_match_type; 85 lldb::LanguageType m_language; 86 bool m_skip_prologue; 87 88 void AddNameLookup(ConstString name, 89 lldb::FunctionNameType name_type_mask); 90 }; 91 92 } // namespace lldb_private 93 94 #endif // liblldb_BreakpointResolverName_h_ 95