From ef90c8a7f2f555cf312807d2bc83ffda45e8c2af Mon Sep 17 00:00:00 2001 From: Med Ismail Bennani Date: Tue, 24 Oct 2023 20:40:43 -0700 Subject: [PATCH] [lldb/Interpreter] Make ScriptedInterface Object creation more generic This patch changes the way plugin objects used with Scripted Interfaces are created. Instead of implementing a different SWIG method to create the object for every scripted interface, this patch makes the creation more generic by re-using some of the ScriptedPythonInterface templated Dispatch code. This patch also improves error handling of the object creation by returning an `llvm::Expected`. Signed-off-by: Med Ismail Bennani --- lldb/bindings/python/python-wrapper.swig | 43 ------- .../Interfaces/ScriptedInterface.h | 5 - .../Interfaces/ScriptedPlatformInterface.h | 7 +- .../Interfaces/ScriptedProcessInterface.h | 7 +- .../Interfaces/ScriptedThreadInterface.h | 7 +- .../Process/scripted/ScriptedProcess.cpp | 9 +- .../Process/scripted/ScriptedThread.cpp | 12 +- .../ScriptedPlatformPythonInterface.cpp | 26 +---- .../ScriptedPlatformPythonInterface.h | 2 +- .../ScriptedProcessPythonInterface.cpp | 26 +---- .../ScriptedProcessPythonInterface.h | 2 +- .../Interfaces/ScriptedPythonInterface.h | 106 +++++++++++++++++- .../ScriptedThreadPythonInterface.cpp | 36 ++---- .../ScriptedThreadPythonInterface.h | 2 +- .../Python/SWIGPythonBridge.h | 6 - .../Python/PythonTestSuite.cpp | 18 +-- 16 files changed, 161 insertions(+), 153 deletions(-) diff --git a/lldb/bindings/python/python-wrapper.swig b/lldb/bindings/python/python-wrapper.swig index cb54901e66d03c..17bc7b1f219870 100644 --- a/lldb/bindings/python/python-wrapper.swig +++ b/lldb/bindings/python/python-wrapper.swig @@ -229,49 +229,6 @@ PythonObject lldb_private::python::SWIGBridge::LLDBSwigPythonCreateCommandObject return pfunc(SWIGBridge::ToSWIGWrapper(std::move(debugger_sp)), dict); } -PythonObject lldb_private::python::SWIGBridge::LLDBSwigPythonCreateScriptedObject( - const char *python_class_name, const char *session_dictionary_name, - lldb::ExecutionContextRefSP exe_ctx_sp, - const lldb_private::StructuredDataImpl &args_impl, - std::string &error_string) { - if (python_class_name == NULL || python_class_name[0] == '\0' || - !session_dictionary_name) - return PythonObject(); - - PyErr_Cleaner py_err_cleaner(true); - - auto dict = PythonModule::MainModule().ResolveName( - session_dictionary_name); - auto pfunc = PythonObject::ResolveNameWithDictionary( - python_class_name, dict); - - if (!pfunc.IsAllocated()) { - error_string.append("could not find script class: "); - error_string.append(python_class_name); - return PythonObject(); - } - - llvm::Expected arg_info = pfunc.GetArgInfo(); - if (!arg_info) { - llvm::handleAllErrors( - arg_info.takeError(), - [&](PythonException &E) { error_string.append(E.ReadBacktrace()); }, - [&](const llvm::ErrorInfoBase &E) { - error_string.append(E.message()); - }); - return PythonObject(); - } - - PythonObject result = {}; - if (arg_info.get().max_positional_args == 2) { - result = pfunc(SWIGBridge::ToSWIGWrapper(exe_ctx_sp), SWIGBridge::ToSWIGWrapper(args_impl)); - } else { - error_string.assign("wrong number of arguments in __init__, should be 2 " - "(not including self)"); - } - return result; -} - PythonObject lldb_private::python::SWIGBridge::LLDBSwigPythonCreateScriptedThreadPlan( const char *python_class_name, const char *session_dictionary_name, const lldb_private::StructuredDataImpl &args_impl, diff --git a/lldb/include/lldb/Interpreter/Interfaces/ScriptedInterface.h b/lldb/include/lldb/Interpreter/Interfaces/ScriptedInterface.h index 948f763e95ecea..2406f0f1f9aee2 100644 --- a/lldb/include/lldb/Interpreter/Interfaces/ScriptedInterface.h +++ b/lldb/include/lldb/Interpreter/Interfaces/ScriptedInterface.h @@ -25,11 +25,6 @@ class ScriptedInterface { ScriptedInterface() = default; virtual ~ScriptedInterface() = default; - virtual StructuredData::GenericSP - CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx, - StructuredData::DictionarySP args_sp, - StructuredData::Generic *script_obj = nullptr) = 0; - StructuredData::GenericSP GetScriptObjectInstance() { return m_object_instance_sp; } diff --git a/lldb/include/lldb/Interpreter/Interfaces/ScriptedPlatformInterface.h b/lldb/include/lldb/Interpreter/Interfaces/ScriptedPlatformInterface.h index c687cabfe0c127..dc3630fc75d9e1 100644 --- a/lldb/include/lldb/Interpreter/Interfaces/ScriptedPlatformInterface.h +++ b/lldb/include/lldb/Interpreter/Interfaces/ScriptedPlatformInterface.h @@ -19,11 +19,12 @@ namespace lldb_private { class ScriptedPlatformInterface : virtual public ScriptedInterface { public: - StructuredData::GenericSP + virtual llvm::Expected CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx, StructuredData::DictionarySP args_sp, - StructuredData::Generic *script_obj = nullptr) override { - return {}; + StructuredData::Generic *script_obj = nullptr) { + llvm_unreachable( + "Cannot create an instance of the ScriptedPlatformInterface!"); } virtual StructuredData::DictionarySP ListProcesses() { return {}; } diff --git a/lldb/include/lldb/Interpreter/Interfaces/ScriptedProcessInterface.h b/lldb/include/lldb/Interpreter/Interfaces/ScriptedProcessInterface.h index 68756c4d9ac858..3e50fb9b37bbc5 100644 --- a/lldb/include/lldb/Interpreter/Interfaces/ScriptedProcessInterface.h +++ b/lldb/include/lldb/Interpreter/Interfaces/ScriptedProcessInterface.h @@ -21,11 +21,12 @@ namespace lldb_private { class ScriptedProcessInterface : virtual public ScriptedInterface { public: - StructuredData::GenericSP + virtual llvm::Expected CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx, StructuredData::DictionarySP args_sp, - StructuredData::Generic *script_obj = nullptr) override { - return {}; + StructuredData::Generic *script_obj = nullptr) { + llvm_unreachable( + "Cannot create an instance of the ScriptedProcessInterface!"); } virtual StructuredData::DictionarySP GetCapabilities() { return {}; } diff --git a/lldb/include/lldb/Interpreter/Interfaces/ScriptedThreadInterface.h b/lldb/include/lldb/Interpreter/Interfaces/ScriptedThreadInterface.h index 781df51a213229..65ec2b0387df07 100644 --- a/lldb/include/lldb/Interpreter/Interfaces/ScriptedThreadInterface.h +++ b/lldb/include/lldb/Interpreter/Interfaces/ScriptedThreadInterface.h @@ -20,11 +20,12 @@ namespace lldb_private { class ScriptedThreadInterface : virtual public ScriptedInterface { public: - StructuredData::GenericSP + virtual llvm::Expected CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx, StructuredData::DictionarySP args_sp, - StructuredData::Generic *script_obj = nullptr) override { - return {}; + StructuredData::Generic *script_obj = nullptr) { + llvm_unreachable( + "Cannot create an instance of the ScriptedThreadInterface!"); } virtual lldb::tid_t GetThreadID() { return LLDB_INVALID_THREAD_ID; } diff --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp index e99a2a08bd50d8..e0e6693399dec3 100644 --- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp +++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp @@ -108,10 +108,17 @@ ScriptedProcess::ScriptedProcess(lldb::TargetSP target_sp, ExecutionContext exe_ctx(target_sp, /*get_process=*/false); // Create process script object - StructuredData::GenericSP object_sp = GetInterface().CreatePluginObject( + auto obj_or_err = GetInterface().CreatePluginObject( m_scripted_metadata.GetClassName(), exe_ctx, m_scripted_metadata.GetArgsSP()); + if (!obj_or_err) { + error.SetErrorString("Failed to create script object."); + return; + } + + StructuredData::GenericSP object_sp = *obj_or_err; + if (!object_sp || !object_sp->IsValid()) { error.SetErrorStringWithFormat("ScriptedProcess::%s () - ERROR: %s", __FUNCTION__, diff --git a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp index 684375957d2476..5a955fa1400926 100644 --- a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp +++ b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp @@ -56,14 +56,16 @@ ScriptedThread::Create(ScriptedProcess &process, } ExecutionContext exe_ctx(process); - StructuredData::GenericSP owned_script_object_sp = - scripted_thread_interface->CreatePluginObject( - thread_class_name, exe_ctx, process.m_scripted_metadata.GetArgsSP(), - script_object); + auto obj_or_err = scripted_thread_interface->CreatePluginObject( + thread_class_name, exe_ctx, process.m_scripted_metadata.GetArgsSP(), + script_object); - if (!owned_script_object_sp) + if (!obj_or_err) return llvm::createStringError(llvm::inconvertibleErrorCode(), "Failed to create script object."); + + StructuredData::GenericSP owned_script_object_sp = *obj_or_err; + if (!owned_script_object_sp->IsValid()) return llvm::createStringError(llvm::inconvertibleErrorCode(), "Created script object is invalid."); diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.cpp index 9bed33516915d0..9ba4731032bd35 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.cpp @@ -29,29 +29,15 @@ ScriptedPlatformPythonInterface::ScriptedPlatformPythonInterface( ScriptInterpreterPythonImpl &interpreter) : ScriptedPlatformInterface(), ScriptedPythonInterface(interpreter) {} -StructuredData::GenericSP ScriptedPlatformPythonInterface::CreatePluginObject( +llvm::Expected +ScriptedPlatformPythonInterface::CreatePluginObject( llvm::StringRef class_name, ExecutionContext &exe_ctx, StructuredData::DictionarySP args_sp, StructuredData::Generic *script_obj) { - if (class_name.empty()) - return {}; - - StructuredDataImpl args_impl(args_sp); - std::string error_string; - - Locker py_lock(&m_interpreter, Locker::AcquireLock | Locker::NoSTDIN, - Locker::FreeLock); - - lldb::ExecutionContextRefSP exe_ctx_ref_sp = + ExecutionContextRefSP exe_ctx_ref_sp = std::make_shared(exe_ctx); - - PythonObject ret_val = SWIGBridge::LLDBSwigPythonCreateScriptedObject( - class_name.str().c_str(), m_interpreter.GetDictionaryName(), - exe_ctx_ref_sp, args_impl, error_string); - - m_object_instance_sp = - StructuredData::GenericSP(new StructuredPythonObject(std::move(ret_val))); - - return m_object_instance_sp; + StructuredDataImpl sd_impl(args_sp); + return ScriptedPythonInterface::CreatePluginObject(class_name, script_obj, + exe_ctx_ref_sp, sd_impl); } StructuredData::DictionarySP ScriptedPlatformPythonInterface::ListProcesses() { diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.h index 02deecd15ede06..e04f2d02ab1d12 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.h @@ -22,7 +22,7 @@ class ScriptedPlatformPythonInterface : public ScriptedPlatformInterface, public: ScriptedPlatformPythonInterface(ScriptInterpreterPythonImpl &interpreter); - StructuredData::GenericSP + llvm::Expected CreatePluginObject(const llvm::StringRef class_name, ExecutionContext &exe_ctx, StructuredData::DictionarySP args_sp, diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp index 63a4db1ff5973e..e86b34d6b930e4 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp @@ -33,29 +33,15 @@ ScriptedProcessPythonInterface::ScriptedProcessPythonInterface( ScriptInterpreterPythonImpl &interpreter) : ScriptedProcessInterface(), ScriptedPythonInterface(interpreter) {} -StructuredData::GenericSP ScriptedProcessPythonInterface::CreatePluginObject( +llvm::Expected +ScriptedProcessPythonInterface::CreatePluginObject( llvm::StringRef class_name, ExecutionContext &exe_ctx, StructuredData::DictionarySP args_sp, StructuredData::Generic *script_obj) { - if (class_name.empty()) - return {}; - - StructuredDataImpl args_impl(args_sp); - std::string error_string; - - Locker py_lock(&m_interpreter, Locker::AcquireLock | Locker::NoSTDIN, - Locker::FreeLock); - - lldb::ExecutionContextRefSP exe_ctx_ref_sp = + ExecutionContextRefSP exe_ctx_ref_sp = std::make_shared(exe_ctx); - - PythonObject ret_val = SWIGBridge::LLDBSwigPythonCreateScriptedObject( - class_name.str().c_str(), m_interpreter.GetDictionaryName(), - exe_ctx_ref_sp, args_impl, error_string); - - m_object_instance_sp = - StructuredData::GenericSP(new StructuredPythonObject(std::move(ret_val))); - - return m_object_instance_sp; + StructuredDataImpl sd_impl(args_sp); + return ScriptedPythonInterface::CreatePluginObject(class_name, script_obj, + exe_ctx_ref_sp, sd_impl); } StructuredData::DictionarySP ScriptedProcessPythonInterface::GetCapabilities() { diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.h index 11330f5591b74e..f3cff619f6624f 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.h @@ -23,7 +23,7 @@ class ScriptedProcessPythonInterface : public ScriptedProcessInterface, public: ScriptedProcessPythonInterface(ScriptInterpreterPythonImpl &interpreter); - StructuredData::GenericSP + llvm::Expected CreatePluginObject(const llvm::StringRef class_name, ExecutionContext &exe_ctx, StructuredData::DictionarySP args_sp, diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h index 9163b8f6aede7d..190cb40dc0fc79 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h @@ -32,6 +32,98 @@ class ScriptedPythonInterface : virtual public ScriptedInterface { ScriptedPythonInterface(ScriptInterpreterPythonImpl &interpreter); ~ScriptedPythonInterface() override = default; + template + llvm::Expected + CreatePluginObject(llvm::StringRef class_name, + StructuredData::Generic *script_obj, Args... args) { + using namespace python; + using Locker = ScriptInterpreterPythonImpl::Locker; + + bool has_class_name = !class_name.empty(); + bool has_interpreter_dict = + !(llvm::StringRef(m_interpreter.GetDictionaryName()).empty()); + if (!has_class_name && !has_interpreter_dict && !script_obj) { + if (!has_class_name) + return llvm::createStringError(llvm::inconvertibleErrorCode(), + "Missing script class name."); + else if (!has_interpreter_dict) + return llvm::createStringError( + llvm::inconvertibleErrorCode(), + "Invalid script interpreter dictionary."); + else + return llvm::createStringError(llvm::inconvertibleErrorCode(), + "Missing scripting object."); + } + + Locker py_lock(&m_interpreter, Locker::AcquireLock | Locker::NoSTDIN, + Locker::FreeLock); + + PythonObject result = {}; + + if (script_obj) { + result = PythonObject(PyRefType::Borrowed, + static_cast(script_obj->GetValue())); + } else { + auto dict = + PythonModule::MainModule().ResolveName( + m_interpreter.GetDictionaryName()); + if (!dict.IsAllocated()) { + return llvm::createStringError( + llvm::inconvertibleErrorCode(), + "Could not find interpreter dictionary: %s", + m_interpreter.GetDictionaryName()); + } + + auto method = + PythonObject::ResolveNameWithDictionary( + class_name, dict); + if (!method.IsAllocated()) + return llvm::createStringError(llvm::inconvertibleErrorCode(), + "Could not find script class: %s", + class_name.data()); + + std::tuple original_args = std::forward_as_tuple(args...); + auto transformed_args = TransformArgs(original_args); + + std::string error_string; + llvm::Expected arg_info = method.GetArgInfo(); + if (!arg_info) { + llvm::handleAllErrors( + arg_info.takeError(), + [&](PythonException &E) { error_string.append(E.ReadBacktrace()); }, + [&](const llvm::ErrorInfoBase &E) { + error_string.append(E.message()); + }); + return llvm::createStringError(llvm::inconvertibleErrorCode(), + error_string); + } + + llvm::Expected expected_return_object = + llvm::createStringError(llvm::inconvertibleErrorCode(), + "Resulting object is not initialized."); + + std::apply( + [&method, &expected_return_object](auto &&...args) { + llvm::consumeError(expected_return_object.takeError()); + expected_return_object = method(args...); + }, + transformed_args); + + if (llvm::Error e = expected_return_object.takeError()) + return e; + result = std::move(expected_return_object.get()); + } + + if (!result.IsValid()) + return llvm::createStringError( + llvm::inconvertibleErrorCode(), + "Resulting object is not a valid Python Object."); + + m_object_instance_sp = StructuredData::GenericSP( + new StructuredPythonObject(std::move(result))); + return m_object_instance_sp; + } + protected: template T ExtractValueFromPythonObject(python::PythonObject &p, Status &error) { @@ -83,10 +175,6 @@ class ScriptedPythonInterface : virtual public ScriptedInterface { PythonObject py_return = std::move(expected_return_object.get()); - if (!py_return.IsAllocated()) - return ErrorWithMessage(caller_signature, "Returned object is null.", - error); - // Now that we called the python method with the transformed arguments, // we need to interate again over both the original and transformed // parameter pack, and transform back the parameter that were passed in @@ -97,6 +185,8 @@ class ScriptedPythonInterface : virtual public ScriptedInterface { caller_signature, "Couldn't re-assign reference and pointer arguments.", error); + if (!py_return.IsAllocated()) + return {}; return ExtractValueFromPythonObject(py_return, error); } @@ -122,6 +212,14 @@ class ScriptedPythonInterface : virtual public ScriptedInterface { return python::SWIGBridge::ToSWIGWrapper(arg); } + python::PythonObject Transform(const StructuredDataImpl &arg) { + return python::SWIGBridge::ToSWIGWrapper(arg); + } + + python::PythonObject Transform(lldb::ExecutionContextRefSP arg) { + return python::SWIGBridge::ToSWIGWrapper(arg); + } + python::PythonObject Transform(lldb::ProcessAttachInfoSP arg) { return python::SWIGBridge::ToSWIGWrapper(arg); } diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPythonInterface.cpp index 6addcd46e045ef..18e268527eb2fb 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPythonInterface.cpp @@ -29,37 +29,15 @@ ScriptedThreadPythonInterface::ScriptedThreadPythonInterface( ScriptInterpreterPythonImpl &interpreter) : ScriptedThreadInterface(), ScriptedPythonInterface(interpreter) {} -StructuredData::GenericSP ScriptedThreadPythonInterface::CreatePluginObject( +llvm::Expected +ScriptedThreadPythonInterface::CreatePluginObject( const llvm::StringRef class_name, ExecutionContext &exe_ctx, StructuredData::DictionarySP args_sp, StructuredData::Generic *script_obj) { - if (class_name.empty() && !script_obj) - return {}; - - StructuredDataImpl args_impl(args_sp); - std::string error_string; - - Locker py_lock(&m_interpreter, Locker::AcquireLock | Locker::NoSTDIN, - Locker::FreeLock); - - PythonObject ret_val; - - if (!script_obj) { - lldb::ExecutionContextRefSP exe_ctx_ref_sp = - std::make_shared(exe_ctx); - ret_val = SWIGBridge::LLDBSwigPythonCreateScriptedObject( - class_name.str().c_str(), m_interpreter.GetDictionaryName(), - exe_ctx_ref_sp, args_impl, error_string); - } else - ret_val = PythonObject(PyRefType::Borrowed, - static_cast(script_obj->GetValue())); - - if (!ret_val) - return {}; - - m_object_instance_sp = - StructuredData::GenericSP(new StructuredPythonObject(std::move(ret_val))); - - return m_object_instance_sp; + ExecutionContextRefSP exe_ctx_ref_sp = + std::make_shared(exe_ctx); + StructuredDataImpl sd_impl(args_sp); + return ScriptedPythonInterface::CreatePluginObject(class_name, script_obj, + exe_ctx_ref_sp, sd_impl); } lldb::tid_t ScriptedThreadPythonInterface::GetThreadID() { diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPythonInterface.h index b63760fd5b5713..b7b7439461a03d 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPythonInterface.h @@ -23,7 +23,7 @@ class ScriptedThreadPythonInterface : public ScriptedThreadInterface, public: ScriptedThreadPythonInterface(ScriptInterpreterPythonImpl &interpreter); - StructuredData::GenericSP + llvm::Expected CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx, StructuredData::DictionarySP args_sp, StructuredData::Generic *script_obj = nullptr) override; diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h b/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h index 630ab293cf939e..7cdd5577919ba8 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h @@ -116,12 +116,6 @@ class SWIGBridge { // callbacks. Although these are scripting-language specific, their definition // depends on the public API. - static python::PythonObject LLDBSwigPythonCreateScriptedObject( - const char *python_class_name, const char *session_dictionary_name, - lldb::ExecutionContextRefSP exe_ctx_sp, - const lldb_private::StructuredDataImpl &args_impl, - std::string &error_string); - static llvm::Expected LLDBSwigPythonBreakpointCallbackFunction( const char *python_function_name, const char *session_dictionary_name, const lldb::StackFrameSP &sb_frame, diff --git a/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp b/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp index 14fe69fe70a3fa..9dd845f435a07e 100644 --- a/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp +++ b/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp @@ -231,14 +231,6 @@ lldb_private::python::SWIGBridge::LLDBSWIGPythonCreateOSPlugin( return python::PythonObject(); } -python::PythonObject -lldb_private::python::SWIGBridge::LLDBSwigPythonCreateScriptedObject( - const char *python_class_name, const char *session_dictionary_name, - lldb::ExecutionContextRefSP exe_ctx_sp, const StructuredDataImpl &args_impl, - std::string &error_string) { - return python::PythonObject(); -} - python::PythonObject lldb_private::python::SWIGBridge::LLDBSWIGPython_CreateFrameRecognizer( const char *python_class_name, const char *session_dictionary_name) { @@ -321,3 +313,13 @@ python::PythonObject lldb_private::python::SWIGBridge::ToSWIGWrapper(lldb::DataExtractorSP) { return python::PythonObject(); } + +python::PythonObject +lldb_private::python::SWIGBridge::ToSWIGWrapper(lldb::ExecutionContextRefSP) { + return python::PythonObject(); +} + +python::PythonObject +lldb_private::python::SWIGBridge::ToSWIGWrapper(const StructuredDataImpl &) { + return python::PythonObject(); +}