[llvm-commits] [compiler-rt] r168306 - in /compiler-rt/trunk: include/sanitizer/common_interface_defs.h lib/sanitizer_common/sanitizer_stacktrace.cc
Kostya Serebryany
kcc at google.com
Mon Nov 19 02:31:00 PST 2012
Author: kcc
Date: Mon Nov 19 04:31:00 2012
New Revision: 168306
URL: http://llvm.org/viewvc/llvm-project?rev=168306&view=rev
Log:
[asan] support x32 mode in the fast stack unwinder. Patch by H.J. Lu
Modified:
compiler-rt/trunk/include/sanitizer/common_interface_defs.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc
Modified: compiler-rt/trunk/include/sanitizer/common_interface_defs.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/sanitizer/common_interface_defs.h?rev=168306&r1=168305&r2=168306&view=diff
==============================================================================
--- compiler-rt/trunk/include/sanitizer/common_interface_defs.h (original)
+++ compiler-rt/trunk/include/sanitizer/common_interface_defs.h Mon Nov 19 04:31:00 2012
@@ -48,6 +48,13 @@
typedef unsigned long uptr; // NOLINT
typedef signed long sptr; // NOLINT
#endif // defined(_WIN64)
+#if defined(__x86_64__)
+// Since x32 uses ILP32 data model in 64-bit hardware mode, we must use
+// 64-bit pointer to unwind stack frame.
+typedef unsigned long long uhwptr; // NOLINT
+#else
+typedef uptr uhwptr; // NOLINT
+#endif
typedef unsigned char u8;
typedef unsigned short u16; // NOLINT
typedef unsigned int u32;
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc?rev=168306&r1=168305&r2=168306&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc Mon Nov 19 04:31:00 2012
@@ -123,18 +123,18 @@
uptr stack_top, uptr stack_bottom) {
CHECK(size == 0 && trace[0] == pc);
size = 1;
- uptr *frame = (uptr*)bp;
- uptr *prev_frame = frame;
+ uhwptr *frame = (uhwptr *)bp;
+ uhwptr *prev_frame = frame;
while (frame >= prev_frame &&
- frame < (uptr*)stack_top - 2 &&
- frame > (uptr*)stack_bottom &&
+ frame < (uhwptr *)stack_top - 2 &&
+ frame > (uhwptr *)stack_bottom &&
size < max_size) {
- uptr pc1 = frame[1];
+ uhwptr pc1 = frame[1];
if (pc1 != pc) {
- trace[size++] = pc1;
+ trace[size++] = (uptr) pc1;
}
prev_frame = frame;
- frame = (uptr*)frame[0];
+ frame = (uhwptr *)frame[0];
}
}
More information about the llvm-commits
mailing list