[PATCH] D11552: Fix fast stack-unwinding for Power
Bill Schmidt
wschmidt at linux.vnet.ibm.com
Mon Jul 27 20:49:52 PDT 2015
wschmidt created this revision.
wschmidt added reviewers: echristo, nemanjai, kbarton, seurer, hfinkel, eugenis, kcc, samsonov.
wschmidt added a subscriber: llvm-commits.
wschmidt set the repository for this revision to rL LLVM.
PowerPC differs from 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. This replaces review.llvm.org/D9259.
Repository:
rL LLVM
http://reviews.llvm.org/D11552
Files:
lib/sanitizer_common/sanitizer_stacktrace.cc
lib/sanitizer_common/sanitizer_stacktrace.h
Index: lib/sanitizer_common/sanitizer_stacktrace.h
===================================================================
--- lib/sanitizer_common/sanitizer_stacktrace.h
+++ lib/sanitizer_common/sanitizer_stacktrace.h
@@ -19,8 +19,7 @@
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
Index: lib/sanitizer_common/sanitizer_stacktrace.cc
===================================================================
--- lib/sanitizer_common/sanitizer_stacktrace.cc
+++ lib/sanitizer_common/sanitizer_stacktrace.cc
@@ -83,7 +83,15 @@
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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11552.30780.patch
Type: text/x-patch
Size: 1336 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150728/9b4beadd/attachment.bin>
More information about the llvm-commits
mailing list