From 1130e923e2d7fe046101bf639bc5ebcde194c005 Mon Sep 17 00:00:00 2001 From: Med Ismail Bennani Date: Fri, 28 Jun 2024 01:40:03 -0700 Subject: [lldb/Interpreter] Discard ScriptedThreadPlan::GetStopDescription return value (#96985) This patch changes `ScriptedThreadPlan::GetStopDescription` behavior by discarding its return value since it is optional in the first place (the user doesn't need to provide a return value in their implementation). This patch also addresses the test failures in TestStepScripted following 9a9ec22 and re-enables the tests that were XFAIL'd previously. The issue here was that the `Stream*` that's passed to `ThreadPlanPython::GetDescription` wasn't being passed by reference to the python method so it was never updated to reflect how the python method interacted with it. This patch solves this issue by making a temporary `StreamSP` that will be passed to the python method by reference, after what we will copy its content to the caller `Stream` pointer argument. --------- Signed-off-by: Med Ismail Bennani --- .../Python/Interfaces/ScriptedPythonInterface.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp') diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp index 7d072212676e..699412e437a1 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp @@ -26,15 +26,6 @@ ScriptedPythonInterface::ScriptedPythonInterface( ScriptInterpreterPythonImpl &interpreter) : ScriptedInterface(), m_interpreter(interpreter) {} -template <> -void ScriptedPythonInterface::ReverseTransform( - lldb_private::Stream *&original_arg, python::PythonObject transformed_arg, - Status &error) { - Stream *s = ExtractValueFromPythonObject(transformed_arg, error); - *original_arg = *s; - original_arg->PutCString(static_cast(s)->GetData()); -} - template <> StructuredData::ArraySP ScriptedPythonInterface::ExtractValueFromPythonObject( @@ -74,7 +65,8 @@ Event *ScriptedPythonInterface::ExtractValueFromPythonObject( } template <> -Stream *ScriptedPythonInterface::ExtractValueFromPythonObject( +lldb::StreamSP +ScriptedPythonInterface::ExtractValueFromPythonObject( python::PythonObject &p, Status &error) { if (lldb::SBStream *sb_stream = reinterpret_cast( python::LLDBSWIGPython_CastPyObjectToSBStream(p.get()))) -- cgit v1.2.3