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