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("//build/config/components/idl_tool/idl.gni") 15import("../hidumper.gni") 16 17config("interface_include") { 18 include_dirs = [ 19 "${target_gen_dir}", 20 "${hidumper_interface}/innerkits/include", 21 "${hidumper_interface}/native/innerkits/include/", 22 ] 23} 24 25config("service_config") { 26 include_dirs = [ "native/include" ] 27} 28 29config("zidl_config") { 30 include_dirs = [ "zidl/include" ] 31} 32 33config("zidl_cpu_config") { 34 include_dirs = [ 35 "zidl/include", 36 "${hidumper_frameworks_path}/include", 37 ] 38} 39 40config("dump_cpu_config") { 41 visibility = [ "*:*" ] 42 43 include_dirs = [ 44 "${target_gen_dir}", 45 "native/include", 46 "${hidumper_frameworks_path}/include", 47 "${hidumper_interface}/innerkits/include", 48 "zidl/include", 49 "${hidumper_utils_path}/native/include", 50 "${hidumper_frameworks_path}", 51 ] 52} 53 54config("hidumpercpuservice_gen_config") { 55 include_dirs = [ "${target_gen_dir}" ] 56} 57 58idl_gen_interface("hidumpercpuservice_interface") { 59 sources = [ "IHidumperCpuService.idl" ] 60 log_domainid = "0xD002D20" 61 log_tag = "DumperService" 62 subsystem_name = "${hidumper_subsystem_name}" 63 part_name = "${hidumper_part_name}" 64} 65 66ohos_source_set("zidl_client") { 67 sources = [ "zidl/src/dump_broker_proxy.cpp" ] 68 output_values = get_target_outputs(":hidumpercpuservice_interface") 69 sources += filter_include(output_values, [ "*service_proxy.cpp" ]) 70 71 configs = [ 72 "${hidumper_utils_path}:utils_config", 73 ":interface_include", 74 "${hidumper_service_path}:zidl_cpu_config", 75 ] 76 77 deps = [ 78 ":hidumpercpuservice_interface", 79 "${hidumper_utils_path}:utils", 80 ] 81 82 external_deps = [ 83 "c_utils:utils", 84 "hilog:libhilog", 85 "ipc:ipc_core", 86 "safwk:system_ability_fwk", 87 "samgr:samgr_proxy", 88 ] 89 90 subsystem_name = "${hidumper_subsystem_name}" 91 92 part_name = "${hidumper_part_name}" 93} 94 95ohos_source_set("zidl_service") { 96 sources = [ "zidl/src/dump_broker_stub.cpp" ] 97 98 configs = [ 99 "${hidumper_utils_path}:utils_config", 100 ":interface_include", 101 "${hidumper_service_path}:zidl_config", 102 ] 103 104 deps = [ "${hidumper_utils_path}:utils" ] 105 106 external_deps = [ 107 "c_utils:utils", 108 "hilog:libhilog", 109 "ipc:ipc_core", 110 "safwk:system_ability_fwk", 111 "samgr:samgr_proxy", 112 ] 113 114 subsystem_name = "${hidumper_subsystem_name}" 115 116 part_name = "${hidumper_part_name}" 117} 118 119ohos_source_set("zidl_cpu_service") { 120 output_values = get_target_outputs(":hidumpercpuservice_interface") 121 sources = filter_include(output_values, [ "*service_stub.cpp" ]) 122 123 configs = [ 124 "${hidumper_utils_path}:utils_config", 125 ":interface_include", 126 ":service_config", 127 "${hidumper_service_path}:zidl_cpu_config", 128 ] 129 130 deps = [ 131 ":hidumpercpuservice_interface", 132 "${hidumper_utils_path}:utils", 133 ] 134 135 external_deps = [ 136 "c_utils:utils", 137 "hilog:libhilog", 138 "ipc:ipc_core", 139 "safwk:system_ability_fwk", 140 "samgr:samgr_proxy", 141 ] 142 143 subsystem_name = "${hidumper_subsystem_name}" 144 145 part_name = "${hidumper_part_name}" 146} 147 148ohos_shared_library("hidumper_client") { 149 branch_protector_ret = "pac_ret" 150 sources = [ 151 "native/src/dump_cpu_data.cpp", 152 "native/src/dump_manager_client.cpp", 153 "native/src/dump_manager_cpu_client.cpp", 154 "native/src/dump_on_demand_load.cpp", 155 ] 156 157 public_configs = [ ":interface_include" ] 158 configs = [ 159 "${hidumper_utils_path}:utils_config", 160 "${hidumper_frameworks_path}:hidumper_include", 161 "${hidumper_service_path}:service_config", 162 "${hidumper_service_path}:zidl_config", 163 ] 164 165 deps = [ 166 "${hidumper_service_path}:zidl_client", 167 "${hidumper_utils_path}:utils", 168 ] 169 170 external_deps = [ 171 "c_utils:utils", 172 "hilog:libhilog", 173 "ipc:ipc_core", 174 "samgr:samgr_proxy", 175 ] 176 version_script = "hidumper.map" 177 subsystem_name = "${hidumper_subsystem_name}" 178 179 part_name = "${hidumper_part_name}" 180} 181 182ohos_source_set("hidumperservice_source") { 183 sources = [ 184 "native/src/dump_common_utils.cpp", 185 "native/src/dump_cpu_data.cpp", 186 "native/src/dump_log_manager.cpp", 187 "native/src/dump_manager_cpu_client.cpp", 188 "native/src/dump_manager_service.cpp", 189 "native/src/dump_on_demand_load.cpp", 190 "native/src/raw_param.cpp", 191 ] 192 output_values = get_target_outputs(":hidumpercpuservice_interface") 193 sources += filter_include(output_values, [ "*service_proxy.cpp" ]) 194 195 configs = [ 196 "${hidumper_utils_path}:utils_config", 197 ":interface_include", 198 "${hidumper_frameworks_path}:hidumper_include", 199 "${hidumper_service_path}:service_config", 200 "${hidumper_service_path}:zidl_config", 201 ] 202 203 deps = [ 204 ":hidumpercpuservice_interface", 205 "${hidumper_frameworks_path}:dump_main", 206 "${hidumper_service_path}:zidl_service", 207 "${hidumper_utils_path}:utils", 208 ] 209 210 external_deps = [ 211 "access_token:libaccesstoken_sdk", 212 "access_token:libtokensetproc_shared", 213 "c_utils:utils", 214 "eventhandler:libeventhandler", 215 "hilog:libhilog", 216 "ipc:ipc_core", 217 "safwk:system_ability_fwk", 218 "samgr:samgr_proxy", 219 ] 220 defines = [] 221 if (hidumper_hiviewdfx_hisysevent_enable) { 222 external_deps += [ "hisysevent:libhisysevent" ] 223 defines += [ "HIDUMPER_HIVIEWDFX_HISYSEVENT_ENABLE" ] 224 } 225 226 subsystem_name = "${hidumper_subsystem_name}" 227 228 part_name = "${hidumper_part_name}" 229} 230 231ohos_shared_library("hidumperservice_cpu_source") { 232 if (hidumper_hiviewdfx_hiview_enable) { 233 public_configs = [ ":dump_cpu_config" ] 234 sources = [ 235 "native/src/dump_cpu_data.cpp", 236 "native/src/dump_manager_cpu_service.cpp", 237 ] 238 239 configs = [ 240 "${hidumper_utils_path}:utils_config", 241 ":interface_include", 242 "${hidumper_frameworks_path}:hidumper_include", 243 "${hidumper_service_path}:service_config", 244 "${hidumper_service_path}:zidl_config", 245 ] 246 247 deps = [ 248 ":hidumpercpuservice_interface", 249 "${hidumper_service_path}:zidl_cpu_service", 250 ] 251 252 external_deps = [ 253 "access_token:libaccesstoken_sdk", 254 "access_token:libtokensetproc_shared", 255 "c_utils:utils", 256 "eventhandler:libeventhandler", 257 "hilog:libhilog", 258 "hiview:libucollection_utility", 259 "ipc:ipc_core", 260 "safwk:system_ability_fwk", 261 "samgr:samgr_proxy", 262 ] 263 defines = [] 264 if (hidumper_ablility_base_enable) { 265 external_deps += [ "ability_base:want" ] 266 external_deps += [ "ability_runtime:app_manager" ] 267 defines += [ "HIDUMPER_ABILITY_BASE_ENABLE" ] 268 } 269 sanitize = { 270 cfi = true 271 cfi_cross_dso = true 272 cfi_no_nvcall = true 273 cfi_vcall_icall_only = true 274 debug = false 275 } 276 277 version_script = "hidumper.map" 278 subsystem_name = "${hidumper_subsystem_name}" 279 280 part_name = "${hidumper_part_name}" 281 } 282} 283 284ohos_source_set("hidumperservice_cpu_source_test") { 285 sources = [ "native/src/dump_manager_cpu_service.cpp" ] 286 287 configs = [ 288 "${hidumper_utils_path}:utils_config", 289 ":interface_include", 290 "${hidumper_frameworks_path}:hidumper_include", 291 "${hidumper_service_path}:service_config", 292 "${hidumper_service_path}:zidl_config", 293 ] 294 295 deps = [ 296 ":hidumpercpuservice_interface", 297 "${hidumper_service_path}:zidl_cpu_service", 298 ] 299 300 external_deps = [ 301 "access_token:libaccesstoken_sdk", 302 "access_token:libtokensetproc_shared", 303 "c_utils:utils", 304 "eventhandler:libeventhandler", 305 "hilog:libhilog", 306 "hiview:libucollection_utility", 307 "safwk:system_ability_fwk", 308 "samgr:samgr_proxy", 309 ] 310 defines = [] 311 if (hidumper_ablility_base_enable) { 312 external_deps += [ "ability_base:want" ] 313 external_deps += [ "ability_runtime:app_manager" ] 314 defines += [ "HIDUMPER_ABILITY_BASE_ENABLE" ] 315 } 316 317 subsystem_name = "${hidumper_subsystem_name}" 318 319 part_name = "${hidumper_part_name}" 320} 321 322ohos_shared_library("hidumperservice") { 323 deps = [ ":hidumperservice_source" ] 324 external_deps = [ "hilog:libhilog" ] 325 cflags = [ "-fstack-protector-strong" ] 326 install_enable = true 327 version_script = "hidumper.map" 328 shlib_type = "sa" 329 subsystem_name = "${hidumper_subsystem_name}" 330 part_name = "${hidumper_part_name}" 331} 332 333ohos_source_set("hidumpermemory_source") { 334 sources = [ 335 "${hidumper_frameworks_path}/dump_utils.cpp", 336 "${hidumper_frameworks_path}/src/common/dump_cfg.cpp", 337 "${hidumper_frameworks_path}/src/common/dumper_opts.cpp", 338 "${hidumper_frameworks_path}/src/common/dumper_parameter.cpp", 339 "${hidumper_frameworks_path}/src/common/option_args.cpp", 340 "${hidumper_frameworks_path}/src/executor/memory/dma_info.cpp", 341 "${hidumper_frameworks_path}/src/executor/memory/get_cma_info.cpp", 342 "${hidumper_frameworks_path}/src/executor/memory/get_hardware_info.cpp", 343 "${hidumper_frameworks_path}/src/executor/memory/get_heap_info.cpp", 344 "${hidumper_frameworks_path}/src/executor/memory/get_kernel_info.cpp", 345 "${hidumper_frameworks_path}/src/executor/memory/get_process_info.cpp", 346 "${hidumper_frameworks_path}/src/executor/memory/get_ram_info.cpp", 347 "${hidumper_frameworks_path}/src/executor/memory/memory_filter.cpp", 348 "${hidumper_frameworks_path}/src/executor/memory/memory_info.cpp", 349 "${hidumper_frameworks_path}/src/executor/memory/memory_info_wrapper.cpp", 350 "${hidumper_frameworks_path}/src/executor/memory/memory_util.cpp", 351 "${hidumper_frameworks_path}/src/executor/memory/parse/parse_ashmem_info.cpp", 352 "${hidumper_frameworks_path}/src/executor/memory/parse/parse_dmabuf_info.cpp", 353 "${hidumper_frameworks_path}/src/executor/memory/parse/parse_meminfo.cpp", 354 "${hidumper_frameworks_path}/src/executor/memory/parse/parse_smaps_info.cpp", 355 "${hidumper_frameworks_path}/src/executor/memory/parse/parse_smaps_rollup_info.cpp", 356 "${hidumper_frameworks_path}/src/executor/memory/parse/parse_vmallocinfo.cpp", 357 "${hidumper_frameworks_path}/src/executor/memory/smaps_memory_info.cpp", 358 "${hidumper_frameworks_path}/src/util/config_data.cpp", 359 "${hidumper_frameworks_path}/src/util/config_utils.cpp", 360 "${hidumper_frameworks_path}/src/util/file_utils.cpp", 361 "${hidumper_frameworks_path}/src/util/string_utils.cpp", 362 "native/src/dump_common_utils.cpp", 363 ] 364 365 configs = [ 366 "${hidumper_utils_path}:utils_config", 367 ":interface_include", 368 "${hidumper_frameworks_path}:hidumper_include", 369 "${hidumper_service_path}:service_config", 370 ] 371 deps = [ "${hidumper_utils_path}:utils" ] 372 external_deps = [ 373 "c_utils:utils", 374 "drivers_interface_memorytracker:libmemorytracker_proxy_1.0", 375 "eventhandler:libeventhandler", 376 "hdf_core:libhdf_utils", 377 "hilog:libhilog", 378 "hiview:libucollection_utility", 379 "init:libbegetutil", 380 "ipc:ipc_core", 381 "safwk:system_ability_fwk", 382 "samgr:samgr_proxy", 383 ] 384 defines = [] 385 386 if (hidumper_ability_runtime_enable) { 387 external_deps += [ "ability_runtime:app_manager" ] 388 defines += [ "HIDUMPER_ABILITY_RUNTIME_ENABLE" ] 389 } 390 391 if (hidumper_report_memmgr) { 392 external_deps += [ "memmgr:memmgrclient" ] 393 defines += [ "HIDUMPER_MEMMGR_ENABLE" ] 394 } 395 396 subsystem_name = "${hidumper_subsystem_name}" 397 part_name = "${hidumper_part_name}" 398} 399 400ohos_shared_library("hidumpermemory") { 401 deps = [ ":hidumpermemory_source" ] 402 external_deps = [ "hilog:libhilog" ] 403 install_enable = true 404 version_script = "hidumper.map" 405 subsystem_name = "${hidumper_subsystem_name}" 406 part_name = "${hidumper_part_name}" 407} 408 409if (hidumper_hiviewdfx_hiview_enable) { 410 ohos_shared_library("hidumpercpuservice") { 411 deps = [ ":hidumperservice_cpu_source" ] 412 external_deps = [ "hilog:libhilog" ] 413 install_enable = true 414 version_script = "hidumper.map" 415 shlib_type = "sa" 416 subsystem_name = "${hidumper_subsystem_name}" 417 part_name = "${hidumper_part_name}" 418 } 419} 420 421############################################################################ 422 423ohos_prebuilt_etc("hidumper_service.rc") { 424 source = "native/etc/hidumper_service.cfg" 425 426 relative_install_dir = "init" 427 428 subsystem_name = "${hidumper_subsystem_name}" 429 430 part_name = "${hidumper_part_name}" 431} 432 433ohos_prebuilt_etc("infos_config") { 434 source = "native/etc/infos_config.json" 435 436 relative_install_dir = "hidumper" 437 438 subsystem_name = "${hidumper_subsystem_name}" 439 440 part_name = "${hidumper_part_name}" 441} 442