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