summaryrefslogtreecommitdiff
path: root/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-02-02 23:49:36 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-02-02 23:49:36 +0000
commit2abe333d18331e09635f444e4676a990ee9eedf9 (patch)
treefb22bbbde0c615b678d2d293a510e985be516a0f /abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc
parent194e654485ff35c8a9b6d1c6740cebce93092bda (diff)
parent6f56677b3f8b18c6e63c5779bf3dceea75685c12 (diff)
downloadlibtextclassifier-simpleperf-release.tar.gz
Snap for 11400057 from 6f56677b3f8b18c6e63c5779bf3dceea75685c12 to simpleperf-releasesimpleperf-release
Change-Id: Iada2b682dc262b6f7c1ba17a65175406d1aa143b
Diffstat (limited to 'abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc')
-rw-r--r--abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc20
1 files changed, 15 insertions, 5 deletions
diff --git a/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc b/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc
index 2e7c2f4..a49ed2f 100644
--- a/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc
+++ b/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc
@@ -57,7 +57,7 @@ static inline void *StacktracePowerPCGetLR(void **sp) {
// This check is in case the compiler doesn't define _CALL_SYSV.
return *(sp+1);
#else
-#error Need to specify the PPC ABI for your archiecture.
+#error Need to specify the PPC ABI for your architecture.
#endif
}
@@ -131,7 +131,12 @@ static void **NextStackFrame(void **old_sp, const void *uc) {
const ucontext_t* signal_context =
reinterpret_cast<const ucontext_t*>(uc);
void **const sp_before_signal =
- reinterpret_cast<void**>(signal_context->uc_mcontext.gp_regs[PT_R1]);
+#if defined(__PPC64__)
+ reinterpret_cast<void **>(signal_context->uc_mcontext.gp_regs[PT_R1]);
+#else
+ reinterpret_cast<void **>(
+ signal_context->uc_mcontext.uc_regs->gregs[PT_R1]);
+#endif
// Check that alleged sp before signal is nonnull and is reasonably
// aligned.
if (sp_before_signal != nullptr &&
@@ -226,11 +231,16 @@ static int UnwindImpl(void** result, int* sizes, int max_depth, int skip_count,
// Implementation detail: we clamp the max of frames we are willing to
// count, so as not to spend too much time in the loop below.
const int kMaxUnwind = 1000;
- int j = 0;
- for (; next_sp != nullptr && j < kMaxUnwind; j++) {
+ int num_dropped_frames = 0;
+ for (int j = 0; next_sp != nullptr && j < kMaxUnwind; j++) {
+ if (skip_count > 0) {
+ skip_count--;
+ } else {
+ num_dropped_frames++;
+ }
next_sp = NextStackFrame<!IS_STACK_FRAMES, IS_WITH_CONTEXT>(next_sp, ucp);
}
- *min_dropped_frames = j;
+ *min_dropped_frames = num_dropped_frames;
}
return n;
}