1# Copyright (c) 2023 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 16dfx_unwinder_sources = [ 17 "arch_util.cpp", 18 "dfx_config.cpp", 19 "dfx_elf.cpp", 20 "dfx_frame_format.cpp", 21 "dfx_maps.cpp", 22 "dfx_memory.cpp", 23 "dfx_memory_file.cpp", 24 "dfx_regs.cpp", 25 "dfx_regs_arm.cpp", 26 "dfx_regs_arm64.cpp", 27 "dfx_regs_riscv64.cpp", 28 "dfx_regs_x86_64.cpp", 29 "dfx_signal.cpp", 30 "dfx_symbols.cpp", 31 "dwarf_unwinder.cpp", 32 "fp_unwinder.cpp", 33] 34 35if (defined(ohos_lite)) { 36 source_set("dfx_unwinder_src") { 37 visibility = [ "*:*" ] 38 39 include_dirs = [ 40 "include", 41 "$c_utils_include_path", 42 "$faultloggerd_interfaces_path/common", 43 "$faultloggerd_path/common/dfxlog", 44 "$faultloggerd_path/common/dfxutil", 45 "//third_party/libunwind/include", 46 "//third_party/libunwind/src", 47 "$hilog_lite_include_path", 48 ] 49 50 sources = dfx_unwinder_sources 51 sources += [ "$c_utils_src_path/directory_ex.cpp" ] 52 53 cflags_cc = [ "-fPIC" ] 54 55 defines = [ 56 "HAVE_CONFIG_H", 57 "HAVE_ELF_H", 58 "HAVE_LINK_H", 59 "is_ohos_lite", 60 ] 61 62 deps = [ 63 "$faultloggerd_path/common/dfxlog:dfx_hilog", 64 "$hilog_lite_deps_path", 65 "//third_party/bounds_checking_function:libsec_shared", 66 "//third_party/libunwind:libunwind", 67 ] 68 } 69} else { 70 config("dfx_unwinder_config") { 71 visibility = [ "*:*" ] 72 73 include_dirs = [ 74 "include", 75 "$faultloggerd_interfaces_path/common", 76 "//third_party/libunwind/include", 77 "//third_party/libunwind/src", 78 ] 79 80 defines = [ 81 "HAVE_CONFIG_H", 82 "HAVE_ELF_H", 83 "HAVE_LINK_H", 84 ] 85 } 86 87 ohos_source_set("dfx_unwinder_src") { 88 public_configs = [ 89 ":dfx_unwinder_config", 90 "$faultloggerd_path/common/build:coverage_flags", 91 "//third_party/jsoncpp:jsoncpp_public_config", 92 ] 93 94 sources = dfx_unwinder_sources 95 96 deps = [ 97 "$faultloggerd_path/common/dfxlog:dfx_hilog", 98 "$faultloggerd_path/common/dfxutil:dfx_util", 99 "//third_party/bounds_checking_function:libsec_shared", 100 "//third_party/jsoncpp:jsoncpp", 101 "//third_party/libunwind:libunwind", 102 ] 103 104 external_deps = [ 105 "c_utils:utils", 106 "hilog:libhilog", 107 ] 108 part_name = "faultloggerd" 109 subsystem_name = "hiviewdfx" 110 } 111 112 ohos_source_set("dfx_unwinder_static_src") { 113 public_configs = [ 114 ":dfx_unwinder_config", 115 "//third_party/jsoncpp:jsoncpp_public_config", 116 ] 117 118 sources = dfx_unwinder_sources 119 120 deps = [ 121 "$faultloggerd_path/common/dfxlog:dfx_hilog_base", 122 "$faultloggerd_path/common/dfxutil:dfx_util_static", 123 "//third_party/bounds_checking_function:libsec_static", 124 "//third_party/jsoncpp:jsoncpp_static", 125 "//third_party/libunwind:libunwind_local", 126 ] 127 128 external_deps = [ 129 "c_utils:utils", 130 "hilog:libhilog_base", 131 ] 132 part_name = "faultloggerd" 133 subsystem_name = "hiviewdfx" 134 } 135} 136