[sanitizer] Fix off-by-one-line in SEGV reports on Android.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Thu, 13 Feb 2014 13:32:24 +0000 (13:32 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Thu, 13 Feb 2014 13:32:24 +0000 (13:32 +0000)
This will be covered by null_deref.cc test (requires one more fix to pass).

llvm-svn: 201325

compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc

index 4e29e25..04ab618 100644 (file)
@@ -258,8 +258,10 @@ void StackTrace::SlowUnwindStackWithContext(uptr pc, void *context,
   if (res < 0) return;
   CHECK((uptr)res <= kStackTraceMax);
 
+  // +2 compensate for libcorkscrew unwinder returning addresses of call
+  // instructions instead of raw return addresses.
   for (sptr i = 0; i < res; ++i)
-    trace[size++] = frames[i].absolute_pc;
+    trace[size++] = frames[i].absolute_pc + 2;
 }
 
 #endif  // !SANITIZER_GO