summaryrefslogtreecommitdiff
path: root/chromium/components/gwp_asan/client/BUILD.gn
blob: 53c07930594cd618e2fe63aa37634fb9df075eb3 (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
# Copyright 2018 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("//base/allocator/allocator.gni")
import("//build/config/allocator.gni")

component("client") {
  output_name = "gwp_asan_client"
  sources = [
    "export.h",
    "guarded_page_allocator.cc",
    "guarded_page_allocator.h",
    "guarded_page_allocator_win.cc",
    "gwp_asan.cc",
    "gwp_asan.h",
    "sampling_helpers.cc",
    "sampling_helpers.h",
    "sampling_state.h",
  ]

  if (is_posix) {
    sources += [ "guarded_page_allocator_posix.cc" ]
  }

  if (use_allocator_shim) {
    sources += [
      "sampling_malloc_shims.cc",
      "sampling_malloc_shims.h",
    ]
  }

  if (use_partition_alloc) {
    sources += [
      "sampling_partitionalloc_shims.cc",
      "sampling_partitionalloc_shims.h",
    ]
  }

  defines = [ "GWP_ASAN_IMPLEMENTATION" ]

  deps = [
    "//base",
    "//base/allocator:buildflags",
    "//components/crash/core/common:crash_key",
    "//components/gwp_asan/common",
  ]

  if (is_android) {
    deps += [ "//components/crash/core/app" ]
  }
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "guarded_page_allocator_unittest.cc",
    "gwp_asan_unittest.cc",
    "sampling_helpers_unittest.cc",
  ]

  if (use_allocator_shim) {
    sources += [ "sampling_malloc_shims_unittest.cc" ]
  }

  if (use_partition_alloc) {
    sources += [ "sampling_partitionalloc_shims_unittest.cc" ]
  }

  deps = [
    ":client",
    "//base/allocator:buildflags",
    "//base/test:test_support",
    "//components/crash/core/common:crash_key",
    "//components/gwp_asan/common",
    "//testing/gmock",
    "//testing/gtest",
  ]
}