diff options
author | Jose Fonseca <jfonseca@vmware.com> | 2016-04-19 23:17:40 +0100 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2016-04-19 23:17:40 +0100 |
commit | 732b066c7040b6e5b718cdb3516f82affc76c834 (patch) | |
tree | c48d1f11d5b285cab8c7ecca1ad551ce9384a39c /cli | |
parent | fb938d978801b5608ab91b62197388954546e5d8 (diff) |
cli: Ensure libasan.so is preloaded when tracing.
Diffstat (limited to 'cli')
-rw-r--r-- | cli/cli_trace.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/cli/cli_trace.cpp b/cli/cli_trace.cpp index 8b780f36..97c1cc83 100644 --- a/cli/cli_trace.cpp +++ b/cli/cli_trace.cpp @@ -34,6 +34,10 @@ #include <iostream> #include <fstream> +#ifndef __has_feature +# define __has_feature(x) 0 +#endif + #include "os_string.hpp" #include "os_process.hpp" #include "os_version.hpp" @@ -187,8 +191,16 @@ traceProgram(trace::API api, #if defined(TRACE_VARIABLE) const char *oldEnvVarValue = getenv(TRACE_VARIABLE); if (oldEnvVarValue) { +#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) + /* Ensure libasan.so is preloaded first. */ + os::String tmp = oldEnvVarValue; + tmp.append(OS_PATH_SEP); + tmp.append(wrapperPath); + wrapperPath = tmp; +#else wrapperPath.append(OS_PATH_SEP); wrapperPath.append(oldEnvVarValue); +#endif } std::string ex; |