diff options
Diffstat (limited to 'abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc')
-rw-r--r-- | abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc | 20 |
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; } |