Records program counter values obtained from a signal handler. Records program counter values for up to max_depth frames, skipping the most recent skip_count stack frames, stores their corresponding values in results, and returns the number of frames stored. (Note that the frame generated for the absl::GetStackFramesWithContext() routine itself is also skipped.)

Synopsis

Declared in <absl/debugging/stacktrace.h>

extern
int
GetStackTraceWithContext(
    void** result,
    int max_depth,
    int skip_count,
    void const* uc,
    int* min_dropped_frames);

Description

The uc parameter, if non‐null, should be a pointer to a ucontext_t value passed to a signal handler registered via the sa_sigaction field of a sigaction struct. (See http://man7.org/linux/man‐pages/man2/sigaction.2.html.) The uc value may help a stack unwinder to provide a better stack trace under certain conditions. uc may safely be null.

The min_dropped_frames output parameter, if non‐null, points to the location to note any dropped stack frames, if any, due to buffer limitations or other reasons. (This value will be set to 0 if no frames were dropped.) The number of total stack frames is guaranteed to be >= skip_count + max_depth + *min_dropped_frames.

Return Value

The number of frames stored in result.

Parameters

Name

Description

result

Buffer to receive the recorded program counter values.

max_depth

Maximum number of frames to record.

skip_count

Number of most recent stack frames to skip.

uc

Pointer to the signal handler's ucontext_t value, or null.

min_dropped_frames

If non‐null, receives the number of stack frames dropped.

Created with MrDocs