Skip to content

AStacktrace#

Stacktrace consisting of a collection of stack function frames.

Header:#include <AUI/Platform/AStacktrace.h>
CMake:aui_link(my_target PUBLIC aui::core)

Detailed Description#

The first element of the collection represents the top of the stack, which is the last function invocation. Typically, this is the point at which this stacktrace was created (unless skipFrames is zero). The last element of the collection represents the bottom of the stack (typically entrypoint).

Public Types#

Entry#


class AStacktrace::Entry

Stacktrace entry.

Empty structure.

Public Methods#

capture#


static AStacktrace AStacktrace::capture(unsigned skipFrames = 0, unsigned maxFrames = 128)

Creates stacktrace of the current thread.

Arguments
skipFrames
number of frames to skip.
maxFrames
max number of frames.

A call to AStacktrace::capture is always skipped in the stacktrace.

resolveSymbolsIfNeeded#


void AStacktrace::resolveSymbolsIfNeeded()

Invokes function name resolution with function pointers.

Must be called before using AStacktrace::Entry::functionName() and similar functions.

stripBeforeFunctionCall#


aui::range<iterator> AStacktrace::stripBeforeFunctionCall(void* pFunction, int maxAllowedOffsetInBytes = 50)

Tries to find the function pointer in stacktrace and strips stacktrace until function frame.

Arguments
pFunction
pointer to function.
maxAllowedOffsetInBytes
max offset error in bytes.
Returns
itself (modified)

If stripBeforeFunctionCall fails to find pFunction, it leaves AStacktrace unmodified and returns itself.

stripBeforeFunctionCall strips the end of stacktrace, excluding the passed function.

maxAllowedOffsetInBytes is intended to find stack frame, which is not in exact location of function pointer.