[Sanitizer] Call Windows unwinder 'slow' and share StackTrace::Unwind across all platforms. No functionality change.

llvm-svn: 194193
This commit is contained in:
Alexey Samsonov 2013-11-07 06:33:06 +00:00
parent 14bdd7a925
commit e13f775a63
5 changed files with 38 additions and 23 deletions

View File

@ -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)

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -376,11 +376,7 @@ void GetThreadStackAndTls(bool main, uptr *stk_addr, uptr *stk_size,
#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.