summaryrefslogtreecommitdiff
path: root/lib/asan/asan_linux.cc
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-02-10 13:34:43 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2014-02-10 13:34:43 +0000
commit10035527d166ffa2bc5c8d11bb80f2af802894af (patch)
treea86c8ab4dc41a4fdc072a81fb39721d1f9a9c833 /lib/asan/asan_linux.cc
parent4429711ad9b242959dd884f9fc3ff89d5430ae99 (diff)
Add a copy of missing <ucontext.h> for Android and enable ASan SEGV handler.
This change adds a copy of <ucontext.h> for Android found in google-breakpad that is missing from the official NDK. ASan SEGV handler is still disabled by default and can be enabled with ASAN_OPTIONS=handle_segv. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201084 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_linux.cc')
-rw-r--r--lib/asan/asan_linux.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/asan/asan_linux.cc b/lib/asan/asan_linux.cc
index 871068b91..042e06ed9 100644
--- a/lib/asan/asan_linux.cc
+++ b/lib/asan/asan_linux.cc
@@ -32,8 +32,9 @@
#include <unistd.h>
#include <unwind.h>
-#if !SANITIZER_ANDROID
-// FIXME: where to get ucontext on Android?
+#if SANITIZER_ANDROID
+#include <ucontext.h>
+#else
#include <sys/ucontext.h>
#endif
@@ -51,9 +52,7 @@ void *AsanDoesNotSupportStaticLinkage() {
}
void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {
-#if SANITIZER_ANDROID
- *pc = *sp = *bp = 0;
-#elif defined(__arm__)
+#if defined(__arm__)
ucontext_t *ucontext = (ucontext_t*)context;
*pc = ucontext->uc_mcontext.arm_pc;
*bp = ucontext->uc_mcontext.arm_fp;