-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[lldb/Target] Add SyntheticFrameProvider class #166664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@llvm/pr-subscribers-lldb Author: Med Ismail Bennani (medismailben) ChangesThis patch introduces a new way to reconstruct the thread stackframe New This is the foundation work to implement ScriptedFrameProviders, which Signed-off-by: Med Ismail Bennani <ismail@bennani.ma> Patch is 58.23 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/166664.diff 43 Files Affected:
diff --git a/lldb/bindings/interface/SBFrameListDocstrings.i b/lldb/bindings/interface/SBFrameListDocstrings.i
new file mode 100644
index 0000000000000..2ca10b3b4c72b
--- /dev/null
+++ b/lldb/bindings/interface/SBFrameListDocstrings.i
@@ -0,0 +1,13 @@
+%feature("docstring",
+"Represents a list of :py:class:`SBFrame` objects."
+) lldb::SBFrameList;
+
+%feature("autodoc", "GetSize(SBFrameList self) -> uint32_t") lldb::SBFrameList::GetSize;
+%feature("docstring", "
+ Returns the number of frames in the list."
+) lldb::SBFrameList::GetSize;
+
+%feature("autodoc", "GetFrameAtIndex(SBFrameList self, uint32_t idx) -> SBFrame") lldb::SBFrameList::GetFrameAtIndex;
+%feature("docstring", "
+ Returns the frame at the given index."
+) lldb::SBFrameList::GetFrameAtIndex;
\ No newline at end of file
diff --git a/lldb/bindings/interface/SBFrameListExtensions.i b/lldb/bindings/interface/SBFrameListExtensions.i
new file mode 100644
index 0000000000000..61f05add9c9a5
--- /dev/null
+++ b/lldb/bindings/interface/SBFrameListExtensions.i
@@ -0,0 +1,41 @@
+%extend lldb::SBFrameList {
+
+#ifdef SWIGPYTHON
+ %nothreadallow;
+#endif
+ std::string lldb::SBFrameList::__str__ (){
+ lldb::SBStream description;
+ if (!$self->GetDescription(description))
+ return std::string("<empty> lldb.SBFrameList()");
+ const char *desc = description.GetData();
+ size_t desc_len = description.GetSize();
+ if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r'))
+ --desc_len;
+ return std::string(desc, desc_len);
+ }
+#ifdef SWIGPYTHON
+ %clearnothreadallow;
+#endif
+
+#ifdef SWIGPYTHON
+ %pythoncode %{
+ def __iter__(self):
+ '''Iterate over all frames in a lldb.SBFrameList object.'''
+ return lldb_iter(self, 'GetSize', 'GetFrameAtIndex')
+
+ def __len__(self):
+ return int(self.GetSize())
+
+ def __getitem__(self, key):
+ if type(key) is not int:
+ return None
+ if key < 0:
+ count = len(self)
+ if -count <= key < count:
+ key %= count
+
+ frame = self.GetFrameAtIndex(key)
+ return frame if frame.IsValid() else None
+ %}
+#endif
+}
\ No newline at end of file
diff --git a/lldb/bindings/interface/SBThreadExtensions.i b/lldb/bindings/interface/SBThreadExtensions.i
index 4ec9f10b1a256..c9ae4103d7b60 100644
--- a/lldb/bindings/interface/SBThreadExtensions.i
+++ b/lldb/bindings/interface/SBThreadExtensions.i
@@ -41,7 +41,8 @@ STRING_EXTENSION_OUTSIDE(SBThread)
def get_thread_frames(self):
'''An accessor function that returns a list() that contains all frames in a lldb.SBThread object.'''
frames = []
- for frame in self:
+ frame_list = self.GetFrames()
+ for frame in frame_list:
frames.append(frame)
return frames
diff --git a/lldb/bindings/interfaces.swig b/lldb/bindings/interfaces.swig
index b3d44979c916c..5fe058e33e619 100644
--- a/lldb/bindings/interfaces.swig
+++ b/lldb/bindings/interfaces.swig
@@ -39,6 +39,7 @@
%include "./interface/SBFileSpecListDocstrings.i"
%include "./interface/SBFormatDocstrings.i"
%include "./interface/SBFrameDocstrings.i"
+%include "./interface/SBFrameListDocstrings.i"
%include "./interface/SBFunctionDocstrings.i"
%include "./interface/SBHostOSDocstrings.i"
%include "./interface/SBInstructionDocstrings.i"
@@ -119,6 +120,7 @@
%include "lldb/API/SBFileSpecList.h"
%include "lldb/API/SBFormat.h"
%include "lldb/API/SBFrame.h"
+%include "lldb/API/SBFrameList.h"
%include "lldb/API/SBFunction.h"
%include "lldb/API/SBHostOS.h"
%include "lldb/API/SBInstruction.h"
@@ -193,6 +195,7 @@
%include "./interface/SBFileSpecExtensions.i"
%include "./interface/SBFileSpecListExtensions.i"
%include "./interface/SBFrameExtensions.i"
+%include "./interface/SBFrameListExtensions.i"
%include "./interface/SBFunctionExtensions.i"
%include "./interface/SBInstructionExtensions.i"
%include "./interface/SBInstructionListExtensions.i"
diff --git a/lldb/bindings/python/CMakeLists.txt b/lldb/bindings/python/CMakeLists.txt
index ef6def3f26872..28a8af8f06319 100644
--- a/lldb/bindings/python/CMakeLists.txt
+++ b/lldb/bindings/python/CMakeLists.txt
@@ -107,6 +107,7 @@ function(finish_swig_python swig_target lldb_python_bindings_dir lldb_python_tar
"plugins"
FILES
"${LLDB_SOURCE_DIR}/examples/python/templates/parsed_cmd.py"
+ "${LLDB_SOURCE_DIR}/examples/python/templates/scripted_frame_provider.py"
"${LLDB_SOURCE_DIR}/examples/python/templates/scripted_process.py"
"${LLDB_SOURCE_DIR}/examples/python/templates/scripted_platform.py"
"${LLDB_SOURCE_DIR}/examples/python/templates/operating_system.py"
diff --git a/lldb/bindings/python/python-swigsafecast.swig b/lldb/bindings/python/python-swigsafecast.swig
index 3ea24f1a31414..a86dc44ce4106 100644
--- a/lldb/bindings/python/python-swigsafecast.swig
+++ b/lldb/bindings/python/python-swigsafecast.swig
@@ -37,6 +37,11 @@ PythonObject SWIGBridge::ToSWIGWrapper(lldb::ThreadPlanSP thread_plan_sp) {
SWIGTYPE_p_lldb__SBThreadPlan);
}
+PythonObject SWIGBridge::ToSWIGWrapper(lldb::StackFrameListSP frames_sp) {
+ return ToSWIGHelper(new lldb::SBFrameList(std::move(frames_sp)),
+ SWIGTYPE_p_lldb__SBFrameList);
+}
+
PythonObject SWIGBridge::ToSWIGWrapper(lldb::BreakpointSP breakpoint_sp) {
return ToSWIGHelper(new lldb::SBBreakpoint(std::move(breakpoint_sp)),
SWIGTYPE_p_lldb__SBBreakpoint);
diff --git a/lldb/bindings/python/python-wrapper.swig b/lldb/bindings/python/python-wrapper.swig
index 64b7dc8381073..6ba0276fcb05e 100644
--- a/lldb/bindings/python/python-wrapper.swig
+++ b/lldb/bindings/python/python-wrapper.swig
@@ -556,6 +556,18 @@ void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBExecutionContext(PyOb
return sb_ptr;
}
+void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBFrameList(PyObject *data) {
+ lldb::SBFrameList *sb_ptr = NULL;
+
+ int valid_cast = SWIG_ConvertPtr(data, (void **)&sb_ptr,
+ SWIGTYPE_p_lldb__SBFrameList, 0);
+
+ if (valid_cast == -1)
+ return NULL;
+
+ return sb_ptr;
+}
+
bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallCommand(
const char *python_function_name, const char *session_dictionary_name,
lldb::DebuggerSP debugger, const char *args,
diff --git a/lldb/examples/python/templates/scripted_frame_provider.py b/lldb/examples/python/templates/scripted_frame_provider.py
new file mode 100644
index 0000000000000..20f4d76d188c2
--- /dev/null
+++ b/lldb/examples/python/templates/scripted_frame_provider.py
@@ -0,0 +1,113 @@
+from abc import ABCMeta, abstractmethod
+
+import lldb
+
+
+class ScriptedFrameProvider(metaclass=ABCMeta):
+ """
+ The base class for a scripted frame provider.
+
+ A scripted frame provider allows you to provide custom stack frames for a
+ thread, which can be used to augment or replace the standard unwinding
+ mechanism. This is useful for:
+
+ - Providing frames for custom calling conventions or languages
+ - Reconstructing missing frames from crash dumps or core files
+ - Adding diagnostic or synthetic frames for debugging
+ - Visualizing state machines or async execution contexts
+
+ Most of the base class methods are `@abstractmethod` that need to be
+ overwritten by the inheriting class.
+
+ Example usage:
+
+ .. code-block:: python
+
+ # Attach a frame provider to a thread
+ thread = process.GetSelectedThread()
+ error = thread.SetScriptedFrameProvider(
+ "my_module.MyFrameProvider",
+ lldb.SBStructuredData()
+ )
+ """
+
+ @abstractmethod
+ def __init__(self, input_frames, args):
+ """Construct a scripted frame provider.
+
+ Args:
+ input_frames (lldb.SBFrameList): The frame list to use as input.
+ This allows you to access frames by index. The frames are
+ materialized lazily as you access them.
+ args (lldb.SBStructuredData): A Dictionary holding arbitrary
+ key/value pairs used by the scripted frame provider.
+ """
+ self.input_frames = None
+ self.args = None
+ self.thread = None
+ self.target = None
+ self.process = None
+
+ if isinstance(input_frames, lldb.SBFrameList) and input_frames.IsValid():
+ self.input_frames = input_frames
+ self.thread = input_frames.GetThread()
+ if self.thread and self.thread.IsValid():
+ self.process = self.thread.GetProcess()
+ if self.process and self.process.IsValid():
+ self.target = self.process.GetTarget()
+
+ if isinstance(args, lldb.SBStructuredData) and args.IsValid():
+ self.args = args
+
+ @abstractmethod
+ def get_frame_at_index(self, index):
+ """Get a single stack frame at the given index.
+
+ This method is called lazily when a specific frame is needed in the
+ thread's backtrace (e.g., via the 'bt' command). Each frame is
+ requested individually as needed.
+
+ Args:
+ index (int): The frame index to retrieve (0 for youngest/top frame).
+
+ Returns:
+ Dict or None: A frame dictionary describing the stack frame, or None
+ if no frame exists at this index. The dictionary should contain:
+
+ Required fields:
+ - idx (int): The synthetic frame index (0 for youngest/top frame)
+ - pc (int): The program counter address for the synthetic frame
+
+ Alternatively, you can return:
+ - A ScriptedFrame object for full control over frame behavior
+ - An integer representing an input frame index to reuse
+ - None to indicate no more frames exist
+
+ Example:
+
+ .. code-block:: python
+
+ def get_frame_at_index(self, index):
+ # Return None when there are no more frames
+ if index >= self.total_frames:
+ return None
+
+ # Re-use an input frame by returning its index
+ if self.should_use_input_frame(index):
+ return index # Returns input frame at this index
+
+ # Or create a custom frame dictionary
+ if index == 0:
+ return {
+ "idx": 0,
+ "pc": 0x100001234,
+ }
+
+ return None
+
+ Note:
+ The frames are indexed from 0 (youngest/top) to N (oldest/bottom).
+ This method will be called repeatedly with increasing indices until
+ None is returned.
+ """
+ pass
diff --git a/lldb/include/lldb/API/LLDB.h b/lldb/include/lldb/API/LLDB.h
index 6485f35302a1c..6ac35bb4a364b 100644
--- a/lldb/include/lldb/API/LLDB.h
+++ b/lldb/include/lldb/API/LLDB.h
@@ -37,6 +37,7 @@
#include "lldb/API/SBFileSpecList.h"
#include "lldb/API/SBFormat.h"
#include "lldb/API/SBFrame.h"
+#include "lldb/API/SBFrameList.h"
#include "lldb/API/SBFunction.h"
#include "lldb/API/SBHostOS.h"
#include "lldb/API/SBInstruction.h"
diff --git a/lldb/include/lldb/API/SBDefines.h b/lldb/include/lldb/API/SBDefines.h
index 85f6bbeea5bf9..5fcc685050c0b 100644
--- a/lldb/include/lldb/API/SBDefines.h
+++ b/lldb/include/lldb/API/SBDefines.h
@@ -76,6 +76,7 @@ class LLDB_API SBFileSpec;
class LLDB_API SBFileSpecList;
class LLDB_API SBFormat;
class LLDB_API SBFrame;
+class LLDB_API SBFrameList;
class LLDB_API SBFunction;
class LLDB_API SBHostOS;
class LLDB_API SBInstruction;
diff --git a/lldb/include/lldb/API/SBFrame.h b/lldb/include/lldb/API/SBFrame.h
index 92917e57fc125..5283cdfe53faa 100644
--- a/lldb/include/lldb/API/SBFrame.h
+++ b/lldb/include/lldb/API/SBFrame.h
@@ -222,6 +222,7 @@ class LLDB_API SBFrame {
protected:
friend class SBBlock;
friend class SBExecutionContext;
+ friend class SBFrameList;
friend class SBInstruction;
friend class SBThread;
friend class SBValue;
diff --git a/lldb/include/lldb/API/SBFrameList.h b/lldb/include/lldb/API/SBFrameList.h
new file mode 100644
index 0000000000000..279857fc1a3aa
--- /dev/null
+++ b/lldb/include/lldb/API/SBFrameList.h
@@ -0,0 +1,71 @@
+//===------------------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_API_SBFRAMELIST_H
+#define LLDB_API_SBFRAMELIST_H
+
+#include "lldb/API/SBDefines.h"
+
+namespace lldb_private {
+class ScriptInterpreter;
+namespace python {
+class SWIGBridge;
+}
+namespace lua {
+class SWIGBridge;
+}
+} // namespace lldb_private
+
+namespace lldb {
+
+class LLDB_API SBFrameList {
+public:
+ SBFrameList();
+
+ SBFrameList(const lldb::SBFrameList &rhs);
+
+ ~SBFrameList();
+
+ const lldb::SBFrameList &operator=(const lldb::SBFrameList &rhs);
+
+ explicit operator bool() const;
+
+ bool IsValid() const;
+
+ uint32_t GetSize() const;
+
+ lldb::SBFrame GetFrameAtIndex(uint32_t idx) const;
+
+ lldb::SBThread GetThread() const;
+
+ void Clear();
+
+ void Append(const lldb::SBFrame &frame);
+
+ void Append(const lldb::SBFrameList &frame_list);
+
+ bool GetDescription(lldb::SBStream &description) const;
+
+protected:
+ friend class SBThread;
+
+ friend class lldb_private::python::SWIGBridge;
+ friend class lldb_private::lua::SWIGBridge;
+ friend class lldb_private::ScriptInterpreter;
+
+private:
+ SBFrameList(const lldb::StackFrameListSP &frame_list_sp);
+
+ void SetFrameList(const lldb::StackFrameListSP &frame_list_sp);
+
+ lldb::StackFrameListSP m_opaque_sp;
+};
+
+} // namespace lldb
+
+#endif // LLDB_API_SBFRAMELIST_H
diff --git a/lldb/include/lldb/API/SBStream.h b/lldb/include/lldb/API/SBStream.h
index d230da6123fb3..21f9d21e0e717 100644
--- a/lldb/include/lldb/API/SBStream.h
+++ b/lldb/include/lldb/API/SBStream.h
@@ -81,6 +81,7 @@ class LLDB_API SBStream {
friend class SBFileSpec;
friend class SBFileSpecList;
friend class SBFrame;
+ friend class SBFrameList;
friend class SBFunction;
friend class SBInstruction;
friend class SBInstructionList;
diff --git a/lldb/include/lldb/API/SBThread.h b/lldb/include/lldb/API/SBThread.h
index e9fe5858d125e..3a78026c6687b 100644
--- a/lldb/include/lldb/API/SBThread.h
+++ b/lldb/include/lldb/API/SBThread.h
@@ -178,6 +178,8 @@ class LLDB_API SBThread {
lldb::SBFrame GetFrameAtIndex(uint32_t idx);
+ lldb::SBFrameList GetFrames();
+
lldb::SBFrame GetSelectedFrame();
lldb::SBFrame SetSelectedFrame(uint32_t frame_idx);
@@ -236,6 +238,7 @@ class LLDB_API SBThread {
friend class SBSaveCoreOptions;
friend class SBExecutionContext;
friend class SBFrame;
+ friend class SBFrameList;
friend class SBProcess;
friend class SBDebugger;
friend class SBValue;
diff --git a/lldb/include/lldb/Core/PluginManager.h b/lldb/include/lldb/Core/PluginManager.h
index aa60b7c6693ca..fb8248d544b86 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -356,6 +356,17 @@ class PluginManager {
GetScriptInterpreterForLanguage(lldb::ScriptLanguage script_lang,
Debugger &debugger);
+ // SyntheticFrameProvider
+ static bool
+ RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
+ SyntheticFrameProviderCreateInstance create_callback);
+
+ static bool
+ UnregisterPlugin(SyntheticFrameProviderCreateInstance create_callback);
+
+ static SyntheticFrameProviderCreateInstance
+ GetSyntheticFrameProviderCreateCallbackAtIndex(uint32_t idx);
+
// StructuredDataPlugin
/// Register a StructuredDataPlugin class along with optional
diff --git a/lldb/include/lldb/Interpreter/Interfaces/ScriptedFrameProviderInterface.h b/lldb/include/lldb/Interpreter/Interfaces/ScriptedFrameProviderInterface.h
new file mode 100644
index 0000000000000..0a0b9bbbe0352
--- /dev/null
+++ b/lldb/include/lldb/Interpreter/Interfaces/ScriptedFrameProviderInterface.h
@@ -0,0 +1,30 @@
+//===-- ScriptedFrameProviderInterface.h ------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_INTERPRETER_INTERFACES_SCRIPTEDFRAMEPROVIDERINTERFACE_H
+#define LLDB_INTERPRETER_INTERFACES_SCRIPTEDFRAMEPROVIDERINTERFACE_H
+
+#include "lldb/lldb-private.h"
+
+#include "ScriptedInterface.h"
+
+namespace lldb_private {
+class ScriptedFrameProviderInterface : public ScriptedInterface {
+public:
+ virtual llvm::Expected<StructuredData::GenericSP>
+ CreatePluginObject(llvm::StringRef class_name,
+ lldb::StackFrameListSP input_frames,
+ StructuredData::DictionarySP args_sp) = 0;
+
+ virtual StructuredData::ObjectSP GetFrameAtIndex(uint32_t index) {
+ return {};
+ }
+};
+} // namespace lldb_private
+
+#endif // LLDB_INTERPRETER_INTERFACES_SCRIPTEDFRAMEPROVIDERINTERFACE_H
diff --git a/lldb/include/lldb/Interpreter/ScriptInterpreter.h b/lldb/include/lldb/Interpreter/ScriptInterpreter.h
index 6c0054a1ec1d1..f4c204d5c08e5 100644
--- a/lldb/include/lldb/Interpreter/ScriptInterpreter.h
+++ b/lldb/include/lldb/Interpreter/ScriptInterpreter.h
@@ -16,6 +16,7 @@
#include "lldb/API/SBError.h"
#include "lldb/API/SBEvent.h"
#include "lldb/API/SBExecutionContext.h"
+#include "lldb/API/SBFrameList.h"
#include "lldb/API/SBLaunchInfo.h"
#include "lldb/API/SBMemoryRegionInfo.h"
#include "lldb/API/SBStream.h"
@@ -28,6 +29,7 @@
#include "lldb/Host/StreamFile.h"
#include "lldb/Interpreter/Interfaces/OperatingSystemInterface.h"
#include "lldb/Interpreter/Interfaces/ScriptedFrameInterface.h"
+#include "lldb/Interpreter/Interfaces/ScriptedFrameProviderInterface.h"
#include "lldb/Interpreter/Interfaces/ScriptedPlatformInterface.h"
#include "lldb/Interpreter/Interfaces/ScriptedProcessInterface.h"
#include "lldb/Interpreter/Interfaces/ScriptedThreadInterface.h"
@@ -537,6 +539,11 @@ class ScriptInterpreter : public PluginInterface {
return {};
}
+ virtual lldb::ScriptedFrameProviderInterfaceSP
+ CreateScriptedFrameProviderInterface() {
+ return {};
+ }
+
virtual lldb::ScriptedThreadPlanInterfaceSP
CreateScriptedThreadPlanInterface() {
return {};
@@ -596,6 +603,9 @@ class ScriptInterpreter : public PluginInterface {
lldb::ExecutionContextRefSP GetOpaqueTypeFromSBExecutionContext(
const lldb::SBExecutionContext &exe_ctx) const;
+ lldb::StackFrameListSP
+ GetOpaqueTypeFromSBFrameList(const lldb::SBFrameList &exe_ctx) const;
+
protected:
Debugger &m_debugger;
lldb::ScriptLanguage m_script_lang;
diff --git a/lldb/include/lldb/Target/StackFrameList.h b/lldb/include/lldb/Target/StackFrameList.h
index ea9aab86b8ea1..5b0df0ddb3e29 100644
--- a/lldb/include/lldb/Target/StackFrameList.h
+++ b/lldb/include/lldb/Target/StackFrameList.h
@@ -101,6 +101,9 @@ class StackFrameList {
/// Returns whether we have currently fetched all the frames of a stack.
bool WereAllFramesFetched() const;
+ /// Get the thread associated with this frame list.
+ Thread &GetThread() const { return m_thread; }
+
protected:
friend class Thread;
friend class ScriptedThread;
diff --git a/lldb/include/lldb/Target/SyntheticFrameProvider.h b/lldb/include/lldb/Target/SyntheticFrameProvider.h
new file mode 100644
index 0000000000000..90f701a2f8c82
--- /dev/null
+++ b/lldb/include/lldb/Target/SyntheticFrameProvider.h
@@ -0,0 +1,133 @@
+
+//===------------------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 ...
[truncated]
|
1c1561c to
8060b84
Compare
c942348 to
5ab9a0b
Compare
| if (thread_specs.empty()) | ||
| return true; | ||
|
|
||
| // Check if the thread matches any of the specs (OR logic) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Check if the thread matches any of the specs (OR logic) | |
| // Check if the thread matches any of the specs (OR logic). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds a new SyntheticFrameProvider feature to LLDB, which allows modifying or replacing stack frames shown for threads. This enables support for custom calling conventions, frame reconstruction from crash dumps, and visualization of async execution contexts.
Key changes:
- New
SyntheticFrameProviderbase class with plugin infrastructure for both scripted and C++ implementations SyntheticFrameProviderDescriptorstruct for managing provider metadata and thread filtering- Plugin manager integration for registering and discovering frame providers
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lldb/source/Target/SyntheticFrameProvider.cpp | Implements SyntheticFrameProvider class with factory methods and descriptor dumping functionality |
| lldb/source/Target/CMakeLists.txt | Adds SyntheticFrameProvider.cpp to the build configuration |
| lldb/source/Core/PluginManager.cpp | Adds plugin registration and lookup methods for both scripted and C++ frame providers |
| lldb/include/lldb/lldb-private-interfaces.h | Defines callback typedefs for frame provider creation and forward declares descriptor |
| lldb/include/lldb/lldb-forward.h | Adds forward declaration and shared pointer typedef for SyntheticFrameProvider |
| lldb/include/lldb/Target/SyntheticFrameProvider.h | Defines SyntheticFrameProvider base class and descriptor with comprehensive documentation |
| lldb/include/lldb/Core/PluginManager.h | Declares static methods for frame provider plugin management |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0da2d96 to
30b8853
Compare
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
9d43d0f to
4f27883
Compare
This patch introduces a new way to reconstruct the thread stackframe list. New SyntheticFrameProvider classes can lazy fetch a StackFrame at index using a provided StackFrameList. In can either be the real unwinder StackFrameList or we could also chain SyntheticFrameProviders to each others. This is the foundation work to implement ScriptedFrameProviders, which will come in a follow-up patch. Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
4f27883 to
df8d9ee
Compare
JDevlieghere
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This patch introduces a new way to reconstruct the thread stackframe
list.
New
SyntheticFrameProviderclasses can lazy fetch a StackFrame atindex using a provided StackFrameList.
In can either be the real unwinder StackFrameList or we could also chain
SyntheticFrameProviders to each others.
This is the foundation work to implement ScriptedFrameProviders, which
will come in a follow-up patch.
Signed-off-by: Med Ismail Bennani ismail@bennani.ma