| # Copyright 2016 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. |
| |
| assert(is_win) |
| |
| # Where the output binaries will be placed. |
| syzygy_dest_dir = "$root_out_dir/syzygy" |
| |
| # Instruments a binary with SyzyAsan. |
| # |
| # binary_name (required) |
| # Name of the binary to be instrumented, with no extension or path. This |
| # binary_name is assumed to be in the output directory and must be |
| # generated by a dependency of this target. |
| # |
| # dest_dir (required) |
| # The destination directory where the instrumented image should be |
| # written. |
| # |
| # deps (required) |
| # Normal meaning. |
| # |
| # public_deps |
| # Normal meaning. |
| # |
| # data_deps |
| # Normal meaning. |
| template("syzygy_asan") { |
| action(target_name) { |
| if (defined(invoker.visibility)) { |
| visibility = invoker.visibility |
| } |
| script = "//build/win/syzygy/instrument.py" |
| |
| filter = "//build/win/syzygy/syzyasan-instrumentation-filter.txt" |
| |
| binary_name = invoker.binary_name |
| dest_dir = invoker.dest_dir |
| input_image = "$root_out_dir/$binary_name" |
| input_pdb = "$root_out_dir/$binary_name.pdb" |
| |
| inputs = [ |
| filter, |
| input_image, |
| |
| #input_pdb, |
| ] |
| |
| output_filter = "$dest_dir/win-syzyasan-filter-$binary_name.txt.json" |
| |
| outputs = [ |
| "$dest_dir/$binary_name", |
| "$dest_dir/$binary_name.pdb", |
| output_filter, |
| ] |
| |
| args = [ |
| "--mode", |
| "asan", |
| "--input_executable", |
| rebase_path(input_image, root_build_dir), |
| "--input_symbol", |
| rebase_path(input_pdb, root_build_dir), |
| "--filter", |
| rebase_path(filter, root_build_dir), |
| "--output-filter-file", |
| rebase_path(output_filter, root_build_dir), |
| "--destination_dir", |
| rebase_path(dest_dir, root_build_dir), |
| ] |
| |
| deps = [ |
| "//build/win/syzygy:copy_syzyasan_binaries", |
| ] |
| if (defined(invoker.deps)) { |
| deps += invoker.deps |
| } |
| forward_variables_from(invoker, |
| [ |
| "data_deps", |
| "public_deps", |
| "testonly", |
| ]) |
| } |
| } |