summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-02-11 13:38:57 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-02-11 13:38:57 +0000
commit1df9cbe3938900c62cad6819fd98f34c58ce0c3f (patch)
tree78c5cfabd60fd09dee31b2a22ef34ff4a3bd8fb3 /lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc
parent11f9ef758b4505ac5c3d9d38f0cdb01fd13e9a8e (diff)
[sanitizer] Use system unwinder in signal handlers on Android.
Because of the way Bionic sets up signal stack frames, libc unwinder is unable to step through it, resulting in broken SEGV stack traces. Luckily, libcorkscrew.so on Android implements an unwinder that can start with a signal context, thus sidestepping the issue. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201151 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc')
-rw-r--r--lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc b/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc
index ffc4f2ede..1b16c4dac 100644
--- a/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc
+++ b/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc
@@ -63,12 +63,17 @@ void StackTrace::PrintStack(const uptr *addr, uptr size) {
Printf("\n");
}
-void StackTrace::Unwind(uptr max_depth, uptr pc, uptr bp, uptr stack_top,
- uptr stack_bottom, bool request_fast_unwind) {
- if (!WillUseFastUnwind(request_fast_unwind))
- SlowUnwindStack(pc, max_depth);
- else
+void StackTrace::Unwind(uptr max_depth, uptr pc, uptr bp, void *context,
+ uptr stack_top, uptr stack_bottom,
+ bool request_fast_unwind) {
+ if (!WillUseFastUnwind(request_fast_unwind)) {
+ if (context)
+ SlowUnwindStackWithContext(pc, context, max_depth);
+ else
+ SlowUnwindStack(pc, max_depth);
+ } else {
FastUnwindStack(pc, bp, stack_top, stack_bottom, max_depth);
+ }
top_frame_bp = size ? bp : 0;
}