[PATCH] [compiler-rt] bug 23600 - sanitizer stack trace pc off by 1

Kostya Serebryany kcc at google.com
Wed May 27 10:33:08 PDT 2015


+samsonov for lit.common.cfg

No need for the "Changelog:" entry -- I personally see it as redundancy.


================
Comment at: lib/sanitizer_common/sanitizer_stacktrace.h:47
@@ +46,3 @@
+  // Nonzero if the stack trace was generated in response to a signal.
+  bool signaled;
+
----------------
I frankly don't remember is there is a reason to keep StackTrace <= 16 bytes. 
Let me check later today. 

================
Comment at: lib/sanitizer_common/sanitizer_stacktrace.h:84
@@ -78,3 +83,3 @@
   // Cancel Thumb bit.
-  pc = pc & (~1);
+  return pc & (~1);
 #endif
----------------
I think the old code was intentional. 
It cancels the thumb bit (whatever that is) and then executes the rest of the function.
Did you test it on arm? 

================
Comment at: lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc:37
@@ -33,1 +36,3 @@
+    const int adjust = (0 == i) && signaled ? 0 : 1;
+    const uptr pc = trace[i] - adjust;
     SymbolizedStack *frames = Symbolizer::GetOrInit()->SymbolizePC(pc);
----------------
I frankly don't understand this. 
The old code was to call GetPreviousInstructionPc(), which on some archs subtracted 4 or 8.
Now you just subtract 1. Why?

http://reviews.llvm.org/D10065

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list