microfmt
Zero-allocation C++ formatting for constrained environments
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
microfmt::frame_unwinder_ref Class Reference

Type-erased, two-word handle to a frame unwinder. More...

#include <frame_pointer.hpp>

Classes

struct  vtable
 Virtual table of unwinder operations. More...
 

Public Member Functions

constexpr frame_unwinder_ref () noexcept=default
 Constructs an empty (invalid) handle.
 
template<typename ArchTag , typename Traits = frame_unwinder_traits<ArchTag>, std::enable_if_t< std::is_void_v< typename Traits::context_type >, int > = 0>
constexpr frame_unwinder_ref (ArchTag) noexcept
 Constructs a handle for a stateless unwinder tag.
 
template<typename ArchTag , typename Context , typename Traits = frame_unwinder_traits<ArchTag>, std::enable_if_t<!std::is_void_v< typename Traits::context_type > &&std::is_convertible_v< const Context *, const typename Traits::context_type * >, int > = 0>
constexpr frame_unwinder_ref (ArchTag, const Context &ctx RELOCO_LIFETIMEBOUND RELOCO_LIFETIME_CAPTURE_BY_THIS) noexcept
 Constructs a handle for a stateful unwinder tag.
 
template<typename ArchTag , typename Context , std::enable_if_t<!std::is_lvalue_reference_v< Context >, int > = 0>
constexpr frame_unwinder_ref (ArchTag, Context &&)=delete
 
bool step (register_context_ref reg_ctx, uintptr_t current_pc, uintptr_t &next_fp, uintptr_t &next_pc) const noexcept
 Advances from the current frame to its caller using register_context_ref.
 
constexpr operator bool () const noexcept
 

Static Public Member Functions

template<typename ArchTag , typename Traits = frame_unwinder_traits<ArchTag>, std::enable_if_t< std::is_void_v< typename Traits::context_type >, int > = 0>
static constexpr frame_unwinder_ref make () noexcept
 
template<typename ArchTag , typename Context , typename Traits = frame_unwinder_traits<ArchTag>, std::enable_if_t<!std::is_void_v< typename Traits::context_type >, int > = 0>
static constexpr frame_unwinder_ref make (const Context &ctx RELOCO_LIFETIMEBOUND) noexcept
 
template<typename ArchTag , typename Context , std::enable_if_t<!std::is_lvalue_reference_v< Context >, int > = 0>
static frame_unwinder_ref make (Context &&)=delete
 

Detailed Description

Type-erased, two-word handle to a frame unwinder.

Packs a context pointer and a virtual table into two words, avoiding allocations, RTTI, and virtual dispatch.

Constructor & Destructor Documentation

◆ frame_unwinder_ref() [1/4]

constexpr microfmt::frame_unwinder_ref::frame_unwinder_ref ( )
constexprdefaultnoexcept

Constructs an empty (invalid) handle.

◆ frame_unwinder_ref() [2/4]

template<typename ArchTag , typename Traits = frame_unwinder_traits<ArchTag>, std::enable_if_t< std::is_void_v< typename Traits::context_type >, int > = 0>
constexpr microfmt::frame_unwinder_ref::frame_unwinder_ref ( ArchTag  )
inlineexplicitconstexprnoexcept

Constructs a handle for a stateless unwinder tag.

◆ frame_unwinder_ref() [3/4]

template<typename ArchTag , typename Context , typename Traits = frame_unwinder_traits<ArchTag>, std::enable_if_t<!std::is_void_v< typename Traits::context_type > &&std::is_convertible_v< const Context *, const typename Traits::context_type * >, int > = 0>
constexpr microfmt::frame_unwinder_ref::frame_unwinder_ref ( ArchTag  ,
const Context &ctx RELOCO_LIFETIMEBOUND  RELOCO_LIFETIME_CAPTURE_BY_THIS 
)
inlineconstexprnoexcept

Constructs a handle for a stateful unwinder tag.

◆ frame_unwinder_ref() [4/4]

template<typename ArchTag , typename Context , std::enable_if_t<!std::is_lvalue_reference_v< Context >, int > = 0>
constexpr microfmt::frame_unwinder_ref::frame_unwinder_ref ( ArchTag  ,
Context &&   
)
constexprdelete

Member Function Documentation

◆ make() [1/3]

template<typename ArchTag , typename Traits = frame_unwinder_traits<ArchTag>, std::enable_if_t< std::is_void_v< typename Traits::context_type >, int > = 0>
static constexpr frame_unwinder_ref microfmt::frame_unwinder_ref::make ( )
inlinestaticconstexprnoexcept

◆ make() [2/3]

template<typename ArchTag , typename Context , typename Traits = frame_unwinder_traits<ArchTag>, std::enable_if_t<!std::is_void_v< typename Traits::context_type >, int > = 0>
static constexpr frame_unwinder_ref microfmt::frame_unwinder_ref::make ( const Context &ctx  RELOCO_LIFETIMEBOUND)
inlinestaticconstexprnoexcept

◆ make() [3/3]

template<typename ArchTag , typename Context , std::enable_if_t<!std::is_lvalue_reference_v< Context >, int > = 0>
static frame_unwinder_ref microfmt::frame_unwinder_ref::make ( Context &&  )
staticdelete

◆ operator bool()

constexpr microfmt::frame_unwinder_ref::operator bool ( ) const
inlineexplicitconstexprnoexcept

◆ step()

bool microfmt::frame_unwinder_ref::step ( register_context_ref  reg_ctx,
uintptr_t  current_pc,
uintptr_t &  next_fp,
uintptr_t &  next_pc 
) const
inlinenoexcept

Advances from the current frame to its caller using register_context_ref.

Parameters
reg_ctxTarget register context handle.
current_pcProgram counter of the frame being unwound from (supplied by the caller/iterator, not read out of reg_ctx); backends use this purely to look up the applicable unwind descriptor (.ARM.exidx entry, DWARF FDE, unwind hint, ...) for the current frame. Register restoration (SP/FP/LR/...) still happens via reg_ctx itself.
next_fpReceives the caller's frame pointer.
next_pcReceives the caller's program counter.

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