diff options
author | Anna Zaks <ganna@apple.com> | 2016-01-06 23:15:01 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2016-01-06 23:15:01 +0000 |
commit | 89251b08eb4bd2111bd50c72b947370e06e3acaa (patch) | |
tree | 1ed5b627e96a3df96f6a949adc9f0f79726ca583 /lib/sanitizer_common/sanitizer_linux_libcdep.cc | |
parent | 5c2b59ac6e0ba0c26a8cc2fa7983faca30aa25ce (diff) |
[sanitizers] Log all output to CrashReport on OS X
Log all of sanitizers' output (not just ASan bug reports) to CrashReport,
which simplifies diagnosing failed checks as well as other errors. This
also allows to strip the color sequences early from the printed buffer,
which is more efficient than what we had perviously.
Differential Revision: http://reviews.llvm.org/D15396
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@256988 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_linux_libcdep.cc')
-rw-r--r-- | lib/sanitizer_common/sanitizer_linux_libcdep.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/sanitizer_common/sanitizer_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_linux_libcdep.cc index 0bb66c9d6..8cf2c73b1 100644 --- a/lib/sanitizer_common/sanitizer_linux_libcdep.cc +++ b/lib/sanitizer_common/sanitizer_linux_libcdep.cc @@ -524,13 +524,13 @@ void AndroidLogInit() { atomic_store(&android_log_initialized, 1, memory_order_release); } -bool ShouldLogAfterPrintf() { +static bool ShouldLogAfterPrintf() { return atomic_load(&android_log_initialized, memory_order_acquire); } #else void AndroidLogInit() {} -bool ShouldLogAfterPrintf() { return true; } +static bool ShouldLogAfterPrintf() { return true; } #endif // SANITIZER_ANDROID void WriteOneLineToSyslog(const char *s) { @@ -541,6 +541,11 @@ void WriteOneLineToSyslog(const char *s) { #endif } +void LogMessageOnPrintf(const char *str) { + if (common_flags()->log_to_syslog && ShouldLogAfterPrintf()) + WriteToSyslog(str); +} + #endif // SANITIZER_LINUX } // namespace __sanitizer |