BreakpointResolverScripted.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //===-- BreakpointResolverScripted.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. #ifndef LLDB_BREAKPOINT_BREAKPOINTRESOLVERSCRIPTED_H
  9. #define LLDB_BREAKPOINT_BREAKPOINTRESOLVERSCRIPTED_H
  10. #include "lldb/lldb-forward.h"
  11. #include "lldb/Breakpoint/BreakpointResolver.h"
  12. #include "lldb/Core/ModuleSpec.h"
  13. namespace lldb_private {
  14. /// \class BreakpointResolverScripted BreakpointResolverScripted.h
  15. /// "lldb/Breakpoint/BreakpointResolverScripted.h" This class sets breakpoints
  16. /// on a given Address. This breakpoint only takes once, and then it won't
  17. /// attempt to reset itself.
  18. class BreakpointResolverScripted : public BreakpointResolver {
  19. public:
  20. BreakpointResolverScripted(const lldb::BreakpointSP &bkpt,
  21. const llvm::StringRef class_name,
  22. lldb::SearchDepth depth,
  23. StructuredDataImpl *args_data);
  24. ~BreakpointResolverScripted() override = default;
  25. static BreakpointResolver *
  26. CreateFromStructuredData(const lldb::BreakpointSP &bkpt,
  27. const StructuredData::Dictionary &options_dict,
  28. Status &error);
  29. StructuredData::ObjectSP SerializeToStructuredData() override;
  30. Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
  31. SymbolContext &context,
  32. Address *addr) override;
  33. lldb::SearchDepth GetDepth() override;
  34. void GetDescription(Stream *s) override;
  35. void Dump(Stream *s) const override;
  36. /// Methods for support type inquiry through isa, cast, and dyn_cast:
  37. static inline bool classof(const BreakpointResolverScripted *) { return true; }
  38. static inline bool classof(const BreakpointResolver *V) {
  39. return V->getResolverID() == BreakpointResolver::PythonResolver;
  40. }
  41. lldb::BreakpointResolverSP
  42. CopyForBreakpoint(lldb::BreakpointSP &breakpoint) override;
  43. protected:
  44. void NotifyBreakpointSet() override;
  45. private:
  46. void CreateImplementationIfNeeded(lldb::BreakpointSP bkpt);
  47. ScriptInterpreter *GetScriptInterpreter();
  48. std::string m_class_name;
  49. lldb::SearchDepth m_depth;
  50. StructuredDataImpl *m_args_ptr; // We own this, but the implementation
  51. // has to manage the UP (since that is
  52. // how it gets stored in the
  53. // SBStructuredData).
  54. StructuredData::GenericSP m_implementation_sp;
  55. BreakpointResolverScripted(const BreakpointResolverScripted &) = delete;
  56. const BreakpointResolverScripted &
  57. operator=(const BreakpointResolverScripted &) = delete;
  58. };
  59. } // namespace lldb_private
  60. #endif // LLDB_BREAKPOINT_BREAKPOINTRESOLVERSCRIPTED_H