Get the current async stack trace into addresses, which has room for at least maxAddresses frames. If no async operation is progress, then this will write 0 frames.

Synopsis

Declared in <folly/debugging/symbolizer/StackTrace.h>

ssize_t
getAsyncStackTraceSafe(
    uintptr_t* addresses,
    size_t maxAddresses);

Description

This will include both async and non‐async frames. For example, the stack trace could look something like this:

funcD <‐‐ non‐async, current top of stack funcC <‐‐ non‐async co_funcB <‐‐ async co_funcA <‐‐ async main <‐‐ non‐async, root of async stack

Async‐signal‐safe, but likely slower.

Return Value

The number of frames written, or ‐1 on failure.

Parameters

Name

Description

addresses

Output buffer for the captured frame addresses.

maxAddresses

Capacity of the addresses buffer, in frames.

Created with MrDocs