[PATCH] D46004: Be more accurate when calculating the previous instruction address on Arm.
Igor Kudrin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 7 03:12:42 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL331626: [sanitizer] Be more accurate when calculating the previous instruction address… (authored by ikudrin, committed by ).
Herald added a subscriber: delcypher.
Changed prior to commit:
https://reviews.llvm.org/D46004?vs=143710&id=145442#toc
Repository:
rL LLVM
https://reviews.llvm.org/D46004
Files:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h
@@ -75,10 +75,11 @@
ALWAYS_INLINE
uptr StackTrace::GetPreviousInstructionPc(uptr pc) {
#if defined(__arm__)
- // Cancel Thumb bit.
- pc = pc & (~1);
-#endif
-#if defined(__powerpc__) || defined(__powerpc64__)
+ // T32 (Thumb) branch instructions can be 16 or 32 bit long,
+ // so we return (pc-2) in that case in order to be safe.
+ // For A32 mode we return (pc-4) because all instructions are 32 bit long.
+ return (pc - 3) & (~1);
+#elif defined(__powerpc__) || defined(__powerpc64__) || defined(__aarch64__)
// PCs are always 4 byte aligned.
return pc - 4;
#elif defined(__sparc__) || defined(__mips__)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46004.145442.patch
Type: text/x-patch
Size: 892 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180507/a89244bd/attachment.bin>
More information about the llvm-commits
mailing list