1# Copyright (c) 2021 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  executable("crasher_cpp") {
18    cflags = [
19      "-funwind-tables",
20      "-Wno-frame-larger-than",
21    ]
22    defines = [ "is_ohos_lite" ]
23    visibility = [ "*:*" ]
24    include_dirs = [
25      ".",
26      "$faultloggerd_interfaces_path/common",
27      "$faultloggerd_interfaces_path/innerkits/async_stack/include",
28      "$hilog_lite_include_path",
29    ]
30    sources = [ "dfx_crasher.cpp" ]
31    deps = [
32      "$faultloggerd_interfaces_path/innerkits/async_stack:libasync_stack",
33      "$hilog_lite_deps_path",
34    ]
35
36    external_deps = [ "bounds_checking_function:libsec_shared" ]
37  }
38} else {
39  config("crasher_config") {
40    visibility = [ ":*" ]
41
42    include_dirs = [
43      ".",
44      "$faultloggerd_interfaces_path/common",
45    ]
46
47    cflags = [
48      "-DHAS_HITRACE",
49      "-DHAS_CRASH_EXAMPLES",
50      "-Wno-frame-larger-than",
51      "-Wno-frame-address",
52    ]
53    cflags_c = [ "-Wno-frame-larger-than" ]
54    cflags_cc = [
55      "-Wno-frame-larger-than",
56      "-o0",
57    ]
58    ldflags = [ "-Wno-frame-larger-than" ]
59  }
60
61  ohos_executable("crasher_cpp") {
62    configs = [
63      ":crasher_config",
64      "$faultloggerd_path/common/build:coverage_flags",
65    ]
66
67    sources = [ "dfx_crasher.cpp" ]
68    sources += [
69      "faults/ipc_issues.cpp",
70      "faults/multi_thread_container_access.cpp",
71      "faults/nullpointer_dereference.cpp",
72      "faults/parcel_sample.cpp",
73      "faults/remote_object_interface_proxy.cpp",
74      "faults/remote_object_interface_stub.cpp",
75    ]
76
77    branch_protector_ret = "pac_ret"
78
79    deps =
80        [ "$faultloggerd_interfaces_path/innerkits/async_stack:libasync_stack" ]
81
82    external_deps = [
83      "c_utils:utils",
84      "ffrt:libffrt",
85      "hilog:libhilog",
86      "hitrace:libhitracechain",
87      "ipc:ipc_single",
88      "libuv:uv",
89    ]
90
91    part_name = "faultloggerd"
92    subsystem_name = "hiviewdfx"
93  }
94}
95