BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bsls::StackAddressUtil Struct Reference

#include <bsls_stackaddressutil.h>

Public Types

enum  { k_IGNORE_FRAMES = 0 }
 

Static Public Member Functions

static int getStackAddresses (void **buffer, int maxFrames)
 
static void formatCheapStack (char *output, int length, const char *taskname=0)
 

Detailed Description

This struct provides a namespace for the function to obtain return addresses from the stack.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
k_IGNORE_FRAMES 

Member Function Documentation

◆ formatCheapStack()

static void bsls::StackAddressUtil::formatCheapStack ( char *  output,
int  length,
const char *  taskname = 0 
)
static

Load the specified output buffer having the specified length with the Bloomberg standard "cheapstack" contents as a null-terminated string. On successfully obtaining the current call stack, this will be instructions on how to run the Bloomberg tool showfunc.tsk (with the optionally specified taskname, otherwise with an attempt to obtain the system-specific process name) to get details of the current call stack where formatCheapStack was called. On failure, text indicating that the call stack was not obtainable will be written to output. If length is not long enough for the entire output it will be truncated. The behavior is undefined unless 0 <= length and output has the capacity for at least length bytes.

◆ getStackAddresses()

static int bsls::StackAddressUtil::getStackAddresses ( void **  buffer,
int  maxFrames 
)
static

Get an sequence of return addresses from the current thread's function call stack, ordered from most recent call to least recent, and load them into the specified array *buffer, which is at least the specified maxFrames in length. A return address is an address stored on the stack that points to the first instruction that will be executed after the called subroutine returns. If there are more than maxFrames frames on the stack, only the return addresses for the maxFrames most recent routine calls are stored. When this routine completes, buffer will contain an ordered sequence of return addresses, sorted such that recent calls occur in the array before calls that took place before them. Return the number of stack frames stored into buffer on success, and a negative value otherwise. The behavior is undefined unless maxFrames >= 0 and buffer has room for at least maxFrames addresses. Note that this routine may fill buffer with garbage if the stack is corrupt, or on Windows if some stack frames represent optimized routines.


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