CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Public Member Functions | Static Public Attributes | List of all members
ctkBackTrace Class Reference

Obtains a back trace from the current execution context. More...

#include <Libs/Core/ctkBackTrace.h>

Inheritance diagram for ctkBackTrace:
Inheritance graph
[legend]

Public Member Functions

 ctkBackTrace (const ctkBackTrace &other)
 
 ctkBackTrace (size_t framesNumber=DefaultStackSize)
 Create a back trace. More...
 
void * returnAddress (unsigned frameNumber) const
 Get the return address for a given stack frame. More...
 
QString stackFrame (unsigned frameNumber) const
 Get a textual representation for a given stack frame. More...
 
size_t stackSize () const
 Get the stack size. More...
 
QList< QString > stackTrace () const
 Provides programmatic access to the stack trace information. More...
 
virtual ~ctkBackTrace () throw ()
 

Static Public Attributes

static size_t const DefaultStackSize
 

Detailed Description

Obtains a back trace from the current execution context.

Remarks
It is generally not safe to use this class in signal handlers.

Definition at line 43 of file ctkBackTrace.h.

Constructor & Destructor Documentation

◆ ctkBackTrace() [1/2]

ctkBackTrace::ctkBackTrace ( const ctkBackTrace other)

◆ ctkBackTrace() [2/2]

ctkBackTrace::ctkBackTrace ( size_t  framesNumber = DefaultStackSize)

Create a back trace.

Parameters
framesNumberThe default maximum stack size.

◆ ~ctkBackTrace()

virtual ctkBackTrace::~ctkBackTrace ( )
throw (
)
virtual

Member Function Documentation

◆ returnAddress()

void* ctkBackTrace::returnAddress ( unsigned  frameNumber) const

Get the return address for a given stack frame.

Parameters
frameNumberThe stack frame number.
Returns
The return address for the stack frame with number frameNumber or NULL if there is no corresponding stack frame.

◆ stackFrame()

QString ctkBackTrace::stackFrame ( unsigned  frameNumber) const

Get a textual representation for a given stack frame.

Parameters
frameNumberThe stack frame number.
Returns
A string describing the stack frame with number frameNumber or a null QString if there is no corresponding stack frame.

◆ stackSize()

size_t ctkBackTrace::stackSize ( ) const

Get the stack size.

Returns
The number of stack frames for this back trace.

◆ stackTrace()

QList<QString> ctkBackTrace::stackTrace ( ) const

Provides programmatic access to the stack trace information.

The zeroth element of the returned list (assuming the list's size is non-zero) represents the top of the stack, which is the last method invocation in the sequence.

Returns
A list of string representations for each stack frame.

Member Data Documentation

◆ DefaultStackSize

size_t const ctkBackTrace::DefaultStackSize
static

Definition at line 47 of file ctkBackTrace.h.


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