@@ -35,7 +35,7 @@ BreakpointResolverScripted::BreakpointResolverScripted(
3535
3636void BreakpointResolverScripted::CreateImplementationIfNeeded (
3737 BreakpointSP breakpoint_sp) {
38- if (m_implementation_sp )
38+ if (m_interface_sp )
3939 return ;
4040
4141 if (m_class_name.empty ())
@@ -50,8 +50,27 @@ void BreakpointResolverScripted::CreateImplementationIfNeeded(
5050 if (!script_interp)
5151 return ;
5252
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+ }
5574}
5675
5776void BreakpointResolverScripted::NotifyBreakpointSet () {
@@ -104,13 +123,10 @@ ScriptInterpreter *BreakpointResolverScripted::GetScriptInterpreter() {
104123Searcher::CallbackReturn BreakpointResolverScripted::SearchCallback (
105124 SearchFilter &filter, SymbolContext &context, Address *addr) {
106125 bool should_continue = true ;
107- if (!m_implementation_sp )
126+ if (!m_interface_sp )
108127 return Searcher::eCallbackReturnStop;
109128
110- ScriptInterpreter *interp = GetScriptInterpreter ();
111- should_continue = interp->ScriptedBreakpointResolverSearchCallback (
112- m_implementation_sp,
113- &context);
129+ should_continue = m_interface_sp->ResolverCallback (context);
114130 if (should_continue)
115131 return Searcher::eCallbackReturnContinue;
116132
@@ -120,25 +136,21 @@ Searcher::CallbackReturn BreakpointResolverScripted::SearchCallback(
120136lldb::SearchDepth
121137BreakpointResolverScripted::GetDepth () {
122138 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+
128142 return depth;
129143}
130144
131145void BreakpointResolverScripted::GetDescription (Stream *s) {
132146 StructuredData::GenericSP generic_sp;
133- std::string short_help;
147+ std::optional<std:: string> short_help;
134148
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 ();
139151 }
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 ());
142154 else
143155 s->Printf (" python class = %s" , m_class_name.c_str ());
144156}
0 commit comments