1# Copyright (c) 2021 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 16if (defined(ohos_lite)) { 17 source_set("process_info_src") { 18 cflags = [] 19 20 defines = [ 21 "HAVE_CONFIG_H", 22 "HAVE_ELF_H", 23 "HAVE_LINK_H", 24 ] 25 26 visibility = [ "*:*" ] 27 28 include_dirs = [ 29 ".", 30 "$faultloggerd_path/common", 31 "$faultloggerd_path/common/dfxlog", 32 "//commonlibrary/c_utils/base/include", 33 "$faultloggerd_path/interfaces/innerkits/faultloggerd_client/include", 34 "$hilog_lite_include_path", 35 ] 36 37 sources = [ 38 "dfx_config.cpp", 39 "dfx_dump_request.cpp", 40 "dfx_dump_res.cpp", 41 "dfx_dump_writer.cpp", 42 "dfx_elf.cpp", 43 "dfx_fault_stack.cpp", 44 "dfx_frame.cpp", 45 "dfx_logger.cpp", 46 "dfx_maps.cpp", 47 "dfx_process.cpp", 48 "dfx_ring_buffer_wrapper.cpp", 49 "dfx_signal.cpp", 50 "dfx_symbols_cache.cpp", 51 "dfx_thread.cpp", 52 "dfx_unwind_local.cpp", 53 "dfx_unwind_remote.cpp", 54 "dfx_util.cpp", 55 "process_dumper.cpp", 56 ] 57 58 if (target_cpu == "arm") { 59 sources += [ "dfx_regs_arm.cpp" ] 60 #cflags += [ "-D__arm__" ] 61 } else if (target_cpu == "arm64") { 62 sources += [ "dfx_regs_arm64.cpp" ] 63 cflags += [ "-D__aarch64__" ] 64 } else if (target_cpu == "x86_64") { 65 sources += [ "dfx_regs_x86_64.cpp" ] 66 cflags += [ "-D__x86_64__" ] 67 } 68 69 deps = [ 70 "$faultloggerd_path/common/dfxlog:static_common_log", 71 "$faultloggerd_path/interfaces/innerkits/faultloggerd_client:libfaultloggerd", 72 "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", 73 "//third_party/libunwind:libunwind", 74 ] 75 } 76 77 executable("processdump") { 78 visibility = [ "*:*" ] 79 80 include_dirs = [ 81 ".", 82 "$faultloggerd_path/common", 83 "$faultloggerd_path/common/dfxlog", 84 "$faultloggerd_path/utils", 85 "//commonlibrary/c_utils/base/include", 86 "$faultloggerd_path/interfaces/innerkits/faultloggerd_client/include", 87 "$hilog_lite_include_path", 88 ] 89 90 defines = [ 91 "HAVE_CONFIG_H", 92 "HAVE_ELF_H", 93 "HAVE_LINK_H", 94 ] 95 96 sources = [ 97 "//base/hiviewdfx/faultloggerd/utils/directory_ex.cpp", 98 "cppcrash_reporter.cpp", 99 "dfx_config.cpp", 100 "dfx_dump_request.cpp", 101 "dfx_dump_res.cpp", 102 "dfx_dump_writer.cpp", 103 "dfx_elf.cpp", 104 "dfx_fault_stack.cpp", 105 "dfx_frame.cpp", 106 "dfx_logger.cpp", 107 "dfx_maps.cpp", 108 "dfx_process.cpp", 109 "dfx_ring_buffer_wrapper.cpp", 110 "dfx_signal.cpp", 111 "dfx_symbols_cache.cpp", 112 "dfx_thread.cpp", 113 "dfx_unwind_local.cpp", 114 "dfx_unwind_remote.cpp", 115 "dfx_util.cpp", 116 "main.cpp", 117 "process_dumper.cpp", 118 ] 119 120 if (target_cpu == "arm") { 121 sources += [ "dfx_regs_arm.cpp" ] 122 cflags = [ "-D__arm__" ] 123 } else if (target_cpu == "arm64") { 124 sources += [ "dfx_regs_arm64.cpp" ] 125 cflags = [ "-D__aarch64__" ] 126 } else if (target_cpu == "x86_64") { 127 sources += [ "dfx_regs_x86_64.cpp" ] 128 cflags = [ "-D__x86_64__" ] 129 } 130 131 deps = [ 132 "$faultloggerd_path/common/dfxlog:static_common_log", 133 "$faultloggerd_path/interfaces/innerkits/faultloggerd_client:libfaultloggerd", 134 "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", 135 "//third_party/libunwind:libunwind", 136 ] 137 } 138} else { 139 config("processdump_config") { 140 visibility = [ ":*" ] 141 142 include_dirs = [ 143 ".", 144 "//base/hiviewdfx/faultloggerd/common", 145 "//base/hiviewdfx/faultloggerd/common/dfxlog", 146 "//commonlibrary/c_utils/base/include", 147 ] 148 } 149 150 ohos_source_set("process_info_src") { 151 cflags = [] 152 153 configs = [ ":processdump_config" ] 154 sources = [ 155 "dfx_config.cpp", 156 "dfx_dump_request.cpp", 157 "dfx_dump_res.cpp", 158 "dfx_dump_writer.cpp", 159 "dfx_elf.cpp", 160 "dfx_fault_stack.cpp", 161 "dfx_frame.cpp", 162 "dfx_logger.cpp", 163 "dfx_maps.cpp", 164 "dfx_process.cpp", 165 "dfx_ring_buffer_wrapper.cpp", 166 "dfx_signal.cpp", 167 "dfx_symbols_cache.cpp", 168 "dfx_thread.cpp", 169 "dfx_unwind_local.cpp", 170 "dfx_unwind_remote.cpp", 171 "dfx_util.cpp", 172 "process_dumper.cpp", 173 ] 174 175 if (target_cpu == "arm") { 176 sources += [ "dfx_regs_arm.cpp" ] 177 #cflags += [ "-D__arm__" ] 178 } else if (target_cpu == "arm64") { 179 sources += [ "dfx_regs_arm64.cpp" ] 180 cflags += [ "-D__aarch64__" ] 181 } else if (target_cpu == "x86_64") { 182 sources += [ "dfx_regs_x86_64.cpp" ] 183 cflags += [ "-D__x86_64__" ] 184 } 185 186 deps = [ 187 "$faultloggerd_path/common/dfxlog:static_common_log", 188 "$faultloggerd_path/interfaces/innerkits/faultloggerd_client:libfaultloggerd", 189 "//third_party/libunwind:libunwind", 190 ] 191 192 external_deps = [ 193 "c_utils:utils", 194 "hilog_native:libhilog", 195 ] 196 197 part_name = "faultloggerd" 198 subsystem_name = "hiviewdfx" 199 } 200 201 ohos_executable("processdump") { 202 install_enable = true 203 configs = [ ":processdump_config" ] 204 sources = [ 205 "cppcrash_reporter.cpp", 206 "dfx_config.cpp", 207 "dfx_dump_request.cpp", 208 "dfx_dump_res.cpp", 209 "dfx_dump_writer.cpp", 210 "dfx_elf.cpp", 211 "dfx_fault_stack.cpp", 212 "dfx_frame.cpp", 213 "dfx_logger.cpp", 214 "dfx_maps.cpp", 215 "dfx_process.cpp", 216 "dfx_ring_buffer_wrapper.cpp", 217 "dfx_signal.cpp", 218 "dfx_symbols_cache.cpp", 219 "dfx_thread.cpp", 220 "dfx_unwind_local.cpp", 221 "dfx_unwind_remote.cpp", 222 "dfx_util.cpp", 223 "main.cpp", 224 "process_dumper.cpp", 225 ] 226 227 if (target_cpu == "arm") { 228 sources += [ "dfx_regs_arm.cpp" ] 229 cflags = [ "-D__arm__" ] 230 } else if (target_cpu == "arm64") { 231 sources += [ "dfx_regs_arm64.cpp" ] 232 cflags = [ "-D__aarch64__" ] 233 } else if (target_cpu == "x86_64") { 234 sources += [ "dfx_regs_x86_64.cpp" ] 235 cflags = [ "-D__x86_64__" ] 236 } 237 238 cflags_cc = [ "-DDEBUG_CRASH_LOCAL_HANDLER" ] 239 240 deps = [ 241 "$faultloggerd_path/common/dfxlog:static_common_log", 242 "$faultloggerd_path/common/util:dfx_cutil", 243 "$faultloggerd_path/interfaces/innerkits/faultloggerd_client:libfaultloggerd", 244 "$faultloggerd_path/interfaces/innerkits/signal_handler:dfx_local_handler", 245 "//third_party/libunwind:libunwind", 246 ] 247 248 external_deps = [ 249 "c_utils:utils", 250 "hilog_native:libhilog", 251 ] 252 253 install_images = [ 254 "system", 255 "updater", 256 ] 257 258 part_name = "faultloggerd" 259 subsystem_name = "hiviewdfx" 260 } 261} 262