summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_symbolizer_mac.cc
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2015-03-25 11:01:33 +0000
committerAlexander Potapenko <glider@google.com>2015-03-25 11:01:33 +0000
commit683a4f18583d53ffe641d588289b5b7743ad8659 (patch)
treeee11e53195987327256da52aba98299a97744f83 /lib/sanitizer_common/sanitizer_symbolizer_mac.cc
parent652a27a255f00a90cd2d78d191f637921847b64a (diff)
[ASan] Suppress the deprecation warning from atos that breaks AtosSymbolizer on OSX 10.9
On OS X 10.9 /usr/bin/atos prints the following warning upon invocation: -- Warning: /usr/bin/atos is moving and will be removed from a future OS X release. It is now available in the Xcode developer tools to be invoked via: `xcrun atos` To silence this warning, pass the '-d' command-line flag to this tool. -- AtosSymbolizer treats the warning as the symbolization result for the first PC passed to the symbolizer. As a result, for each of the following PCs the file:line info for the previous PC is printed, e.g.: ==97926==ERROR: AddressSanitizer: attempting double-free on 0x60200000dfb0 in thread T0: ==97926==Using atos at user-specified path: /usr/bin/atos ==97926==Using dladdr symbolizer. #0 0x1007407e0 in -- (+0x427e0) #1 0x1006f6f25 in wrap_free asan_malloc_mac.cc:114 #2 0x7fff916e05fc in main atos-symbolizer.cc:17 #3 0x0 (<unknown module>) Unfortunately atos doesn't accept the -d switch on OSX versions other than 10.9, thus we have to check for the OSX version. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@233180 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_symbolizer_mac.cc')
-rw-r--r--lib/sanitizer_common/sanitizer_symbolizer_mac.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/sanitizer_common/sanitizer_symbolizer_mac.cc b/lib/sanitizer_common/sanitizer_symbolizer_mac.cc
index e11bf9cc9..c2397ef98 100644
--- a/lib/sanitizer_common/sanitizer_symbolizer_mac.cc
+++ b/lib/sanitizer_common/sanitizer_symbolizer_mac.cc
@@ -16,6 +16,7 @@
#if SANITIZER_MAC
#include "sanitizer_allocator_internal.h"
+#include "sanitizer_mac.h"
#include "sanitizer_symbolizer_mac.h"
namespace __sanitizer {
@@ -57,7 +58,14 @@ class AtosSymbolizerProcess : public SymbolizerProcess {
char pid_str[16];
internal_snprintf(pid_str, sizeof(pid_str), "%d", parent_pid_);
- execl(path_to_binary, path_to_binary, "-p", pid_str, (char *)0);
+ if (GetMacosVersion() == MACOS_VERSION_MAVERICKS) {
+ // On Mavericks atos prints a deprecation warning which we suppress by
+ // passing -d. The warning isn't present on other OSX versions, even the
+ // newer ones.
+ execl(path_to_binary, path_to_binary, "-p", pid_str, "-d", (char *)0);
+ } else {
+ execl(path_to_binary, path_to_binary, "-p", pid_str, (char *)0);
+ }
}
pid_t parent_pid_;