1 //===-- BreakpointResolverFileRegex.h ----------------------------*- C++ 2 //-*-===// 3 // 4 // The LLVM Compiler Infrastructure 5 // 6 // This file is distributed under the University of Illinois Open Source 7 // License. See LICENSE.TXT for details. 8 // 9 //===----------------------------------------------------------------------===// 10 11 #ifndef liblldb_BreakpointResolverFileRegex_h_ 12 #define liblldb_BreakpointResolverFileRegex_h_ 13 14 #include <set> 15 #include "lldb/Breakpoint/BreakpointResolver.h" 16 #include "lldb/Utility/ConstString.h" 17 18 namespace lldb_private { 19 20 //---------------------------------------------------------------------- 21 /// @class BreakpointResolverFileRegex BreakpointResolverFileRegex.h 22 /// "lldb/Breakpoint/BreakpointResolverFileRegex.h" This class sets 23 /// breakpoints by file and line. Optionally, it will look for inlined 24 /// instances of the file and line specification. 25 //---------------------------------------------------------------------- 26 27 class BreakpointResolverFileRegex : public BreakpointResolver { 28 public: 29 BreakpointResolverFileRegex( 30 Breakpoint *bkpt, RegularExpression ®ex, 31 const std::unordered_set<std::string> &func_name_set, bool exact_match); 32 33 static BreakpointResolver * 34 CreateFromStructuredData(Breakpoint *bkpt, 35 const StructuredData::Dictionary &options_dict, 36 Status &error); 37 38 StructuredData::ObjectSP SerializeToStructuredData() override; 39 40 ~BreakpointResolverFileRegex() override; 41 42 Searcher::CallbackReturn SearchCallback(SearchFilter &filter, 43 SymbolContext &context, Address *addr, 44 bool containing) override; 45 46 lldb::SearchDepth GetDepth() override; 47 48 void GetDescription(Stream *s) override; 49 50 void Dump(Stream *s) const override; 51 52 void AddFunctionName(const char *func_name); 53 54 /// Methods for support type inquiry through isa, cast, and dyn_cast: classof(const BreakpointResolverFileRegex *)55 static inline bool classof(const BreakpointResolverFileRegex *) { 56 return true; 57 } classof(const BreakpointResolver * V)58 static inline bool classof(const BreakpointResolver *V) { 59 return V->getResolverID() == BreakpointResolver::FileRegexResolver; 60 } 61 62 lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override; 63 64 protected: 65 friend class Breakpoint; 66 RegularExpression 67 m_regex; // This is the line expression that we are looking for. 68 bool m_exact_match; // If true, then if the source we match is in a comment, 69 // we won't set a location there. 70 std::unordered_set<std::string> m_function_names; // Limit the search to 71 // functions in the 72 // comp_unit passed in. 73 74 private: 75 DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileRegex); 76 }; 77 78 } // namespace lldb_private 79 80 #endif // liblldb_BreakpointResolverFileRegex_h_ 81