1 //===-- BreakpointResolverScripted.h -----------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef liblldb_BreakpointResolverScripted_h_ 11 #define liblldb_BreakpointResolverScripted_h_ 12 13 #include "lldb/lldb-forward.h" 14 #include "lldb/Breakpoint/BreakpointResolver.h" 15 #include "lldb/Core/ModuleSpec.h" 16 17 18 namespace lldb_private { 19 20 //---------------------------------------------------------------------- 21 /// @class BreakpointResolverScripted BreakpointResolverScripted.h 22 /// "lldb/Breakpoint/BreakpointResolverScripted.h" This class sets breakpoints 23 /// on a given Address. This breakpoint only takes once, and then it won't 24 /// attempt to reset itself. 25 //---------------------------------------------------------------------- 26 27 class BreakpointResolverScripted : public BreakpointResolver { 28 public: 29 BreakpointResolverScripted(Breakpoint *bkpt, 30 const llvm::StringRef class_name, 31 lldb::SearchDepth depth, 32 StructuredDataImpl *args_data, 33 ScriptInterpreter &script_interp); 34 35 ~BreakpointResolverScripted() override; 36 37 static BreakpointResolver * 38 CreateFromStructuredData(Breakpoint *bkpt, 39 const StructuredData::Dictionary &options_dict, 40 Status &error); 41 42 StructuredData::ObjectSP SerializeToStructuredData() override; 43 44 Searcher::CallbackReturn SearchCallback(SearchFilter &filter, 45 SymbolContext &context, Address *addr, 46 bool containing) override; 47 48 lldb::SearchDepth GetDepth() override; 49 50 void GetDescription(Stream *s) override; 51 52 void Dump(Stream *s) const override; 53 54 /// Methods for support type inquiry through isa, cast, and dyn_cast: classof(const BreakpointResolverScripted *)55 static inline bool classof(const BreakpointResolverScripted *) { return true; } classof(const BreakpointResolver * V)56 static inline bool classof(const BreakpointResolver *V) { 57 return V->getResolverID() == BreakpointResolver::PythonResolver; 58 } 59 60 lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override; 61 62 protected: 63 void NotifyBreakpointSet() override; 64 private: 65 void CreateImplementationIfNeeded(); 66 ScriptInterpreter *GetScriptInterpreter(); 67 68 std::string m_class_name; 69 lldb::SearchDepth m_depth; 70 StructuredDataImpl *m_args_ptr; // We own this, but the implementation 71 // has to manage the UP (since that is 72 // how it gets stored in the 73 // SBStructuredData). 74 StructuredData::GenericSP m_implementation_sp; 75 76 DISALLOW_COPY_AND_ASSIGN(BreakpointResolverScripted); 77 }; 78 79 } // namespace lldb_private 80 81 #endif // liblldb_BreakpointResolverScripted_h_ 82