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