• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//base/hiviewdfx/faultloggerd/faultloggerd.gni")
15
16if (!defined(ohos_lite)) {
17  import("//build/config/features.gni")
18  import("//build/test.gni")
19
20  config("dfx_sighook_config") {
21    visibility = [ "*:*" ]
22
23    include_dirs = [
24      ".",
25      "$faultloggerd_path/common",
26    ]
27  }
28
29  ohos_shared_library("dfxsighook") {
30    public_configs = [ ":dfx_sighook_config" ]
31    install_enable = true
32
33    cflags = [
34      "-DDFX_LOG_USE_HILOG_BASE",
35      "-DDFX_LOG_USE_DMESG",
36    ]
37
38    sources = [
39      "dfx_signal_hook.c",
40      "dfx_hook_utils.c"
41    ]
42
43    deps = [
44      "$faultloggerd_path/common/dfxlog:static_hilog_base_dmesg",
45      "//third_party/libunwind:libunwind",
46    ]
47
48    external_deps = [
49      "c_utils:utils",
50      "hilog_native:libhilog_base",
51    ]
52
53    part_name = "faultloggerd"
54    subsystem_name = "hiviewdfx"
55  }
56
57  ohos_shared_library("dfxexithook") {
58    public_configs = [ ":dfx_sighook_config" ]
59    install_enable = true
60
61    cflags = [ "-DDFX_LOG_USE_DMESG" ]
62
63    sources = [
64      "dfx_exit_hook.c",
65      "dfx_hook_utils.c"
66    ]
67
68    deps = [
69      "$faultloggerd_path/common/dfxlog:static_common_log",
70      "//third_party/libunwind:libunwind",
71    ]
72
73    external_deps = [
74      "c_utils:utils",
75      "hilog_native:libhilog",
76    ]
77
78    part_name = "faultloggerd"
79    subsystem_name = "hiviewdfx"
80  }
81
82  ohos_unittest("DfxFuncHookUnitTest") {
83    testonly = true
84    module_out_path = "faultloggerd/dfxfunchook"
85    sources = [ "dfx_func_hook_unittest.cpp" ]
86
87    configs = [ ":dfx_sighook_config" ]
88
89    deps = [
90      ":dfxexithook",
91      ":dfxsighook",
92      "//third_party/googletest:gtest_main",
93    ]
94
95    external_deps = [ "c_utils:utils" ]
96    if (use_musl) {
97      resource_config_file =
98          "//base/hiviewdfx/faultloggerd/test/funchook/ohos_test.xml"
99    } else {
100      resource_config_file =
101          "//base/hiviewdfx/faultloggerd/test/funchook/ohos_bionic_test.xml"
102    }
103
104    part_name = "faultloggerd"
105    subsystem_name = "hiviewdfx"
106  }
107}
108
109group("dfxfunchook_unittest") {
110  if (!defined(ohos_lite)) {
111    testonly = true
112    deps = [ ":DfxFuncHookUnitTest" ]
113  }
114}
115