summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2012-11-20 07:00:42 +0000
committerKostya Serebryany <kcc@google.com>2012-11-20 07:00:42 +0000
commit46de5800031b08fb31042f43f9cd6c49cec891d3 (patch)
tree8ee8059df4932c59edb0a4d897586bcbfded202b /compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc
parent0a154d0490aac84ba69709c44c3c7f5f3dae03cf (diff)
downloadbcm5719-llvm-46de5800031b08fb31042f43f9cd6c49cec891d3.tar.gz
bcm5719-llvm-46de5800031b08fb31042f43f9cd6c49cec891d3.zip
[asan] more support for powerpc, patch by Peter Bergner
llvm-svn: 168356
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc')
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc
index 28ee9600d0a..964c5241fac 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc
@@ -33,7 +33,12 @@ static uptr patch_pc(uptr pc) {
// Cancel Thumb bit.
pc = pc & (~1);
#endif
+#if defined(__powerpc__) || defined(__powerpc64__)
+ // PCs are always 4 byte aligned.
+ return pc - 4;
+#else
return pc - 1;
+#endif
}
static void PrintStackFramePrefix(uptr frame_num, uptr pc) {
@@ -138,6 +143,14 @@ void StackTrace::FastUnwindStack(uptr pc, uptr bp,
}
}
+void StackTrace::PopStackFrames(uptr count) {
+ CHECK(size > count);
+ size -= count;
+ for (uptr i = 0; i < size; i++) {
+ trace[i] = trace[i + count];
+ }
+}
+
// On 32-bits we don't compress stack traces.
// On 64-bits we compress stack traces: if a given pc differes slightly from
// the previous one, we record a 31-bit offset instead of the full pc.
OpenPOWER on IntegriCloud