DeskLib 2.90a:BackTrace.h


Contents


Functions


BackTrace_SupportCurrentFrame

void BackTrace_SupportCurrentFrame(_kernel_unwindblock *frame);

Read the current values of fp, sl and pc (so that _kernel_unwind() can be called).


BackTrace_OutputToStdErr

void BackTrace_OutputToStdErr(void );

Generates a stack backtrace on stderr.


BackTrace_OutputToStreamWithPrefix

void BackTrace_OutputToStreamWithPrefix(FILE *stream, const char *prefix);

Sends a backtrace to 'stream', prefixing each line with 'prefix'.


BackTrace_OutputToFFunctionWithPrefix

void BackTrace_OutputToFFunctionWithPrefix(backtrace_printf_fn fn, void *reference, const char *prefix);

Sends a backtrace to 'fn', prefixing each line with 'prefix'.


BackTrace_GetPC

unsigned int BackTrace_GetPC(void );

Returns PC for caller.


BackTrace_GetSL

unsigned int BackTrace_GetSL(void );

Returns value of stack-limit register.


BackTrace_GetPC2

unsigned int BackTrace_GetPC2(void );

Strips off status flags and processor mode from the current PC.


BackTrace_GetNestingDepth

int BackTrace_GetNestingDepth(void );

Returns the current function-nesting depth. Only functions which set up a stack-frame are detected, and note that Shared C Lib stack-extension functions create a stack-frame.


BackTrace_GetCurrentFunctions

const BackTrace_functionlist * BackTrace_GetCurrentFunctions(void );

Returns a pointer to an internal object containing array of current functions. Each entry in the array is the address of the save instruction used to create each stack-frame. This instruction is usually a 'STM ...'. 'functions[0]' is address of most recent save instruction. 'n' is number of functions found.

A maximum of BackTrace_MAXFNS are found.


BackTrace_GetFunctionName

const char * BackTrace_GetFunctionName(const void *ptr);

Returns function name if ptr is <= 4 words after start of function and the name is embedded in code. Otherwise returns NULL.


Macro


BackTrace_MAXFNS

#define BackTrace_MAXFNS 256

Types


backtrace_printf_fn

typedef int (*backtrace_printf_fn)(void *reference, const char *format, ... );

BackTrace_functionlist

typedef struct
{
int n;
unsigned int **functions;

} BackTrace_functionlist;