45 #if defined(ABSL_STACKTRACE_INL_HEADER) 46 #include ABSL_STACKTRACE_INL_HEADER 48 # error Cannot calculate stack trace: will need to write for your environment 50 # include "absl/debugging/internal/stacktrace_aarch64-inl.inc" 51 # include "absl/debugging/internal/stacktrace_arm-inl.inc" 52 # include "absl/debugging/internal/stacktrace_generic-inl.inc" 53 # include "absl/debugging/internal/stacktrace_powerpc-inl.inc" 54 # include "absl/debugging/internal/stacktrace_unimplemented-inl.inc" 55 # include "absl/debugging/internal/stacktrace_win32-inl.inc" 56 # include "absl/debugging/internal/stacktrace_x86-inl.inc" 62 typedef int (*Unwinder)(
void**,
int*, int, int,
const void*,
int*);
63 std::atomic<Unwinder> custom;
65 template <
bool IS_STACK_FRAMES,
bool IS_WITH_CONTEXT>
67 int max_depth,
int skip_count,
69 int* min_dropped_frames) {
70 Unwinder f = &UnwindImpl<IS_STACK_FRAMES, IS_WITH_CONTEXT>;
71 Unwinder g = custom.load(std::memory_order_acquire);
72 if (g !=
nullptr) f = g;
75 int size = (*f)(result, sizes, max_depth, skip_count + 1, uc,
85 void** result,
int* sizes,
int max_depth,
int skip_count) {
86 return Unwind<true, false>(result, sizes, max_depth, skip_count,
nullptr,
92 int skip_count,
const void* uc,
93 int* min_dropped_frames) {
94 return Unwind<true, true>(result, sizes, max_depth, skip_count, uc,
99 void** result,
int max_depth,
int skip_count) {
100 return Unwind<false, false>(result,
nullptr, max_depth, skip_count,
nullptr,
106 const void* uc,
int* min_dropped_frames) {
107 return Unwind<false, true>(result,
nullptr, max_depth, skip_count, uc,
112 custom.store(w, std::memory_order_release);
116 const void* uc,
int* min_dropped_frames) {
118 Unwinder f =
nullptr;
119 if (sizes ==
nullptr) {
121 f = &UnwindImpl<false, false>;
123 f = &UnwindImpl<false, true>;
127 f = &UnwindImpl<true, false>;
129 f = &UnwindImpl<true, true>;
133 int n = (*f)(pcs, sizes, depth, skip, uc, min_dropped_frames);
#define ABSL_BLOCK_TAIL_CALL_OPTIMIZATION()
ABSL_ATTRIBUTE_NOINLINE ABSL_ATTRIBUTE_NO_TAIL_CALL int GetStackTraceWithContext(void **result, int max_depth, int skip_count, const void *uc, int *min_dropped_frames)
#define ABSL_ATTRIBUTE_ALWAYS_INLINE
void SetStackUnwinder(Unwinder w)
#define ABSL_ATTRIBUTE_NO_TAIL_CALL
int DefaultStackUnwinder(void **pcs, int *sizes, int depth, int skip, const void *uc, int *min_dropped_frames)
ABSL_ATTRIBUTE_NOINLINE ABSL_ATTRIBUTE_NO_TAIL_CALL int GetStackFramesWithContext(void **result, int *sizes, int max_depth, int skip_count, const void *uc, int *min_dropped_frames)
ABSL_ATTRIBUTE_NOINLINE ABSL_ATTRIBUTE_NO_TAIL_CALL int GetStackFrames(void **result, int *sizes, int max_depth, int skip_count)
#define ABSL_ATTRIBUTE_NOINLINE
ABSL_ATTRIBUTE_NOINLINE ABSL_ATTRIBUTE_NO_TAIL_CALL int GetStackTrace(void **result, int max_depth, int skip_count)