summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/webrtc/build/win/syzygy/syzygy.gni
blob: 1a45e866f8851c88a0a0a4e5356421936025c3bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# 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",
                           ])
  }
}