[#BloombergLP-bsls-StackAddressUtil] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bsls.adoc[bsls]::StackAddressUtil :relfileprefix: ../../ :mrdocs: This struct provides a namespace for the function to obtain return addresses from the stack. == Synopsis Declared in `<bsls_stackaddressutil.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class StackAddressUtil; ---- == Enums [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bsls/StackAddressUtil/_04enum.adoc[`Unnamed enum`] | Constants controlling stack address capture on Linux and Darwin. |=== == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bsls/StackAddressUtil/formatCheapStack.adoc[`formatCheapStack`] | 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. | xref:BloombergLP/bsls/StackAddressUtil/getStackAddresses.adoc[`getStackAddresses`] | 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. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#