LLDB mainline
lldb_private::SyntheticFrameProvider Class Referenceabstract

Base class for all synthetic frame providers. More...

#include <SyntheticFrameProvider.h>

Inheritance diagram for lldb_private::SyntheticFrameProvider:
[legend]

Public Member Functions

 ~SyntheticFrameProvider () override
virtual llvm::Expected< lldb::StackFrameSPGetFrameAtIndex (uint32_t idx)=0
 Get a single stack frame at the specified index.
ThreadGetThread ()
 Get the thread associated with this provider.
lldb::StackFrameListSP GetInputFrames () const
 Get the input frames that this provider transforms.
Public Member Functions inherited from lldb_private::PluginInterface
 PluginInterface ()=default
virtual ~PluginInterface ()=default
virtual llvm::StringRef GetPluginName ()=0
 PluginInterface (const PluginInterface &)=delete
PluginInterfaceoperator= (const PluginInterface &)=delete

Static Public Member Functions

static llvm::Expected< lldb::SyntheticFrameProviderSPCreateInstance (lldb::StackFrameListSP input_frames, const SyntheticFrameProviderDescriptor &descriptor)
 Try to create a SyntheticFrameProvider instance for the given input frames and descriptor.
static llvm::Expected< lldb::SyntheticFrameProviderSPCreateInstance (lldb::StackFrameListSP input_frames, llvm::StringRef plugin_name, const std::vector< ThreadSpec > &thread_specs={})
 Try to create a SyntheticFrameProvider instance for the given input frames using a specific C++ plugin.

Protected Member Functions

 SyntheticFrameProvider (lldb::StackFrameListSP input_frames)

Protected Attributes

lldb::StackFrameListSP m_input_frames

Detailed Description

Base class for all synthetic frame providers.

Synthetic frame providers allow modifying or replacing the stack frames shown for a thread. 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.

Definition at line 78 of file SyntheticFrameProvider.h.

Constructor & Destructor Documentation

◆ ~SyntheticFrameProvider()

SyntheticFrameProvider::~SyntheticFrameProvider ( )
overridedefault

◆ SyntheticFrameProvider()

SyntheticFrameProvider::SyntheticFrameProvider ( lldb::StackFrameListSP input_frames)
protected

Definition at line 19 of file SyntheticFrameProvider.cpp.

References m_input_frames.

Member Function Documentation

◆ CreateInstance() [1/2]

llvm::Expected< SyntheticFrameProviderSP > SyntheticFrameProvider::CreateInstance ( lldb::StackFrameListSP input_frames,
const SyntheticFrameProviderDescriptor & descriptor )
static

Try to create a SyntheticFrameProvider instance for the given input frames and descriptor.

This method iterates through all registered SyntheticFrameProvider plugins and returns the first one that can handle the given descriptor.

Parameters
[in]input_framesThe input stack frame list that this provider will transform. This could be real unwound frames or output from another provider.
[in]descriptorThe descriptor containing metadata for the provider.
Returns
A shared pointer to a SyntheticFrameProvider if one could be created, otherwise an llvm::Error.

Definition at line 44 of file SyntheticFrameProvider.cpp.

References lldb_private::GetLog(), lldb_private::PluginManager::GetScriptedFrameProviderCreateCallbackAtIndex(), LLDB_LOG_ERROR, and lldb_private::Target.

◆ CreateInstance() [2/2]

llvm::Expected< SyntheticFrameProviderSP > SyntheticFrameProvider::CreateInstance ( lldb::StackFrameListSP input_frames,
llvm::StringRef plugin_name,
const std::vector< ThreadSpec > & thread_specs = {} )
static

Try to create a SyntheticFrameProvider instance for the given input frames using a specific C++ plugin.

This method directly invokes a specific SyntheticFrameProvider plugin by name, bypassing the descriptor-based plugin iteration. This is useful for C++ plugins that don't require scripted metadata.

Parameters
[in]input_framesThe input stack frame list that this provider will transform. This could be real unwound frames or output from another provider.
[in]plugin_nameThe name of the plugin to use for creating the provider.
[in]thread_specsOptional list of thread specifications to which this provider applies. If empty, the provider applies to all threads.
Returns
A shared pointer to a SyntheticFrameProvider if one could be created, otherwise an llvm::Error.

Definition at line 73 of file SyntheticFrameProvider.cpp.

References lldb_private::PluginManager::GetSyntheticFrameProviderCreateCallbackForPluginName().

◆ GetFrameAtIndex()

virtual llvm::Expected< lldb::StackFrameSP > lldb_private::SyntheticFrameProvider::GetFrameAtIndex ( uint32_t idx)
pure virtual

Get a single stack frame at the specified index.

This method is called lazily - frames are only created when requested. The provider can access its input frames via GetInputFrames() if needed.

Parameters
[in]idxThe index of the frame to create.
Returns
An Expected containing the StackFrameSP if successful. Returns an error when the index is beyond the last frame to signal the end of the frame list.

◆ GetInputFrames()

lldb::StackFrameListSP lldb_private::SyntheticFrameProvider::GetInputFrames ( ) const
inline

Get the input frames that this provider transforms.

Definition at line 146 of file SyntheticFrameProvider.h.

References m_input_frames.

◆ GetThread()

Thread & lldb_private::SyntheticFrameProvider::GetThread ( )
inline

Get the thread associated with this provider.

Definition at line 143 of file SyntheticFrameProvider.h.

References m_input_frames.

Member Data Documentation

◆ m_input_frames

lldb::StackFrameListSP lldb_private::SyntheticFrameProvider::m_input_frames
protected

Definition at line 151 of file SyntheticFrameProvider.h.

Referenced by GetInputFrames(), GetThread(), and SyntheticFrameProvider().


The documentation for this class was generated from the following files: