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 14if (defined(ohos_lite)) { 15 import("//build/lite/config/component/lite_component.gni") 16} else { 17 import("//build/ohos.gni") 18} 19 20common_source = [ 21 "src/dwarf/Gexpr.c", 22 "src/dwarf/Gfde.c", 23 "src/dwarf/Gfind_proc_info-lsb.c", 24 "src/dwarf/Gfind_unwind_table.c", 25 "src/dwarf/global.c", 26 "src/dwarf/Gparser.c", 27 "src/dwarf/Gpe.c", 28 "src/dwarf/Lexpr.c", 29 "src/dwarf/Lfde.c", 30 "src/dwarf/Lfind_proc_info-lsb.c", 31 "src/dwarf/Lfind_unwind_table.c", 32 "src/dwarf/Lparser.c", 33 "src/dwarf/Lpe.c", 34 "src/mi/backtrace.c", 35 "src/mi/dyn-cancel.c", 36 "src/mi/dyn-info-list.c", 37 "src/mi/dyn-register.c", 38 "src/mi/flush_cache.c", 39 "src/mi/Gdestroy_addr_space.c", 40 "src/mi/Gdyn-extract.c", 41 "src/mi/Gdyn-remote.c", 42 "src/mi/Gfind_dynamic_proc_info.c", 43 "src/mi/Gget_accessors.c", 44 "src/mi/Gget_fpreg.c", 45 "src/mi/Gget_proc_info_by_ip.c", 46 "src/mi/Gget_proc_name.c", 47 "src/mi/Gget_reg.c", 48 "src/mi/Gput_dynamic_unwind_info.c", 49 "src/mi/Gset_cache_size.c", 50 "src/mi/Gset_caching_policy.c", 51 "src/mi/Gset_fpreg.c", 52 "src/mi/Gset_reg.c", 53 "src/mi/init.c", 54 "src/mi/Ldestroy_addr_space.c", 55 "src/mi/Ldyn-extract.c", 56 "src/mi/Lfind_dynamic_proc_info.c", 57 "src/mi/Lget_fpreg.c", 58 "src/mi/Lget_proc_info_by_ip.c", 59 "src/mi/Lget_proc_name.c", 60 "src/mi/Lget_reg.c", 61 "src/mi/Lput_dynamic_unwind_info.c", 62 "src/mi/Lset_cache_size.c", 63 "src/mi/Lset_caching_policy.c", 64 "src/mi/Lset_fpreg.c", 65 "src/mi/Lset_reg.c", 66 "src/mi/mempool.c", 67 "src/mi/strerror.c", 68 "src/os-linux.c", 69 "src/ohos-config.c", 70 "src/ptrace/_UPT_access_fpreg.c", 71 "src/ptrace/_UPT_access_mem.c", 72 "src/ptrace/_UPT_access_reg.c", 73 "src/ptrace/_UPT_accessors.c", 74 "src/ptrace/_UPT_create.c", 75 "src/ptrace/_UPT_destroy.c", 76 "src/ptrace/_UPT_find_proc_info.c", 77 "src/ptrace/_UPT_get_dyn_info_list_addr.c", 78 "src/ptrace/_UPT_get_proc_name.c", 79 "src/ptrace/_UPT_put_unwind_info.c", 80 "src/ptrace/_UPT_reg_offset.c", 81 "src/ptrace/_UPT_resume.c", 82 "src/mi/maps.c", 83] 84 85# as libc++ is static linked with libunwind.a 86# we remove the Gstep.c for duplicated symbol violation 87arm_source = [ 88 "src/arm/Gapply_reg_state.c", 89 "src/arm/Gcreate_addr_space.c", 90 "src/arm/Gex_tables.c", 91 "src/arm/Gget_proc_info.c", 92 "src/arm/Gget_save_loc.c", 93 "src/arm/Gglobal.c", 94 "src/arm/Ginit.c", 95 "src/arm/Ginit_local.c", 96 "src/arm/Ginit_remote.c", 97 "src/arm/Gos-linux.c", 98 "src/arm/Greg_states_iterate.c", 99 "src/arm/Gregs.c", 100 "src/arm/Gresume.c", 101 "src/arm/Gstash_frame.c", 102 "src/arm/Gstep.c", 103 "src/arm/Gtrace.c", 104 "src/arm/Lcreate_addr_space.c", 105 "src/arm/Lex_tables.c", 106 "src/arm/Lget_proc_info.c", 107 "src/arm/Lget_save_loc.c", 108 "src/arm/Lglobal.c", 109 "src/arm/Linit.c", 110 "src/arm/Linit_local.c", 111 "src/arm/Linit_remote.c", 112 "src/arm/Los-linux.c", 113 "src/arm/Lregs.c", 114 "src/arm/Lresume.c", 115 "src/arm/Lstash_frame.c", 116 "src/arm/Lstep.c", 117 "src/arm/Ltrace.c", 118 "src/arm/gen-offsets.c", 119 "src/arm/getcontext.S", 120 "src/arm/is_fpreg.c", 121 "src/arm/regname.c", 122 "src/arm/siglongjmp.S", 123 "src/elf32.c", 124] 125 126arm64_source = [ 127 "src/aarch64/Gcreate_addr_space.c", 128 "src/aarch64/Gget_proc_info.c", 129 "src/aarch64/Gget_save_loc.c", 130 "src/aarch64/Gglobal.c", 131 "src/aarch64/Ginit.c", 132 "src/aarch64/Ginit_local.c", 133 "src/aarch64/Ginit_remote.c", 134 "src/aarch64/Gis_signal_frame.c", 135 "src/aarch64/Gregs.c", 136 "src/aarch64/Gresume.c", 137 "src/aarch64/Gstash_frame.c", 138 "src/aarch64/Gstep.c", 139 "src/aarch64/Gtrace.c", 140 "src/aarch64/Lcreate_addr_space.c", 141 "src/aarch64/Lget_proc_info.c", 142 "src/aarch64/Lget_save_loc.c", 143 "src/aarch64/Lglobal.c", 144 "src/aarch64/Linit.c", 145 "src/aarch64/Linit_local.c", 146 "src/aarch64/Linit_remote.c", 147 "src/aarch64/Lis_signal_frame.c", 148 "src/aarch64/Lregs.c", 149 "src/aarch64/Lresume.c", 150 "src/aarch64/Lstash_frame.c", 151 "src/aarch64/Lstep.c", 152 "src/aarch64/Ltrace.c", 153 "src/aarch64/getcontext.S", 154 "src/aarch64/is_fpreg.c", 155 "src/aarch64/regname.c", 156 "src/elf64.c", 157] 158 159x64_source = [ 160 "src/elf64.c", 161 "src/x86_64/Gcreate_addr_space.c", 162 "src/x86_64/Gget_proc_info.c", 163 "src/x86_64/Gget_save_loc.c", 164 "src/x86_64/Gglobal.c", 165 "src/x86_64/Ginit.c", 166 "src/x86_64/Ginit_local.c", 167 "src/x86_64/Ginit_remote.c", 168 "src/x86_64/Gos-linux.c", 169 "src/x86_64/Gregs.c", 170 "src/x86_64/Gresume.c", 171 "src/x86_64/Gstash_frame.c", 172 "src/x86_64/Gstep.c", 173 "src/x86_64/Gtrace.c", 174 "src/x86_64/Lcreate_addr_space.c", 175 "src/x86_64/Lget_proc_info.c", 176 "src/x86_64/Lget_save_loc.c", 177 "src/x86_64/Lglobal.c", 178 "src/x86_64/Linit.c", 179 "src/x86_64/Linit_local.c", 180 "src/x86_64/Linit_remote.c", 181 "src/x86_64/Los-linux.c", 182 "src/x86_64/Lregs.c", 183 "src/x86_64/Lresume.c", 184 "src/x86_64/Lstash_frame.c", 185 "src/x86_64/Lstep.c", 186 "src/x86_64/Ltrace.c", 187 "src/x86_64/getcontext.S", 188 "src/x86_64/is_fpreg.c", 189 "src/x86_64/regname.c", 190 "src/x86_64/setcontext.S", 191] 192 193remove_sources = [] 194 195ptrace_sources = [ 196 "src/ptrace/_UPT_access_fpreg.c", 197 "src/ptrace/_UPT_access_mem.c", 198 "src/ptrace/_UPT_access_reg.c", 199 "src/ptrace/_UPT_accessors.c", 200 "src/ptrace/_UPT_create.c", 201 "src/ptrace/_UPT_destroy.c", 202 "src/ptrace/_UPT_find_proc_info.c", 203 "src/ptrace/_UPT_get_dyn_info_list_addr.c", 204 "src/ptrace/_UPT_get_proc_name.c", 205 "src/ptrace/_UPT_put_unwind_info.c", 206 "src/ptrace/_UPT_reg_offset.c", 207 "src/ptrace/_UPT_resume.c", 208] 209 210libunwind_la_SOURCES_local_nounwind = [ 211 "src/mi/backtrace.c", 212 "src/mi/dyn-cancel.c", 213 "src/mi/dyn-info-list.c", 214 "src/mi/dyn-register.c", 215 "src/mi/Ldyn-extract.c", 216 "src/mi/Lfind_dynamic_proc_info.c", 217 218 # "src/mi/Lget_accessors.c", # miss 219 "src/mi/Lget_proc_info_by_ip.c", 220 "src/mi/Lget_proc_name.c", 221 "src/mi/Lput_dynamic_unwind_info.c", 222 "src/mi/Ldestroy_addr_space.c", 223 "src/mi/Lget_reg.c", 224 "src/mi/Lset_reg.c", 225 "src/mi/Lget_fpreg.c", 226 "src/mi/Lset_fpreg.c", 227 "src/mi/Lset_caching_policy.c", 228 "src/mi/Lset_cache_size.c", 229] 230 231libunwind_dwarf_local_la_SOURCES = [ 232 "src/dwarf/Lexpr.c", 233 "src/dwarf/Lfde.c", 234 "src/dwarf/Lparser.c", 235 "src/dwarf/Lpe.c", 236 "src/dwarf/Lfind_proc_info-lsb.c", 237 "src/dwarf/Lfind_unwind_table.c", 238] 239 240# remove local file 241remove_sources += libunwind_la_SOURCES_local_nounwind 242remove_sources += libunwind_dwarf_local_la_SOURCES 243remove_sources += ptrace_sources 244 245if (is_mingw) { 246 common_source += [ "src/mingw/pal-single-threaded.c" ] 247} 248 249config("unwind_config_public") { 250 include_dirs = [ 251 "src", 252 "include", 253 ] 254 255 cflags = [ 256 "-D_GNU_SOURCE", 257 "-DHAVE_CONFIG_H", 258 "-DNDEBUG", 259 "-DCC_IS_CLANG", 260 "-fcommon", 261 "-Werror", 262 "-Wno-absolute-value", 263 "-Wno-header-guard", 264 "-Wno-unused-parameter", 265 "-Wno-unused-variable", 266 "-Wno-int-to-pointer-cast", 267 "-Wno-pointer-to-int-cast", 268 ] 269 270 if (defined(ohos_lite)) { 271 cflags += [ "-fPIC" ] 272 } 273 274 if (target_cpu == "arm") { 275 include_dirs += [ "include/tdep-arm" ] 276 cflags += [ 277 "-Wno-inline-asm", 278 "-Wno-shift-count-overflow", 279 "-Wno-tautological-constant-out-of-range-compare", 280 "-Wno-unused-function", 281 ] 282 } else if (target_cpu == "arm64") { 283 include_dirs += [ "include/tdep-aarch64" ] 284 cflags += [ "-Wno-incompatible-pointer-types" ] 285 } else if (target_cpu == "x64" || target_cpu == "x86_64") { 286 include_dirs += [ "include/tdep-x86_64" ] 287 } 288} 289 290config("unwind_config_remote") { 291 cflags = 292 [ "-Wno-format" ] # some debug feature will warning in host x64 build 293} 294 295config("unwind_config_remote_public") { 296 cflags = [] 297 include_dirs = [] 298 defines = [] 299 300 # this is a host tools build 301 # what means host use remote mode to unwind 302 # with dwarf from stack or coredump or something not real target 303 # There is an exception, we can support local unwind for linux. 304 cflags += [ "-DUNW_REMOTE_ONLY" ] 305 306 cflags += [ "-DBUILD_REMOTE" ] 307 308 cflags += [ "-Wno-sometimes-uninitialized" ] # some value not initialized in 309 # host x64 build 310 cflags += [ "-Wno-int-to-void-pointer-cast" ] 311 312 if (is_mingw) { 313 include_dirs += [ "include/mingw" ] 314 cflags += [ "-DMINGW" ] 315 } else if (is_linux) { 316 cflags += [ "-g" ] # we need debug info when it crash. 317 } 318 319 defines += [ "build_remote=1" ] 320 defines += [ "target_cpu=${target_cpu}" ] 321 defines += [ "host_toolchain=${host_toolchain}" ] 322 defines += [ "current_toolchain=${current_toolchain}" ] 323 defines += [ "default_toolchain=${default_toolchain}" ] 324} 325 326config("unwind_config_arm") { 327 defines = [ "UNW_TARGET_ARM" ] 328} 329 330config("unwind_config_arm64") { 331 defines = [ "UNW_TARGET_ARM64" ] 332} 333 334config("unwind_config_x64") { 335 defines = [ "UNW_TARGET_X86_64" ] 336 defines += [ "UNW_TARGET_X86_64_LINUX" ] 337} 338 339config("unwind_config_x86_64") { 340 defines = [ "UNW_TARGET_X86_64" ] 341 defines += [ "UNW_TARGET_X86_64_LINUX" ] 342} 343 344if (defined(ohos_lite)) { 345 source_set("unwind_source_arm") { 346 configs += [ ":unwind_config_remote" ] 347 public_configs = [ 348 ":unwind_config_public", 349 ":unwind_config_remote_public", 350 ":unwind_config_arm", 351 ] 352 sources = common_source 353 354 # there is a main function in this file 355 # for a lib we dont need this 356 arm_source -= [ "src/arm/gen-offsets.c" ] 357 358 # no jump lib 359 arm_source -= [ 360 "src/arm/getcontext.S", 361 "src/arm/siglongjmp.S", 362 ] 363 sources += arm_source 364 sources -= remove_sources 365 } 366 367 source_set("unwind_source_arm64") { 368 configs += [ ":unwind_config_remote" ] 369 public_configs = [ 370 ":unwind_config_public", 371 ":unwind_config_remote_public", 372 ":unwind_config_arm64", 373 ] 374 sources = common_source 375 376 arm64_source -= [ "src/aarch64/getcontext.S" ] 377 378 sources += arm64_source 379 sources -= remove_sources 380 } 381 382 source_set("unwind_source_x64") { 383 configs += [ ":unwind_config_remote" ] 384 public_configs = [ 385 ":unwind_config_public", 386 ":unwind_config_remote_public", 387 ":unwind_config_x64", 388 ] 389 sources = common_source 390 391 # no jump lib 392 x64_source -= [ 393 "src/x86_64/getcontext.S", 394 "src/x86_64/setcontext.S", 395 ] 396 sources += x64_source 397 sources -= remove_sources 398 } 399 400 source_set("unwind_source") { 401 configs += [ ":unwind_config_public" ] 402 sources = common_source 403 404 if (target_cpu == "arm") { 405 # there is a main function in this file 406 # for a lib we dont need this 407 arm_source -= [ "src/arm/gen-offsets.c" ] 408 409 # no jump lib 410 arm_source -= [ 411 "src/arm/getcontext.S", 412 "src/arm/siglongjmp.S", 413 ] 414 415 # as libc++ is static linked with libunwind.a 416 # we remove the Gstep.c for duplicated symbol violation 417 sources += arm_source 418 public_configs = [ ":unwind_config_arm" ] 419 } else if (target_cpu == "arm64") { 420 sources += arm64_source 421 public_configs = [ ":unwind_config_arm64" ] 422 } else if (target_cpu == "x64") { 423 sources += x64_source 424 public_configs = [ ":unwind_config_x64" ] 425 } else if (target_cpu == "x86_64") { 426 sources += x64_source 427 public_configs = [ ":unwind_config_x86_64" ] 428 } 429 430 sources += [ "src/os-ohos.c" ] 431 } 432 433 shared_library("libunwind") { 434 deps = [ ":unwind_source" ] 435 public_configs = [ ":unwind_config_public" ] 436 } 437} else { 438 ohos_source_set("unwind_source_arm") { 439 configs = [ ":unwind_config_remote" ] 440 public_configs = [ 441 ":unwind_config_public", 442 ":unwind_config_remote_public", 443 ":unwind_config_arm", 444 ] 445 sources = common_source 446 447 # there is a main function in this file 448 # for a lib we dont need this 449 arm_source -= [ "src/arm/gen-offsets.c" ] 450 451 # no jump lib 452 arm_source -= [ 453 "src/arm/getcontext.S", 454 "src/arm/siglongjmp.S", 455 ] 456 sources += arm_source 457 sources -= remove_sources 458 } 459 460 ohos_source_set("unwind_source_arm64") { 461 configs = [ ":unwind_config_remote" ] 462 public_configs = [ 463 ":unwind_config_public", 464 ":unwind_config_remote_public", 465 ":unwind_config_arm64", 466 ] 467 sources = common_source 468 469 arm64_source -= [ "src/aarch64/getcontext.S" ] 470 471 sources += arm64_source 472 sources -= remove_sources 473 } 474 475 ohos_source_set("unwind_source_x64") { 476 configs = [ ":unwind_config_remote" ] 477 public_configs = [ 478 ":unwind_config_public", 479 ":unwind_config_remote_public", 480 ":unwind_config_x64", 481 ] 482 sources = common_source 483 484 # no jump lib 485 x64_source -= [ 486 "src/x86_64/getcontext.S", 487 "src/x86_64/setcontext.S", 488 ] 489 sources += x64_source 490 sources -= remove_sources 491 } 492 493 ohos_source_set("unwind_source_x86_64") { 494 configs = [ ":unwind_config_remote" ] 495 public_configs = [ 496 ":unwind_config_public", 497 ":unwind_config_remote_public", 498 ":unwind_config_x86_64", 499 ] 500 sources = common_source 501 502 # no jump lib 503 x64_source -= [ 504 "src/x86_64/getcontext.S", 505 "src/x86_64/setcontext.S", 506 ] 507 sources += x64_source 508 sources -= remove_sources 509 } 510 511 ohos_source_set("unwind_source") { 512 configs = [ ":unwind_config_public" ] 513 sources = common_source 514 515 if (target_cpu == "arm") { 516 # as libc++ is static linked with libunwind.a 517 # we remove the Gstep.c for duplicated symbol violation 518 sources += arm_source 519 public_configs = [ ":unwind_config_arm" ] 520 } else if (target_cpu == "arm64") { 521 sources += arm64_source 522 public_configs = [ ":unwind_config_arm64" ] 523 } else if (target_cpu == "x64") { 524 sources += x64_source 525 public_configs = [ ":unwind_config_x64" ] 526 } else if (target_cpu == "x86_64") { 527 sources += x64_source 528 public_configs = [ ":unwind_config_x86_64" ] 529 } 530 531 sources += [ "src/os-ohos.c" ] 532 cflags = [ 533 "-DHAS_ARK_FRAME", 534 "-DPARSE_BUILD_ID", 535 "-DIS_VALIDATE_MEM", 536 ] 537 } 538 539 ohos_shared_library("libunwind") { 540 deps = [ ":unwind_source" ] 541 install_images = [ 542 "system", 543 "updater", 544 ] 545 public_configs = [ ":unwind_config_public" ] 546 part_name = "faultloggerd" 547 subsystem_name = "hiviewdfx" 548 } 549} 550 551if (!defined(ohos_lite)) { 552 import("//build/test.gni") 553 module_output_path = "hiviewdfx/faultloggerd" 554 group("unittest") { 555 testonly = true 556 deps = [ 557 ":Gtest_bt", 558 ":Gtest_dyn1", 559 ":Gtest_init", 560 ":Gtest_trace", 561 ":Ltest_bt", 562 ":Ltest_cxx_exceptions", 563 ":Ltest_dyn1", 564 ":Ltest_init", 565 ":Ltest_init_local_signal", 566 ":Ltest_mem_validate", 567 ":Ltest_nocalloc", 568 ":Ltest_nomalloc", 569 ":Ltest_trace", 570 ":test_ptrace_misc", 571 ":test_static_link", 572 ] 573 } 574 config("unwind_test") { 575 cflags = [ "-O0" ] 576 } 577 578 ohos_unittest("Gtest_init") { 579 module_out_path = module_output_path 580 sources = [ "tests/Gtest-init.cxx" ] 581 include_dirs = [ 582 "tests", 583 "include", 584 ] 585 586 configs = [ ":unwind_test" ] 587 deps = [ ":libunwind" ] 588 subsystem_name = "hiviewdfx" 589 part_name = "faultloggerd" 590 } 591 592 ohos_unittest("Ltest_init") { 593 module_out_path = module_output_path 594 sources = [ "tests/Ltest-init.cxx" ] 595 include_dirs = [ 596 "tests", 597 "include", 598 ] 599 configs = [ ":unwind_test" ] 600 deps = [ ":libunwind" ] 601 subsystem_name = "hiviewdfx" 602 part_name = "faultloggerd" 603 } 604 605 ohos_unittest("Ltest_cxx_exceptions") { 606 module_out_path = module_output_path 607 sources = [ "tests/Ltest-cxx-exceptions.cxx" ] 608 include_dirs = [ 609 "tests", 610 "include", 611 ] 612 configs = [ ":unwind_test" ] 613 cflags = [ "-fexceptions" ] 614 deps = [ ":libunwind" ] 615 subsystem_name = "hiviewdfx" 616 part_name = "faultloggerd" 617 remove_configs = [ "//build/config/compiler:no_exceptions" ] 618 } 619 620 ohos_unittest("Ltest_init_local_signal") { 621 module_out_path = module_output_path 622 sources = [ 623 "tests/Ltest-init-local-signal-lib.c", 624 "tests/Ltest-init-local-signal.c", 625 ] 626 include_dirs = [ 627 "tests", 628 "include", 629 ] 630 configs = [ ":unwind_test" ] 631 deps = [ ":libunwind" ] 632 subsystem_name = "hiviewdfx" 633 part_name = "faultloggerd" 634 } 635 636 ohos_unittest("Gtest_dyn1") { 637 module_out_path = module_output_path 638 sources = [ 639 "tests/Gtest-dyn1.c", 640 "tests/flush-cache.h", 641 ] 642 if (target_cpu == "arm") { 643 sources += [ "tests/flush-cache.S" ] 644 } 645 include_dirs = [ 646 "tests", 647 "include", 648 ] 649 configs = [ ":unwind_test" ] 650 cflags = [ "-DHAVE__BUILTIN___CLEAR_CACHE" ] 651 deps = [ ":libunwind" ] 652 subsystem_name = "hiviewdfx" 653 part_name = "faultloggerd" 654 } 655 656 ohos_unittest("Ltest_dyn1") { 657 module_out_path = module_output_path 658 sources = [ 659 "tests/Ltest-dyn1.c", 660 "tests/flush-cache.h", 661 ] 662 if (target_cpu == "arm") { 663 sources += [ "tests/flush-cache.S" ] 664 } 665 include_dirs = [ 666 "tests", 667 "include", 668 ] 669 configs = [ ":unwind_test" ] 670 cflags = [ "-DHAVE__BUILTIN___CLEAR_CACHE" ] 671 deps = [ ":libunwind" ] 672 subsystem_name = "hiviewdfx" 673 part_name = "faultloggerd" 674 } 675 676 ohos_unittest("test_static_link") { 677 module_out_path = module_output_path 678 sources = [ 679 "tests/test-static-link-gen.c", 680 "tests/test-static-link-loc.c", 681 ] 682 include_dirs = [ 683 "tests", 684 "include", 685 ] 686 configs = [ ":unwind_test" ] 687 deps = [ ":libunwind" ] 688 subsystem_name = "hiviewdfx" 689 part_name = "faultloggerd" 690 } 691 692 ohos_unittest("Gtest_bt") { 693 module_out_path = module_output_path 694 sources = [ 695 "tests/Gtest-bt.c", 696 "tests/dummy_backtrace.c", 697 "tests/ident.c", 698 ] 699 include_dirs = [ 700 "tests", 701 "include", 702 ] 703 configs = [ ":unwind_test" ] 704 deps = [ ":libunwind" ] 705 subsystem_name = "hiviewdfx" 706 part_name = "faultloggerd" 707 } 708 709 ohos_unittest("Ltest_bt") { 710 module_out_path = module_output_path 711 sources = [ 712 "tests/Ltest-bt.c", 713 "tests/dummy_backtrace.c", 714 "tests/ident.c", 715 ] 716 include_dirs = [ 717 "tests", 718 "include", 719 ] 720 configs = [ ":unwind_test" ] 721 deps = [ ":libunwind" ] 722 subsystem_name = "hiviewdfx" 723 part_name = "faultloggerd" 724 } 725 726 ohos_unittest("test_ptrace_misc") { 727 module_out_path = module_output_path 728 sources = [ 729 "tests/ident.c", 730 "tests/test-ptrace-misc.c", 731 ] 732 include_dirs = [ 733 "tests", 734 "include", 735 ] 736 configs = [ ":unwind_test" ] 737 deps = [ ":libunwind" ] 738 subsystem_name = "hiviewdfx" 739 part_name = "faultloggerd" 740 } 741 742 ohos_unittest("Ltest_nomalloc") { 743 module_out_path = module_output_path 744 sources = [ "tests/Ltest-nomalloc.c" ] 745 include_dirs = [ 746 "tests", 747 "include", 748 ] 749 configs = [ ":unwind_test" ] 750 deps = [ ":libunwind" ] 751 subsystem_name = "hiviewdfx" 752 part_name = "faultloggerd" 753 } 754 755 ohos_unittest("Ltest_nocalloc") { 756 module_out_path = module_output_path 757 sources = [ "tests/Ltest-nocalloc.c" ] 758 include_dirs = [ 759 "tests", 760 "include", 761 ] 762 configs = [ ":unwind_test" ] 763 deps = [ ":libunwind" ] 764 subsystem_name = "hiviewdfx" 765 part_name = "faultloggerd" 766 } 767 768 ohos_unittest("Gtest_trace") { 769 module_out_path = module_output_path 770 sources = [ 771 "tests/Gtest-trace.c", 772 "tests/dummy_backtrace.c", 773 "tests/ident.c", 774 ] 775 include_dirs = [ 776 "tests", 777 "include", 778 ] 779 configs = [ ":unwind_test" ] 780 deps = [ ":libunwind" ] 781 subsystem_name = "hiviewdfx" 782 part_name = "faultloggerd" 783 } 784 785 ohos_unittest("Ltest_trace") { 786 module_out_path = module_output_path 787 sources = [ 788 "tests/Ltest-trace.c", 789 "tests/dummy_backtrace.c", 790 "tests/ident.c", 791 ] 792 include_dirs = [ 793 "tests", 794 "include", 795 ] 796 configs = [ ":unwind_test" ] 797 deps = [ ":libunwind" ] 798 subsystem_name = "hiviewdfx" 799 part_name = "faultloggerd" 800 } 801 802 ohos_unittest("Ltest_mem_validate") { 803 module_out_path = module_output_path 804 sources = [ "tests/Ltest-mem-validate.c" ] 805 include_dirs = [ 806 "tests", 807 "include", 808 ] 809 configs = [ ":unwind_test" ] 810 deps = [ ":libunwind" ] 811 subsystem_name = "hiviewdfx" 812 part_name = "faultloggerd" 813 } 814} else { 815 group("unittest") { 816 testonly = true 817 deps = [] 818 } 819} 820