• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  public_configs = [ ":interface_include" ]
137  configs = [
138    "${hidumper_utils_path}:utils_config",
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  defines = []
198  if (hidumper_hiviewdfx_hisysevent_enable) {
199    external_deps += [ "hisysevent:libhisysevent" ]
200    defines += [ "HIDUMPER_HIVIEWDFX_HISYSEVENT_ENABLE" ]
201  }
202
203  subsystem_name = "${hidumper_subsystem_name}"
204
205  part_name = "${hidumper_part_name}"
206}
207
208ohos_shared_library("hidumperservice_cpu_source") {
209  if (hidumper_hiviewdfx_hiview_enable) {
210    public_configs = [ ":dump_cpu_config" ]
211    sources = [
212      "native/src/dump_cpu_data.cpp",
213      "native/src/dump_manager_cpu_service.cpp",
214    ]
215
216    configs = [
217      "${hidumper_utils_path}:utils_config",
218      ":interface_include",
219      "${hidumper_frameworks_path}:hidumper_include",
220      "${hidumper_service_path}:service_config",
221      "${hidumper_service_path}:zidl_config",
222    ]
223
224    deps = [ "${hidumper_service_path}:zidl_cpu_service" ]
225
226    external_deps = [
227      "access_token:libaccesstoken_sdk",
228      "access_token:libtokensetproc_shared",
229      "c_utils:utils",
230      "eventhandler:libeventhandler",
231      "hilog:libhilog",
232      "hiview:libucollection_utility",
233      "ipc:ipc_core",
234      "safwk:system_ability_fwk",
235      "samgr:samgr_proxy",
236    ]
237    defines = []
238    if (hidumper_ablility_base_enable) {
239      external_deps += [ "ability_base:want" ]
240      external_deps += [ "ability_runtime:app_manager" ]
241      defines += [ "HIDUMPER_ABILITY_BASE_ENABLE" ]
242    }
243    sanitize = {
244      cfi = true
245      cfi_cross_dso = true
246      cfi_no_nvcall = true
247      cfi_vcall_icall_only = true
248      debug = false
249    }
250
251    version_script = "hidumper.map"
252    subsystem_name = "${hidumper_subsystem_name}"
253
254    part_name = "${hidumper_part_name}"
255  }
256}
257
258ohos_source_set("hidumperservice_cpu_source_test") {
259  sources = [ "native/src/dump_manager_cpu_service.cpp" ]
260
261  configs = [
262    "${hidumper_utils_path}:utils_config",
263    ":interface_include",
264    "${hidumper_frameworks_path}:hidumper_include",
265    "${hidumper_service_path}:service_config",
266    "${hidumper_service_path}:zidl_config",
267  ]
268
269  deps = [ "${hidumper_service_path}:zidl_cpu_service" ]
270
271  external_deps = [
272    "access_token:libaccesstoken_sdk",
273    "access_token:libtokensetproc_shared",
274    "c_utils:utils",
275    "eventhandler:libeventhandler",
276    "hilog:libhilog",
277    "hiview:libucollection_utility",
278    "safwk:system_ability_fwk",
279    "samgr:samgr_proxy",
280  ]
281  defines = []
282  if (hidumper_ablility_base_enable) {
283    external_deps += [ "ability_base:want" ]
284    external_deps += [ "ability_runtime:app_manager" ]
285    defines += [ "HIDUMPER_ABILITY_BASE_ENABLE" ]
286  }
287
288  subsystem_name = "${hidumper_subsystem_name}"
289
290  part_name = "${hidumper_part_name}"
291}
292
293ohos_shared_library("hidumperservice") {
294  deps = [ ":hidumperservice_source" ]
295  external_deps = [ "hilog:libhilog" ]
296  cflags = [ "-fstack-protector-strong" ]
297  install_enable = true
298  version_script = "hidumper.map"
299  shlib_type = "sa"
300  subsystem_name = "${hidumper_subsystem_name}"
301  part_name = "${hidumper_part_name}"
302}
303
304ohos_source_set("hidumpermemory_source") {
305  sources = [
306    "${hidumper_frameworks_path}/dump_utils.cpp",
307    "${hidumper_frameworks_path}/src/common/dump_cfg.cpp",
308    "${hidumper_frameworks_path}/src/common/dumper_opts.cpp",
309    "${hidumper_frameworks_path}/src/common/dumper_parameter.cpp",
310    "${hidumper_frameworks_path}/src/common/option_args.cpp",
311    "${hidumper_frameworks_path}/src/executor/memory/dma_info.cpp",
312    "${hidumper_frameworks_path}/src/executor/memory/get_cma_info.cpp",
313    "${hidumper_frameworks_path}/src/executor/memory/get_hardware_info.cpp",
314    "${hidumper_frameworks_path}/src/executor/memory/get_heap_info.cpp",
315    "${hidumper_frameworks_path}/src/executor/memory/get_kernel_info.cpp",
316    "${hidumper_frameworks_path}/src/executor/memory/get_process_info.cpp",
317    "${hidumper_frameworks_path}/src/executor/memory/get_ram_info.cpp",
318    "${hidumper_frameworks_path}/src/executor/memory/memory_filter.cpp",
319    "${hidumper_frameworks_path}/src/executor/memory/memory_info.cpp",
320    "${hidumper_frameworks_path}/src/executor/memory/memory_info_wrapper.cpp",
321    "${hidumper_frameworks_path}/src/executor/memory/memory_util.cpp",
322    "${hidumper_frameworks_path}/src/executor/memory/parse/parse_meminfo.cpp",
323    "${hidumper_frameworks_path}/src/executor/memory/parse/parse_smaps_info.cpp",
324    "${hidumper_frameworks_path}/src/executor/memory/parse/parse_smaps_rollup_info.cpp",
325    "${hidumper_frameworks_path}/src/executor/memory/parse/parse_vmallocinfo.cpp",
326    "${hidumper_frameworks_path}/src/executor/memory/smaps_memory_info.cpp",
327    "${hidumper_frameworks_path}/src/util/config_data.cpp",
328    "${hidumper_frameworks_path}/src/util/config_utils.cpp",
329    "${hidumper_frameworks_path}/src/util/file_utils.cpp",
330    "${hidumper_frameworks_path}/src/util/string_utils.cpp",
331    "native/src/dump_common_utils.cpp",
332  ]
333
334  configs = [
335    "${hidumper_utils_path}:utils_config",
336    ":interface_include",
337    "${hidumper_frameworks_path}:hidumper_include",
338    "${hidumper_service_path}:service_config",
339  ]
340  deps = [ "${hidumper_utils_path}:utils" ]
341  external_deps = [
342    "c_utils:utils",
343    "drivers_interface_memorytracker:libmemorytracker_proxy_1.0",
344    "eventhandler:libeventhandler",
345    "hdf_core:libhdf_utils",
346    "hilog:libhilog",
347    "hiview:libucollection_utility",
348    "init:libbegetutil",
349    "ipc:ipc_core",
350    "safwk:system_ability_fwk",
351    "samgr:samgr_proxy",
352  ]
353  defines = []
354
355  if (hidumper_ability_runtime_enable) {
356    external_deps += [ "ability_runtime:app_manager" ]
357    defines += [ "HIDUMPER_ABILITY_RUNTIME_ENABLE" ]
358  }
359
360  if (hidumper_report_memmgr) {
361    external_deps += [ "memmgr:memmgrclient" ]
362    defines += [ "HIDUMPER_MEMMGR_ENABLE" ]
363  }
364
365  subsystem_name = "${hidumper_subsystem_name}"
366  part_name = "${hidumper_part_name}"
367}
368
369ohos_shared_library("hidumpermemory") {
370  deps = [ ":hidumpermemory_source" ]
371  external_deps = [ "hilog:libhilog" ]
372  install_enable = true
373  version_script = "hidumper.map"
374  subsystem_name = "${hidumper_subsystem_name}"
375  part_name = "${hidumper_part_name}"
376}
377
378if (hidumper_hiviewdfx_hiview_enable) {
379  ohos_shared_library("hidumpercpuservice") {
380    deps = [ ":hidumperservice_cpu_source" ]
381    external_deps = [ "hilog:libhilog" ]
382    install_enable = true
383    version_script = "hidumper.map"
384    shlib_type = "sa"
385    subsystem_name = "${hidumper_subsystem_name}"
386    part_name = "${hidumper_part_name}"
387  }
388}
389
390############################################################################
391
392ohos_prebuilt_etc("hidumper_service.rc") {
393  source = "native/etc/hidumper_service.cfg"
394
395  relative_install_dir = "init"
396
397  subsystem_name = "${hidumper_subsystem_name}"
398
399  part_name = "${hidumper_part_name}"
400}
401
402ohos_prebuilt_etc("infos_config") {
403  source = "native/etc/infos_config.json"
404
405  relative_install_dir = "hidumper"
406
407  subsystem_name = "${hidumper_subsystem_name}"
408
409  part_name = "${hidumper_part_name}"
410}
411