From c154f397eeb86ea1a5b8fa46405104ace962cec3 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Mon, 17 Jan 2022 11:29:35 +0100 Subject: [lldb/python] Use PythonObject in LLDBSwigPython functions Return our PythonObject wrappers instead of raw PyObjects (obfuscated as void *). This ensures that ownership (reference counts) of python objects is automatically tracked. Differential Revision: https://reviews.llvm.org/D117462 --- .../ScriptInterpreter/Python/PythonTestSuite.cpp | 37 +++++++++++----------- 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp') diff --git a/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp b/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp index 837f6cb..ba96cc6 100644 --- a/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp +++ b/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp @@ -80,23 +80,23 @@ bool lldb_private::LLDBSwigPythonCallTypeScript( return false; } -void *lldb_private::LLDBSwigPythonCreateSyntheticProvider( +python::PythonObject lldb_private::LLDBSwigPythonCreateSyntheticProvider( const char *python_class_name, const char *session_dictionary_name, const lldb::ValueObjectSP &valobj_sp) { - return nullptr; + return python::PythonObject(); } -void *lldb_private::LLDBSwigPythonCreateCommandObject( +python::PythonObject lldb_private::LLDBSwigPythonCreateCommandObject( const char *python_class_name, const char *session_dictionary_name, lldb::DebuggerSP debugger_sp) { - return nullptr; + return python::PythonObject(); } -void *lldb_private::LLDBSwigPythonCreateScriptedThreadPlan( +python::PythonObject lldb_private::LLDBSwigPythonCreateScriptedThreadPlan( const char *python_class_name, const char *session_dictionary_name, const StructuredDataImpl &args_data, std::string &error_string, const lldb::ThreadPlanSP &thread_plan_sp) { - return nullptr; + return python::PythonObject(); } bool lldb_private::LLDBSWIGPythonCallThreadPlan(void *implementor, @@ -106,10 +106,11 @@ bool lldb_private::LLDBSWIGPythonCallThreadPlan(void *implementor, return false; } -void *lldb_private::LLDBSwigPythonCreateScriptedBreakpointResolver( +python::PythonObject +lldb_private::LLDBSwigPythonCreateScriptedBreakpointResolver( const char *python_class_name, const char *session_dictionary_name, const StructuredDataImpl &args, const lldb::BreakpointSP &bkpt_sp) { - return nullptr; + return python::PythonObject(); } unsigned int lldb_private::LLDBSwigPythonCallBreakpointResolver( @@ -191,30 +192,30 @@ bool lldb_private::LLDBSwigPythonCallModuleInit( return false; } -void * +python::PythonObject lldb_private::LLDBSWIGPythonCreateOSPlugin(const char *python_class_name, const char *session_dictionary_name, const lldb::ProcessSP &process_sp) { - return nullptr; + return python::PythonObject(); } -void *lldb_private::LLDBSwigPythonCreateScriptedProcess( +python::PythonObject lldb_private::LLDBSwigPythonCreateScriptedProcess( const char *python_class_name, const char *session_dictionary_name, const lldb::TargetSP &target_sp, const StructuredDataImpl &args_impl, std::string &error_string) { - return nullptr; + return python::PythonObject(); } -void *lldb_private::LLDBSwigPythonCreateScriptedThread( +python::PythonObject lldb_private::LLDBSwigPythonCreateScriptedThread( const char *python_class_name, const char *session_dictionary_name, const lldb::ProcessSP &process_sp, const StructuredDataImpl &args_impl, std::string &error_string) { - return nullptr; + return python::PythonObject(); } -void *lldb_private::LLDBSWIGPython_CreateFrameRecognizer( +python::PythonObject lldb_private::LLDBSWIGPython_CreateFrameRecognizer( const char *python_class_name, const char *session_dictionary_name) { - return nullptr; + return python::PythonObject(); } PyObject *lldb_private::LLDBSwigPython_GetRecognizedArguments( @@ -257,11 +258,11 @@ void *lldb_private::LLDBSWIGPython_GetDynamicSetting( return nullptr; } -void *lldb_private::LLDBSwigPythonCreateScriptedStopHook( +python::PythonObject lldb_private::LLDBSwigPythonCreateScriptedStopHook( lldb::TargetSP target_sp, const char *python_class_name, const char *session_dictionary_name, const StructuredDataImpl &args_impl, Status &error) { - return nullptr; + return python::PythonObject(); } bool lldb_private::LLDBSwigPythonStopHookCallHandleStop( -- cgit v1.1