Index: lib/sanitizer_common/sanitizer_stacktrace.h =================================================================== --- lib/sanitizer_common/sanitizer_stacktrace.h +++ lib/sanitizer_common/sanitizer_stacktrace.h @@ -15,6 +15,10 @@ #include "sanitizer_internal_defs.h" +#if SANITIZER_FREEBSD +#include // for __FreeBSD_version +#endif + namespace __sanitizer { static const uptr kStackTraceMax = 256; @@ -41,14 +45,23 @@ static bool WillUseFastUnwind(bool request_fast_unwind) { // Check if fast unwind is available. Fast unwind is the only option on Mac. - // It is also the only option on FreeBSD as the slow unwinding that + // It is also the only option on FreeBSD 9.2 as the slow unwinding that // leverages _Unwind_Backtrace() yields the call stack of the signal's // handler and not of the code that raised the signal (as it does on Linux). - if (!SANITIZER_CAN_FAST_UNWIND) - return false; - else if (SANITIZER_MAC != 0 || SANITIZER_FREEBSD != 0) - return true; - return request_fast_unwind; +#if !SANITIZER_CAN_FAST_UNWIND + const bool UseFastUnwind = false; +#elif SANITIZER_MAC + const bool UseFastUnwind = true; +#elif SANITIZER_FREEBSD +# if __FreeBSD_version <= 902001 // v9.2 + const bool UseFastUnwind = true; +# else + const bool UseFastUnwind = request_fast_unwind; +# endif +#else + const bool UseFastUnwind = request_fast_unwind; +#endif + return UseFastUnwind; } static uptr GetCurrentPc();