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 32 of file StackFrameBase.h.

Constructor & Destructor Documentation

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 24 of file StackFrameBase.cc.

References m_Symbol, and ~StackFrameBase().

StackFrameBase::~StackFrameBase ( )
virtualdefault

The destructor does nothing

Referenced by StackFrameBase().

+ Here is the caller graph for this function:

Member Function Documentation

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).
void StackFrameBase::format ( uintptr_t  n,
const LargeStaticString type,
HugeStaticString dest 
)
private

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

Definition at line 62 of file StackFrameBase.cc.

Referenced by prettyPrint().

+ Here is the caller graph for this function:

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

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

Implemented in ARMV7StackFrame, X86StackFrame, PPC32StackFrame, HostedStackFrame, X64StackFrame, ARM926EStackFrame, MIPS32StackFrame, and MIPS64StackFrame.

Referenced by prettyPrint().

+ Here is the caller graph for this function:

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 134 of file StackFrameBase.cc.

References m_Symbol.

Referenced by prettyPrint().

+ Here is the caller graph for this function:

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

uintptr_t StackFrameBase::m_BasePointer
protected

The base pointer for this frame.

Definition at line 67 of file StackFrameBase.h.

Referenced by X86StackFrame::getParameter().

const ProcessorState& StackFrameBase::m_State
protected

The processor state

Definition at line 65 of file StackFrameBase.h.

Referenced by X64StackFrame::getParameter(), and PPC32StackFrame::getParameter().

symbol_t StackFrameBase::m_Symbol
protected

The symbol

Definition at line 63 of file StackFrameBase.h.

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


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