Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

StackTrace.cc File Reference

Implements functionality for performing stack traces. More...

#include "StackTrace.h"
#include <cstddef>
#include <unistd.h>
#include <execinfo.h>
#include <dlfcn.h>
#include <sys/param.h>
#include <errno.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
Include dependency graph for StackTrace.cc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  stacktrace
 

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


Defines

#define ST_UNUSED(x)   UNUSED_##x
 portable access to compiler hint not to warn if a function argument is ignored (goes in argument list)
#define ST_BODY_UNUSED(x)   (void)UNUSED_##x
 portable access to compiler hint not to warn if a function argument is ignored (goes at beginning of function body)

Functions

int stacktrace::unrollStackFrame (struct StackFrame *curFrame, struct StackFrame *nextFrame)
 stores information about the caller to curFrame into nextFrame
static int stacktrace::growAlloc (struct StackFrame *frame)
static void stacktrace::allocBacktraceRegion (struct StackFrame *frame, size_t cap)
static void stacktrace::freeBacktraceRegion (struct StackFrame *frame)
void stacktrace::getCurrentStackFrame (struct StackFrame *frame)
 stores information about the caller's stack frame into frame
void stacktrace::freeStackTrace (struct StackFrame *frame)
 frees a list of StackFrames, such as is returned by recordStackTrace
struct StackFrame * stacktrace::allocateStackTrace (unsigned int size)
 preallocates a stack trace of a particular size (doesn't actually perform a stack trace, merely allocates the linked list)
struct StackFrame * stacktrace::recordStackTrace (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 StackFrame * stacktrace::recordOverStackTrace (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 stacktrace::getline (char **s, size_t *len, FILE *f)
static int stacktrace::addr2lineLookup (const char *const ex, const void *const off, char **srcfile, size_t *srcfilelen, char **func, size_t *funclen)
static void stacktrace::displayRelPath (FILE *os, const char *wd, const char *path)
static void stacktrace::beginDisplay ()
 attempts to read symbol information and displays stack trace header
static void stacktrace::displayStackFrame (unsigned int depth, const struct StackFrame *frame)
static void stacktrace::completeDisplay (int isend)
 releases symbol information used during display
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
void stacktrace::displayStackTrace (const struct StackFrame *frame)
 dumps stored stack trace to stderr

Variables

const size_t stacktrace::MIN_CAP = 50

Detailed Description

Implements functionality for performing stack traces.

Author:
ejt (Generalized and implementation for non-MIPS platforms)
Stuart Scandrett (original inspiration, Aperios/MIPS stack operations)

Definition in file StackTrace.cc.


Define Documentation

#define ST_BODY_UNUSED (  )     (void)UNUSED_##x

portable access to compiler hint not to warn if a function argument is ignored (goes at beginning of function body)

Definition at line 59 of file StackTrace.cc.

#define ST_UNUSED (  )     UNUSED_##x

portable access to compiler hint not to warn if a function argument is ignored (goes in argument list)

Definition at line 57 of file StackTrace.cc.


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