[compiler-rt] r194193 - [Sanitizer] Call Windows unwinder 'slow' and share StackTrace::Unwind across all platforms. No functionality change.
Alexey Samsonov
samsonov at google.com
Wed Nov 6 22:33:06 PST 2013
Author: samsonov
Date: Thu Nov 7 00:33:06 2013
New Revision: 194193
URL: http://llvm.org/viewvc/llvm-project?rev=194193&view=rev
Log:
[Sanitizer] Call Windows unwinder 'slow' and share StackTrace::Unwind across all platforms. No functionality change.
Added:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc
Modified:
compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt
compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt?rev=194193&r1=194192&r2=194193&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/sanitizer_common/CMakeLists.txt Thu Nov 7 00:33:06 2013
@@ -25,6 +25,7 @@ set(SANITIZER_LIBCDEP_SOURCES
sanitizer_common_libcdep.cc
sanitizer_linux_libcdep.cc
sanitizer_posix_libcdep.cc
+ sanitizer_stacktrace_libcdep.cc
sanitizer_stoptheworld_linux_libcdep.cc
sanitizer_symbolizer_libcdep.cc
sanitizer_symbolizer_posix_libcdep.cc)
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc?rev=194193&r1=194192&r2=194193&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc Thu Nov 7 00:33:06 2013
@@ -89,22 +89,6 @@ int internal_isatty(fd_t fd) {
return isatty(fd);
}
-#ifndef SANITIZER_GO
-void StackTrace::Unwind(uptr max_depth, uptr pc, uptr bp, uptr stack_top,
- uptr stack_bottom, bool fast) {
- // Check if fast unwind is available. Fast unwind is the only option on Mac.
- if (!SANITIZER_CAN_FAST_UNWIND)
- fast = false;
- else if (SANITIZER_MAC)
- fast = true;
-
- if (!fast)
- SlowUnwindStack(pc, max_depth);
- else
- FastUnwindStack(pc, bp, stack_top, stack_bottom, max_depth);
-}
-#endif // SANITIZER_GO
-
} // namespace __sanitizer
#endif
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h?rev=194193&r1=194192&r2=194193&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h Thu Nov 7 00:33:06 2013
@@ -23,9 +23,11 @@ static const uptr kStackTraceMax = 256;
defined(__powerpc__) || defined(__powerpc64__) || \
defined(__sparc__) || \
defined(__mips__))
-#define SANITIZER_CAN_FAST_UNWIND 0
+# define SANITIZER_CAN_FAST_UNWIND 0
+#elif SANITIZER_WINDOWS
+# define SANITIZER_CAN_FAST_UNWIND 0
#else
-#define SANITIZER_CAN_FAST_UNWIND 1
+# define SANITIZER_CAN_FAST_UNWIND 1
#endif
struct StackTrace {
Added: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc?rev=194193&view=auto
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc (added)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc Thu Nov 7 00:33:06 2013
@@ -0,0 +1,32 @@
+//===-- sanitizer_stacktrace_libcdep.cc -----------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is shared between AddressSanitizer and ThreadSanitizer
+// run-time libraries.
+//===----------------------------------------------------------------------===//
+
+#include "sanitizer_stacktrace.h"
+
+namespace __sanitizer {
+
+void StackTrace::Unwind(uptr max_depth, uptr pc, uptr bp, uptr stack_top,
+ uptr stack_bottom, bool fast) {
+ // Check if fast unwind is available. Fast unwind is the only option on Mac.
+ if (!SANITIZER_CAN_FAST_UNWIND)
+ fast = false;
+ else if (SANITIZER_MAC)
+ fast = true;
+
+ if (!fast)
+ SlowUnwindStack(pc, max_depth);
+ else
+ FastUnwindStack(pc, bp, stack_top, stack_bottom, max_depth);
+}
+
+} // namespace __sanitizer
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc?rev=194193&r1=194192&r2=194193&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc Thu Nov 7 00:33:06 2013
@@ -376,11 +376,7 @@ void GetThreadStackAndTls(bool main, upt
#endif
}
-void StackTrace::Unwind(uptr max_depth, uptr pc, uptr bp, uptr stack_top,
- uptr stack_bottom, bool fast) {
- (void)fast;
- (void)stack_top;
- (void)stack_bottom;
+void StackTrace::SlowUnwindStack(uptr pc, uptr max_depth) {
void *tmp[kStackTraceMax];
// FIXME: CaptureStackBackTrace might be too slow for us.
More information about the llvm-commits
mailing list