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