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

source code of lldb/include/lldb/Breakpoint/BreakpointResolverScripted.h