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 this function is similar to absl::GetStackFrames() except that it returns the stack trace only, and not stack frame sizes.
Declared in <absl/debugging/stacktrace.h>
extern
int
GetStackTrace(
void** result,
int max_depth,
int skip_count);
Example:
main() { foo(); } foo() { bar(); } bar() { void* result[10]; int depth = absl::GetStackTrace(result, 10, 1); }
This produces:
result[0]foo result[1]main .... ...
result must not be null.
The number of frames stored in result.
| 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. |