[PATCH] D46469: [sanitizer] Port fast stack unwinder to sparcv8
Walter Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 4 13:51:38 PDT 2018
waltl created this revision.
waltl added reviewers: vitalybuka, eugenis, alekseyshl.
Herald added subscribers: chrib, fedor.sergeev, kubamracek, jyknight.
Repository:
rL LLVM
https://reviews.llvm.org/D46469
Files:
compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc
Index: compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc
+++ compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc
@@ -20,7 +20,7 @@
uptr StackTrace::GetNextInstructionPc(uptr pc) {
#if defined(__mips__)
return pc + 8;
-#elif defined(__powerpc__)
+#elif defined(__powerpc__) || defined(__sparc__)
return pc + 4;
#else
return pc + 1;
@@ -71,6 +71,10 @@
trace_buffer[0] = pc;
size = 1;
if (stack_top < 4096) return; // Sanity check for stack top.
+#if defined(__sparcv8__)
+ // Flush register windows to memory
+ asm volatile("ta 3" ::: "memory");
+#endif
uhwptr *frame = GetCanonicFrame(bp, stack_top, stack_bottom);
// Lowest possible address that makes sense as the next frame pointer.
// Goes up as we walk the stack.
@@ -90,6 +94,8 @@
uhwptr pc1 = caller_frame[2];
#elif defined(__s390__)
uhwptr pc1 = frame[14];
+#elif defined(__sparcv8__)
+ uhwptr pc1 = frame[15];
#else
uhwptr pc1 = frame[1];
#endif
@@ -102,7 +108,11 @@
trace_buffer[size++] = (uptr) pc1;
}
bottom = (uptr)frame;
+#if defined(__sparcv8__)
+ frame = GetCanonicFrame((uptr)frame[14], stack_top, bottom);
+#else
frame = GetCanonicFrame((uptr)frame[0], stack_top, bottom);
+#endif
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46469.145286.patch
Type: text/x-patch
Size: 1378 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180504/2c19d127/attachment.bin>
More information about the llvm-commits
mailing list