The Pedigree Project 0.1
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | List of all members
StackFrameBase Class Referenceabstract

#include <StackFrameBase.h>

+ Inheritance diagram for StackFrameBase:
+ Collaboration diagram for StackFrameBase:

Public Member Functions

void prettyPrint (HugeStaticString &buf)
 
 StackFrameBase (const ProcessorState &State, uintptr_t basePointer, LargeStaticString mangledSymbol)
 
virtual ~StackFrameBase ()
 

Static Public Member Functions

static void construct (ProcessorState &state, uintptr_t returnAddress, unsigned int nParams,...)
 

Protected Attributes

symbol_t m_Symbol
 
const ProcessorState & m_State
 
uintptr_t m_BasePointer
 

Private Member Functions

virtual uintptr_t getParameter (size_t n)=0
 
bool isClassMember ()
 
void format (uintptr_t n, const LargeStaticString &type, HugeStaticString &dest)
 

Detailed Description

Base class for all processor-specific StackFrame classes

Definition at line 33 of file StackFrameBase.h.

Constructor & Destructor Documentation

◆ StackFrameBase()

StackFrameBase::StackFrameBase ( const ProcessorState &  State,
uintptr_t  basePointer,
LargeStaticString  mangledSymbol 
)

Creates a stack frame based on the given processor state and also the given symbol name (mangled).

Definition at line 26 of file StackFrameBase.cc.

References m_Symbol.

◆ ~StackFrameBase()

StackFrameBase::~StackFrameBase ( )
virtualdefault

The destructor does nothing

Member Function Documentation

◆ construct()

static void StackFrameBase::construct ( ProcessorState &  state,
uintptr_t  returnAddress,
unsigned int  nParams,
  ... 
)
static

Construct a stack frame, given a ProcessorState. The stack frame should be constructed to comply with the default ABI for the current architecture - that implies the stack may be changed, so the getStackPointer() member of ProcessorState must be valid.

Parameters
[out]stateThe state to modify (construct a stack frame in).
returnAddressThe return address of the stack frame.
nParamsThe number of parameters to the stack frame.
...The parameters, each sizeof(uintptr_t).

◆ format()

void StackFrameBase::format ( uintptr_t  n,
const LargeStaticString &  type,
HugeStaticString &  dest 
)
private

Formats a number, given the 'type' of that number.

Definition at line 56 of file StackFrameBase.cc.

Referenced by getParameter(), and prettyPrint().

+ Here is the caller graph for this function:

◆ getParameter()

virtual uintptr_t StackFrameBase::getParameter ( size_t  n)
privatepure virtual

Returns the n'th 32/64-bit parameter in the stack frame.

Implemented in HostedStackFrame, X64StackFrame, Arm64StackFrame, and Armv7StackFrame.

References format().

Referenced by prettyPrint().

+ Here is the caller graph for this function:

◆ isClassMember()

bool StackFrameBase::isClassMember ( )
private

Returns whether the symbol is a class member function. This is calculated by a simple algorithm:

  • If the symbol name contains no '::'s, return false.
  • If the letter directly after the last '::' is a capital, return true, else return false.

Definition at line 112 of file StackFrameBase.cc.

References m_Symbol.

Referenced by prettyPrint().

+ Here is the caller graph for this function:

◆ prettyPrint()

void StackFrameBase::prettyPrint ( HugeStaticString &  buf)

Returns a pretty printed string containing the function name and each parameter with its value (hopefully).

Definition at line 35 of file StackFrameBase.cc.

References format(), getParameter(), isClassMember(), and m_Symbol.

Member Data Documentation

◆ m_BasePointer

uintptr_t StackFrameBase::m_BasePointer
protected

The base pointer for this frame.

Definition at line 64 of file StackFrameBase.h.

◆ m_State

const ProcessorState& StackFrameBase::m_State
protected

The processor state

Definition at line 62 of file StackFrameBase.h.

Referenced by X64StackFrame::getParameter(), Arm64StackFrame::getParameter(), and Armv7StackFrame::getParameter().

◆ m_Symbol

symbol_t StackFrameBase::m_Symbol
protected

The symbol

Definition at line 60 of file StackFrameBase.h.

Referenced by isClassMember(), prettyPrint(), and StackFrameBase().


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