Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

stacktrace Namespace Reference

Holds the C-style interface for the stack trace routines. More...

Classes

struct  StackFrame
 Stores information about a single stack frame. More...

Typedefs

typedef int machineInstruction
 typedef in case type needs to change on other platforms (i.e. long for 64 bit architectures?)

Functions

int unrollStackFrame (struct StackFrame *curFrame, struct StackFrame *nextFrame)
 stores information about the caller to curFrame into nextFrame
static int growAlloc (struct StackFrame *frame)
static void allocBacktraceRegion (struct StackFrame *frame, size_t cap)
static void freeBacktraceRegion (struct StackFrame *frame)
void getCurrentStackFrame (struct StackFrame *frame)
 stores information about the caller's stack frame into frame
void freeStackTrace (struct StackFrame *frame)
 frees a list of StackFrames, such as is returned by recordStackTrace
struct StackFrameallocateStackTrace (unsigned int size)
 preallocates a stack trace of a particular size (doesn't actually perform a stack trace, merely allocates the linked list)
struct StackFramerecordStackTrace (unsigned int limit=-1U, unsigned int skip=0)
 repeatedly calls unrollStackFrame() until the root frame is reached or limit is hit, skipping the top skip frames
struct StackFramerecordOverStackTrace (struct StackFrame *frame, unsigned int skip=0)
 repeatedly calls unrollStackFrame() until the root frame is reached or end of frame list is hit, skipping the top skip frames
static int getline (char **s, size_t *len, FILE *f)
static int addr2lineLookup (const char *const ex, const void *const off, char **srcfile, size_t *srcfilelen, char **func, size_t *funclen)
static void displayRelPath (FILE *os, const char *wd, const char *path)
static void beginDisplay ()
 attempts to read symbol information and displays stack trace header
static void displayStackFrame (unsigned int depth, const struct StackFrame *frame)
static void completeDisplay (int isend)
 releases symbol information used during display
void displayCurrentStackTrace (unsigned int limit=-1U, unsigned int skip=0)
 dumps current stack trace to stderr, up to limit depth and skipping the top skip frames
void displayStackTrace (const struct StackFrame *frame)
 dumps stored stack trace to stderr

Variables

const size_t MIN_CAP = 50

Detailed Description

Holds the C-style interface for the stack trace routines.


Typedef Documentation

typedef in case type needs to change on other platforms (i.e. long for 64 bit architectures?)

Definition at line 22 of file StackTrace.h.


Function Documentation

static int stacktrace::addr2lineLookup ( const char *const   ex,
const void *const   off,
char **  srcfile,
size_t *  srcfilelen,
char **  func,
size_t *  funclen 
) [static]

Definition at line 628 of file StackTrace.cc.

Referenced by displayStackFrame().

struct StackFrame * stacktrace::allocateStackTrace ( unsigned int  size  )  [read]

preallocates a stack trace of a particular size (doesn't actually perform a stack trace, merely allocates the linked list)

this is a good idea if you want to do a stack trace within an exception handler, which might have been triggered by running out of heap

static void stacktrace::allocBacktraceRegion ( struct StackFrame *  frame,
size_t  cap 
) [static]

Definition at line 285 of file StackTrace.cc.

static void stacktrace::beginDisplay (  )  [static]

attempts to read symbol information and displays stack trace header

Definition at line 696 of file StackTrace.cc.

static void stacktrace::completeDisplay ( int  isend  )  [static]

releases symbol information used during display

Definition at line 819 of file StackTrace.cc.

void stacktrace::displayCurrentStackTrace ( unsigned int  limit = -1U,
unsigned int  skip = 0 
)

dumps current stack trace to stderr, up to limit depth and skipping the top skip frames

pass -1U for limit to request unlimited trace, and 0 to start with the function calling recordStackTrace

Referenced by MotionManager::checkinMotion(), MotionManager::checkoutMotion(), Thread::Condition::displayRecursiveLockWarning(), Thread::join(), MotionManager::processMsg(), MotionManager::removeMotion(), Thread::start(), Thread::testCurrentCancel(), and Thread::Lock::~Lock().

static void stacktrace::displayRelPath ( FILE *  os,
const char *  wd,
const char *  path 
) [static]

Definition at line 671 of file StackTrace.cc.

Referenced by displayStackFrame().

static void stacktrace::displayStackFrame ( unsigned int  depth,
const struct StackFrame *  frame 
) [static]

Definition at line 713 of file StackTrace.cc.

void stacktrace::displayStackTrace ( const struct StackFrame *  frame  ) 
static void stacktrace::freeBacktraceRegion ( struct StackFrame *  frame  )  [static]

Definition at line 297 of file StackTrace.cc.

void stacktrace::freeStackTrace ( struct StackFrame *  frame  ) 

frees a list of StackFrames, such as is returned by recordStackTrace

Referenced by Thread::start(), MotionManager::CommandEntry::~CommandEntry(), and Thread::~Thread().

void stacktrace::getCurrentStackFrame ( struct StackFrame *  frame  ) 

stores information about the caller's stack frame into frame

static int stacktrace::getline ( char **  s,
size_t *  len,
FILE *  f 
) [static]
static int stacktrace::growAlloc ( struct StackFrame *  frame  )  [static]

Definition at line 273 of file StackTrace.cc.

struct StackFrame * stacktrace::recordOverStackTrace ( struct StackFrame *  frame,
unsigned int  skip = 0 
) [read]

repeatedly calls unrollStackFrame() until the root frame is reached or end of frame list is hit, skipping the top skip frames

This is handy for reusing previously allocated frames, returns the unused portion (if return value equals frame, none were used -- implies never cleared skip)

struct StackFrame * stacktrace::recordStackTrace ( unsigned int  limit = -1U,
unsigned int  skip = 0 
) [read]

repeatedly calls unrollStackFrame() until the root frame is reached or limit is hit, skipping the top skip frames

pass -1U for limit to request unlimited trace, and 0 to start with the function calling recordStackTrace

Referenced by Thread::start().

int stacktrace::unrollStackFrame ( struct StackFrame *  curFrame,
struct StackFrame *  nextFrame 
)

stores information about the caller to curFrame into nextFrame

Returns:
0 if error occurred (i.e. bottom of the stack), non-zero upon success nextFrame can be the same instance as curFrame, will update in place. curFrame->caller will be set to nextFrame.

Variable Documentation

const size_t stacktrace::MIN_CAP = 50

Definition at line 284 of file StackTrace.cc.

Referenced by allocBacktraceRegion().


Tekkotsu v5.1CVS
Generated Mon May 9 04:59:26 2016 by Doxygen 1.6.3