@@ -35,7 +35,7 @@ BreakpointResolverScripted::BreakpointResolverScripted(
35
35
36
36
void BreakpointResolverScripted::CreateImplementationIfNeeded (
37
37
BreakpointSP breakpoint_sp) {
38
- if (m_implementation_sp )
38
+ if (m_interface_sp )
39
39
return ;
40
40
41
41
if (m_class_name.empty ())
@@ -50,8 +50,27 @@ void BreakpointResolverScripted::CreateImplementationIfNeeded(
50
50
if (!script_interp)
51
51
return ;
52
52
53
- m_implementation_sp = script_interp->CreateScriptedBreakpointResolver (
54
- m_class_name.c_str (), m_args, breakpoint_sp);
53
+ m_interface_sp = script_interp->CreateScriptedBreakpointInterface ();
54
+ if (!m_interface_sp) {
55
+ m_error = Status::FromErrorStringWithFormat (
56
+ " BreakpointResolverScripted::%s () - ERROR: %s" , __FUNCTION__,
57
+ " Script interpreter couldn't create Scripted Breakpoint Interface" );
58
+ return ;
59
+ }
60
+
61
+ auto obj_or_err =
62
+ m_interface_sp->CreatePluginObject (m_class_name, breakpoint_sp, m_args);
63
+ if (!obj_or_err) {
64
+ m_error = Status::FromError (obj_or_err.takeError ());
65
+ return ;
66
+ }
67
+
68
+ StructuredData::ObjectSP object_sp = *obj_or_err;
69
+ if (!object_sp || !object_sp->IsValid ()) {
70
+ m_error = Status::FromErrorStringWithFormat (
71
+ " ScriptedBreakpoint::%s () - ERROR: %s" , __FUNCTION__,
72
+ " Failed to create valid script object" );
73
+ }
55
74
}
56
75
57
76
void BreakpointResolverScripted::NotifyBreakpointSet () {
@@ -104,13 +123,10 @@ ScriptInterpreter *BreakpointResolverScripted::GetScriptInterpreter() {
104
123
Searcher::CallbackReturn BreakpointResolverScripted::SearchCallback (
105
124
SearchFilter &filter, SymbolContext &context, Address *addr) {
106
125
bool should_continue = true ;
107
- if (!m_implementation_sp )
126
+ if (!m_interface_sp )
108
127
return Searcher::eCallbackReturnStop;
109
128
110
- ScriptInterpreter *interp = GetScriptInterpreter ();
111
- should_continue = interp->ScriptedBreakpointResolverSearchCallback (
112
- m_implementation_sp,
113
- &context);
129
+ should_continue = m_interface_sp->ResolverCallback (context);
114
130
if (should_continue)
115
131
return Searcher::eCallbackReturnContinue;
116
132
@@ -120,25 +136,21 @@ Searcher::CallbackReturn BreakpointResolverScripted::SearchCallback(
120
136
lldb::SearchDepth
121
137
BreakpointResolverScripted::GetDepth () {
122
138
lldb::SearchDepth depth = lldb::eSearchDepthModule;
123
- if (m_implementation_sp) {
124
- ScriptInterpreter *interp = GetScriptInterpreter ();
125
- depth = interp->ScriptedBreakpointResolverSearchDepth (
126
- m_implementation_sp);
127
- }
139
+ if (m_interface_sp)
140
+ depth = m_interface_sp->GetDepth ();
141
+
128
142
return depth;
129
143
}
130
144
131
145
void BreakpointResolverScripted::GetDescription (Stream *s) {
132
146
StructuredData::GenericSP generic_sp;
133
- std::string short_help;
147
+ std::optional<std:: string> short_help;
134
148
135
- if (m_implementation_sp) {
136
- ScriptInterpreter *interp = GetScriptInterpreter ();
137
- interp->GetShortHelpForCommandObject (m_implementation_sp,
138
- short_help);
149
+ if (m_interface_sp) {
150
+ short_help = m_interface_sp->GetShortHelp ();
139
151
}
140
- if (!short_help. empty ())
141
- s->PutCString (short_help. c_str ());
152
+ if (short_help && !short_help-> empty ())
153
+ s->PutCString (short_help-> c_str ());
142
154
else
143
155
s->Printf (" python class = %s" , m_class_name.c_str ());
144
156
}
0 commit comments