From 70665844915eeb66273a84f131ffc33a202539d5 Mon Sep 17 00:00:00 2001 From: Med Ismail Bennani Date: Wed, 9 Feb 2022 19:04:21 -0800 Subject: [lldb/Plugin] Add artificial stackframe loading in ScriptedThread This patch adds the ability for ScriptedThread to load artificial stack frames. To do so, the interpreter instance can create a list that will contain the frame index and its pc address. Then, when the Scripted Process plugin stops, it will refresh its Scripted Threads state by invalidating their register context and load to list from the interpreter object and reconstruct each frame. This patch also removes all of the default implementation for `get_stackframes` from the derived ScriptedThread classes, and add the interface code for the Scripted Thread Interface. rdar://88721095 Differential Revision: https://reviews.llvm.org/D119388 Signed-off-by: Med Ismail Bennani --- .../ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp') diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp index 8321d3e..3ff592f 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp @@ -112,7 +112,14 @@ StructuredData::DictionarySP ScriptedThreadPythonInterface::GetStopReason() { } StructuredData::ArraySP ScriptedThreadPythonInterface::GetStackFrames() { - return nullptr; + Status error; + StructuredData::ArraySP arr = + Dispatch("get_stackframes", error); + + if (!CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, arr, error)) + return {}; + + return arr; } StructuredData::DictionarySP ScriptedThreadPythonInterface::GetRegisterInfo() { -- cgit v1.1