Switch the ScriptedBreakpointResolver over to the ScriptedInterface form (#150720)
This is NFC, I'm modernizing the interface before I add to it in a subsequent commit.
This commit is contained in:
1 parent
6bcff9eb13
commit
4c8e79f815
22 files changed
+328
-217
No files matched your search
@@ -1550,6 +1550,11 @@ ScriptInterpreterPythonImpl::CreateScriptedStopHookInterface() {
|
||||
return std::make_shared<ScriptedStopHookPythonInterface>(*this);
|
||||
}
|
||||
|
||||
ScriptedBreakpointInterfaceSP
|
||||
ScriptInterpreterPythonImpl::CreateScriptedBreakpointInterface() {
|
||||
return std::make_shared<ScriptedBreakpointPythonInterface>(*this);
|
||||
}
|
||||
|
||||
ScriptedThreadInterfaceSP
|
||||
ScriptInterpreterPythonImpl::CreateScriptedThreadInterface() {
|
||||
return std::make_shared<ScriptedThreadPythonInterface>(*this);
|
||||
@@ -1576,75 +1581,6 @@ ScriptInterpreterPythonImpl::CreateStructuredDataFromScriptObject(
|
||||
return py_obj.CreateStructuredObject();
|
||||
}
|
||||
|
||||
StructuredData::GenericSP
|
||||
ScriptInterpreterPythonImpl::CreateScriptedBreakpointResolver(
|
||||
const char *class_name, const StructuredDataImpl &args_data,
|
||||
lldb::BreakpointSP &bkpt_sp) {
|
||||
|
||||
if (class_name == nullptr || class_name[0] == '\0')
|
||||
return StructuredData::GenericSP();
|
||||
|
||||
if (!bkpt_sp.get())
|
||||
return StructuredData::GenericSP();
|
||||
|
||||
Debugger &debugger = bkpt_sp->GetTarget().GetDebugger();
|
||||
ScriptInterpreterPythonImpl *python_interpreter =
|
||||
GetPythonInterpreter(debugger);
|
||||
|
||||
if (!python_interpreter)
|
||||
return StructuredData::GenericSP();
|
||||
|
||||
Locker py_lock(this,
|
||||
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
|
||||
|
||||
PythonObject ret_val =
|
||||
SWIGBridge::LLDBSwigPythonCreateScriptedBreakpointResolver(
|
||||
class_name, python_interpreter->m_dictionary_name.c_str(), args_data,
|
||||
bkpt_sp);
|
||||
|
||||
return StructuredData::GenericSP(
|
||||
new StructuredPythonObject(std::move(ret_val)));
|
||||
}
|
||||
|
||||
bool ScriptInterpreterPythonImpl::ScriptedBreakpointResolverSearchCallback(
|
||||
StructuredData::GenericSP implementor_sp, SymbolContext *sym_ctx) {
|
||||
bool should_continue = false;
|
||||
|
||||
if (implementor_sp) {
|
||||
Locker py_lock(this,
|
||||
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
|
||||
should_continue = SWIGBridge::LLDBSwigPythonCallBreakpointResolver(
|
||||
implementor_sp->GetValue(), "__callback__", sym_ctx);
|
||||
if (PyErr_Occurred()) {
|
||||
PyErr_Print();
|
||||
PyErr_Clear();
|
||||
}
|
||||
}
|
||||
return should_continue;
|
||||
}
|
||||
|
||||
lldb::SearchDepth
|
||||
ScriptInterpreterPythonImpl::ScriptedBreakpointResolverSearchDepth(
|
||||
StructuredData::GenericSP implementor_sp) {
|
||||
int depth_as_int = lldb::eSearchDepthModule;
|
||||
if (implementor_sp) {
|
||||
Locker py_lock(this,
|
||||
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
|
||||
depth_as_int = SWIGBridge::LLDBSwigPythonCallBreakpointResolver(
|
||||
implementor_sp->GetValue(), "__get_depth__", nullptr);
|
||||
if (PyErr_Occurred()) {
|
||||
PyErr_Print();
|
||||
PyErr_Clear();
|
||||
}
|
||||
}
|
||||
if (depth_as_int == lldb::eSearchDepthInvalid)
|
||||
return lldb::eSearchDepthModule;
|
||||
|
||||
if (depth_as_int <= lldb::kLastSearchDepthKind)
|
||||
return (lldb::SearchDepth)depth_as_int;
|
||||
return lldb::eSearchDepthModule;
|
||||
}
|
||||
|
||||
StructuredData::ObjectSP
|
||||
ScriptInterpreterPythonImpl::LoadPluginModule(const FileSpec &file_spec,
|
||||
lldb_private::Status &error) {
|
||||
|
||||
Reference in new issue
Block a user