# Copyright (c) 2021-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//base/hiviewdfx/faultloggerd/faultloggerd.gni") faultloggerd_sources = [ "fault_logger_config.cpp", "fault_logger_daemon.cpp", "fault_logger_pipe.cpp", "main.cpp", ] if (defined(ohos_lite)) { copy("faultlogger.cfg") { sources = [ "$faultloggerd_path/services/config/faultloggerd.cfg" ] outputs = [ "$root_out_dir/etc/init/faultloggerd.cfg" ] } copy("faultlogger.conf") { sources = [ "$faultloggerd_path/services/config/faultlogger.conf" ] outputs = [ "$root_out_dir/etc/faultlogger.conf" ] } executable("faultloggerd") { visibility = [ "*:*" ] include_dirs = [ ".", "$c_utils_include_path", "$faultloggerd_interfaces_path/common", "$faultloggerd_path/common/dfxlog", "$faultloggerd_path/common/dfxutil", "$faultloggerd_path/tools/process_dump", "$hilog_lite_include_path", "$faultloggerd_path/interfaces/innerkits/faultloggerd_client/include", "$faultloggerd_path/interfaces/innerkits/faultloggerd_client", ] sources = faultloggerd_sources sources += [ "$c_utils_src_path/directory_ex.cpp" ] cflags = [ "-fstack-protector-strong" ] deps = [ ":faultlogger.conf", "$faultloggerd_common_path/trace:dfx_trace", "$faultloggerd_path/common/dfxlog:dfx_hilog", "$faultloggerd_path/common/dfxutil:dfx_util", "$faultloggerd_path/interfaces/innerkits/faultloggerd_client:libfaultloggerd", ] external_deps = [ "hilog_lite:hilog_shared" ] defines = [ "is_ohos_lite" ] if (faultloggerd_hisysevent_enable) { deps += [ "hisysevent:libhisysevent" ] } else { defines += [ "HISYSEVENT_DISABLE" ] } } } else { config("faultloggerd_config") { visibility = [ ":*" ] include_dirs = [ ".", "$faultloggerd_interfaces_path/common", "$faultloggerd_path/common/dfxlog", "$faultloggerd_path/common/dfxutil", "$faultloggerd_path/tools/process_dump", "$faultloggerd_path/interfaces/innerkits/faultloggerd_client", "$faultloggerd_path/interfaces/innerkits/signal_handler", ] } ohos_prebuilt_etc("faultloggerd.cfg") { if (use_musl) { source = "config/faultloggerd.cfg" } else { source = "config/bionic/faultloggerd.cfg" } relative_install_dir = "init" part_name = "faultloggerd" subsystem_name = "hiviewdfx" } ohos_prebuilt_etc("faultloggerd.para") { source = "config/faultloggerd.para" relative_install_dir = "param" part_name = "faultloggerd" subsystem_name = "hiviewdfx" } ohos_prebuilt_etc("faultloggerd.para.dac") { source = "config/faultloggerd.para.dac" relative_install_dir = "param" part_name = "faultloggerd" subsystem_name = "hiviewdfx" } ohos_prebuilt_etc("faultlogger.conf") { source = "config/faultlogger.conf" part_name = "faultloggerd" subsystem_name = "hiviewdfx" } ohos_executable("faultloggerd") { install_enable = true configs = [ ":faultloggerd_config", "$faultloggerd_path/common/build:coverage_flags", ] sources = faultloggerd_sources cflags = [ "-fstack-protector-strong" ] cflags_cc = [ "-DDEBUG_CRASH_LOCAL_HANDLER" ] defines = [ "DFX_LOG_HILOG_BASE", "DFX_ENABLE_TRACE", ] deps = [ ":faultlogger.conf", ":faultloggerd.para", ":faultloggerd.para.dac", "$faultloggerd_frameworks_path/localhandler:dfx_local_handler_src", "$faultloggerd_path/common/dfxlog:dfx_hilog_base", "$faultloggerd_path/common/dfxutil:dfx_util", "$faultloggerd_path/common/trace:dfx_trace", "$faultloggerd_path/interfaces/innerkits/faultloggerd_client:libfaultloggerd", ] if (!is_asan) { deps += [ ":faultloggerd.cfg" ] } external_deps = [ "bounds_checking_function:libsec_shared", "c_utils:utils", "hilog:libhilog_base", "hisysevent:libhisysevent", "hitrace:hitrace_meter", "init:libbegetutil", ] version_script = "faultloggerd.map" install_images = [ "system", "updater", ] part_name = "faultloggerd" subsystem_name = "hiviewdfx" } ohos_source_set("faultloggerd_fuzzer_src") { configs = [ ":faultloggerd_config" ] defines = [ "FAULTLOGGERD_FUZZER", "DFX_ENABLE_TRACE", ] sources = [ "fault_logger_config.cpp", "fault_logger_daemon.cpp", "fault_logger_pipe.cpp", ] deps = [ "$faultloggerd_common_path/dfxlog:dfx_hilog", "$faultloggerd_common_path/dfxutil:dfx_util", "$faultloggerd_path/common/trace:dfx_trace", "$faultloggerd_path/interfaces/innerkits/faultloggerd_client:libfaultloggerd", ] external_deps = [ "c_utils:utils", "hilog:libhilog_base", "hisysevent:libhisysevent", "hitrace:hitrace_meter", "init:libbegetutil", ] part_name = "faultloggerd" subsystem_name = "hiviewdfx" } }