1# Copyright (c) 2022-2024 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 16backtrace_local_sources = [ 17 "backtrace_local.cpp", 18 "backtrace_local_mix.cpp", 19 "backtrace_local_thread.cpp", 20 "dfx_kernel_stack.cpp", 21 "fp_backtrace.cpp", 22 "memory_reader.cpp", 23] 24 25if (defined(ohos_lite)) { 26 shared_library("libbacktrace_local") { 27 visibility = [ "*:*" ] 28 29 include_dirs = [ 30 "include", 31 "$c_utils_include_path", 32 "$faultloggerd_common_path/dfxlog", 33 "$faultloggerd_common_path/dfxutil", 34 "$faultloggerd_interfaces_path/common", 35 "$faultloggerd_interfaces_path/innerkits/procinfo/include", 36 "$faultloggerd_interfaces_path/innerkits/unwinder/include", 37 ] 38 39 sources = backtrace_local_sources 40 41 defines = [ "is_ohos_lite" ] 42 43 deps = [ 44 "$faultloggerd_common_path/dfxlog:dfx_hilog", 45 "$faultloggerd_common_path/dfxutil:dfx_util", 46 "$faultloggerd_interfaces_path/innerkits/procinfo:libdfx_procinfo", 47 "$faultloggerd_interfaces_path/innerkits/unwinder:libunwinder", 48 ] 49 50 external_deps = [ 51 "bounds_checking_function:libsec_shared", 52 "hilog_lite:hilog_shared", 53 ] 54 } 55 56 static_library("backtrace_local") { 57 # current static library is unuseful in ohos_lite type 58 } 59} else { 60 config("dfx_backtrace_config") { 61 visibility = [ "*:*" ] 62 63 include_dirs = [ 64 "include", 65 "$faultloggerd_common_path/dfxutil", 66 "$faultloggerd_interfaces_path/common", 67 "$faultloggerd_interfaces_path/innerkits/procinfo/include", 68 "$faultloggerd_interfaces_path/innerkits/unwinder/include", 69 ] 70 71 defines = [ "is_ohos=${is_ohos}" ] 72 } 73 74 ohos_shared_library("libbacktrace_local") { 75 branch_protector_ret = "pac_ret" 76 public_configs = [ 77 ":dfx_backtrace_config", 78 "$faultloggerd_common_path/build:coverage_flags", 79 ] 80 81 sources = backtrace_local_sources 82 83 deps = [ 84 "$faultloggerd_common_path/dfxlog:dfx_hilog", 85 "$faultloggerd_common_path/dfxutil:dfx_util", 86 "$faultloggerd_interfaces_path/innerkits/procinfo:libdfx_procinfo", 87 "$faultloggerd_interfaces_path/innerkits/unwinder:libunwinder", 88 ] 89 include_dirs = [ "$faultloggerd_common_path/dfxlog" ] 90 version_script = "libbacktrace_local.map" 91 external_deps = [ 92 "bounds_checking_function:libsec_shared", 93 "c_utils:utils", 94 "hilog:libhilog", 95 ] 96 97 install_images = [ 98 "system", 99 "updater", 100 ] 101 102 output_extension = "so" 103 innerapi_tags = [ 104 "chipsetsdk_sp", 105 "platformsdk_indirect", 106 ] 107 part_name = "faultloggerd" 108 subsystem_name = "hiviewdfx" 109 } 110 111 ohos_static_library("backtrace_local") { 112 public_configs = [ ":dfx_backtrace_config" ] 113 defines = [ "DFX_LOG_HILOG_BASE" ] 114 115 sources = backtrace_local_sources 116 include_dirs = [ 117 "$faultloggerd_common_path/dfxlog", 118 "$faultloggerd_common_path/dfxutil", 119 ] 120 121 deps = [ 122 "$faultloggerd_common_path/dfxlog:dfx_hilog_base_static", 123 "$faultloggerd_interfaces_path/innerkits/procinfo:dfx_procinfo_static", 124 "$faultloggerd_interfaces_path/innerkits/unwinder:libunwinder_base", 125 ] 126 127 external_deps = [ 128 "bounds_checking_function:libsec_static", 129 "c_utils:utilsbase", 130 "hilog:libhilog_base", 131 ] 132 133 part_name = "faultloggerd" 134 subsystem_name = "hiviewdfx" 135 } 136} 137