From 74b81df26cc231eb4226378fe1bda8566311da36 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Mon, 4 May 2026 17:01:47 -0700 Subject: [PATCH] Fix aarch64 stacktrace unwinding. PiperOrigin-RevId: 910322805 Change-Id: I7a4b80e306ebfe62f36098376c4e4df396ddb8dc --- absl/debugging/internal/stacktrace_aarch64-inl.inc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/absl/debugging/internal/stacktrace_aarch64-inl.inc b/absl/debugging/internal/stacktrace_aarch64-inl.inc index bbdce77f..03f22947 100644 --- a/absl/debugging/internal/stacktrace_aarch64-inl.inc +++ b/absl/debugging/internal/stacktrace_aarch64-inl.inc @@ -212,6 +212,17 @@ static int UnwindImpl(void **result, uintptr_t *frames, int *sizes, stack_info.sig_stack_low = stack_info.stack_low; stack_info.sig_stack_high = kUnknownStackEnd; +#if defined(__linux__) + // Similarly for the signal stack, retrieve the information into sig_stack and + // then pass it down per call. Calling sigaltstack with nullptr as the first + // argument doesn't change the signal stack. + stack_t sig_stack; + if (sigaltstack(nullptr, &sig_stack) == 0) { + stack_info.sig_stack_low = reinterpret_cast(sig_stack.ss_sp); + stack_info.sig_stack_high = stack_info.sig_stack_low + sig_stack.ss_size; + } +#endif + // The frame pointer points to low address of a frame. The first 64-bit // word of a frame points to the next frame up the call chain, which normally // is just after the high address of the current frame. The second word of