PowerPC's ABIs differ from those of other architectures in that the

callee-saved return address is stored in the caller's stack frame, not
the callee's.  This patch adjusts the logic to find the LR in the
correct place for PowerPC.

Patch joint with Bill Seurer.

llvm-svn: 243467
This commit is contained in:
Bill Schmidt 2015-07-28 19:41:49 +00:00
parent a425c9d0e3
commit a32fa81c09
2 changed files with 9 additions and 2 deletions

View File

@ -83,7 +83,15 @@ void BufferedStackTrace::FastUnwindStack(uptr pc, uptr bp, uptr stack_top,
while (IsValidFrame((uptr)frame, stack_top, bottom) &&
IsAligned((uptr)frame, sizeof(*frame)) &&
size < max_depth) {
#ifdef __powerpc__
uhwptr *caller_frame = (uhwptr*)frame[0];
if (!IsValidFrame((uptr)caller_frame, stack_top, bottom) ||
!IsAligned((uptr)caller_frame, sizeof(uhwptr)))
break;
uhwptr pc1 = caller_frame[2];
#else
uhwptr pc1 = frame[1];
#endif
if (pc1 != pc) {
trace_buffer[size++] = (uptr) pc1;
}

View File

@ -19,8 +19,7 @@ namespace __sanitizer {
static const u32 kStackTraceMax = 256;
#if SANITIZER_LINUX && (defined(__aarch64__) || defined(__powerpc__) || \
defined(__powerpc64__) || defined(__sparc__) || \
#if SANITIZER_LINUX && (defined(__aarch64__) || defined(__sparc__) || \
defined(__mips__))
# define SANITIZER_CAN_FAST_UNWIND 0
#elif SANITIZER_WINDOWS