3 # when using the address sanitizer, libasan must be linked/loaded first.
4 # to make sure this happens, this script uses LD_PRELOAD to load the
5 # library first, but only if it is necessary. If the executable is not
6 # linked against libasan, it will be executed just as it is.
10 # sanitize-wrap build/test/testrunner --gtest_shuffle
13 # find link to libasan
14 libasan
=$
(ldd
$1 |
grep libasan |
sed 's/^[[:space:]]//' | cut
-d ' ' -f1)
16 # define LD_PRELOAD if necessary
17 if [ -n "${libasan}" ] ; then
19 if [ -n "${LD_PRELOAD}" ] ; then
20 export LD_PRELOAD
="${libasan};${LD_PRELOAD}"
22 export LD_PRELOAD
="${libasan}"