| # Copyright 2019 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/config/android/config.gni") |
| import("//build/config/clang/clang.gni") |
| import("//build/util/generate_wrapper.gni") |
| |
| generate_wrapper("asan_device_setup") { |
| executable = "with_asan.py" |
| wrapper_script = "$root_out_dir/bin/run_with_asan" |
| |
| if (target_cpu == "arm") { |
| _lib_arch = "arm" |
| } else if (target_cpu == "arm64") { |
| _lib_arch = "aarch64" |
| } else if (target_cpu == "x86") { |
| _lib_arch = "i686" |
| } else { |
| assert(false, "No ASAN library available for $target_cpu") |
| } |
| |
| _adb_path = "${android_sdk_root}/platform-tools/adb" |
| _lib_path = "${clang_base_path}/lib/clang/${clang_version}/lib/linux/libclang_rt.asan-${_lib_arch}-android.so" |
| data = [ |
| "asan_device_setup.sh", |
| "with_asan.py", |
| _adb_path, |
| _lib_path, |
| ] |
| |
| _rebased_lib_path = rebase_path(_lib_path, root_build_dir) |
| _rebased_adb_path = rebase_path(_adb_path, root_build_dir) |
| |
| executable_args = [ |
| "--adb", |
| "@WrappedPath(${_rebased_adb_path})", |
| "--lib", |
| "@WrappedPath(${_rebased_lib_path})", |
| ] |
| } |