# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//base/hiviewdfx/faultloggerd/faultloggerd.gni") if (defined(ohos_lite)) { source_set("process_info_src") { cflags = [] defines = [ "HAVE_CONFIG_H", "HAVE_ELF_H", "HAVE_LINK_H", ] visibility = [ "*:*" ] include_dirs = [ ".", "$faultloggerd_path/common", "$faultloggerd_path/common/dfxlog", "//commonlibrary/c_utils/base/include", "$faultloggerd_path/interfaces/innerkits/faultloggerd_client/include", "$hilog_lite_include_path", ] sources = [ "dfx_config.cpp", "dfx_dump_request.cpp", "dfx_dump_res.cpp", "dfx_dump_writer.cpp", "dfx_elf.cpp", "dfx_fault_stack.cpp", "dfx_frame.cpp", "dfx_logger.cpp", "dfx_maps.cpp", "dfx_process.cpp", "dfx_ring_buffer_wrapper.cpp", "dfx_signal.cpp", "dfx_symbols_cache.cpp", "dfx_thread.cpp", "dfx_unwind_local.cpp", "dfx_unwind_remote.cpp", "dfx_util.cpp", "process_dumper.cpp", ] if (target_cpu == "arm") { sources += [ "dfx_regs_arm.cpp" ] #cflags += [ "-D__arm__" ] } else if (target_cpu == "arm64") { sources += [ "dfx_regs_arm64.cpp" ] cflags += [ "-D__aarch64__" ] } else if (target_cpu == "x86_64") { sources += [ "dfx_regs_x86_64.cpp" ] cflags += [ "-D__x86_64__" ] } deps = [ "$faultloggerd_path/common/dfxlog:static_common_log", "$faultloggerd_path/interfaces/innerkits/faultloggerd_client:libfaultloggerd", "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", "//third_party/libunwind:libunwind", ] } executable("processdump") { visibility = [ "*:*" ] include_dirs = [ ".", "$faultloggerd_path/common", "$faultloggerd_path/common/dfxlog", "$faultloggerd_path/utils", "//commonlibrary/c_utils/base/include", "$faultloggerd_path/interfaces/innerkits/faultloggerd_client/include", "$hilog_lite_include_path", ] defines = [ "HAVE_CONFIG_H", "HAVE_ELF_H", "HAVE_LINK_H", ] sources = [ "//base/hiviewdfx/faultloggerd/utils/directory_ex.cpp", "cppcrash_reporter.cpp", "dfx_config.cpp", "dfx_dump_request.cpp", "dfx_dump_res.cpp", "dfx_dump_writer.cpp", "dfx_elf.cpp", "dfx_fault_stack.cpp", "dfx_frame.cpp", "dfx_logger.cpp", "dfx_maps.cpp", "dfx_process.cpp", "dfx_ring_buffer_wrapper.cpp", "dfx_signal.cpp", "dfx_symbols_cache.cpp", "dfx_thread.cpp", "dfx_unwind_local.cpp", "dfx_unwind_remote.cpp", "dfx_util.cpp", "main.cpp", "process_dumper.cpp", ] if (target_cpu == "arm") { sources += [ "dfx_regs_arm.cpp" ] cflags = [ "-D__arm__" ] } else if (target_cpu == "arm64") { sources += [ "dfx_regs_arm64.cpp" ] cflags = [ "-D__aarch64__" ] } else if (target_cpu == "x86_64") { sources += [ "dfx_regs_x86_64.cpp" ] cflags = [ "-D__x86_64__" ] } deps = [ "$faultloggerd_path/common/dfxlog:static_common_log", "$faultloggerd_path/interfaces/innerkits/faultloggerd_client:libfaultloggerd", "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", "//third_party/libunwind:libunwind", ] } } else { config("processdump_config") { visibility = [ ":*" ] include_dirs = [ ".", "//base/hiviewdfx/faultloggerd/common", "//base/hiviewdfx/faultloggerd/common/dfxlog", "//commonlibrary/c_utils/base/include", ] } ohos_source_set("process_info_src") { cflags = [] configs = [ ":processdump_config" ] sources = [ "dfx_config.cpp", "dfx_dump_request.cpp", "dfx_dump_res.cpp", "dfx_dump_writer.cpp", "dfx_elf.cpp", "dfx_fault_stack.cpp", "dfx_frame.cpp", "dfx_logger.cpp", "dfx_maps.cpp", "dfx_process.cpp", "dfx_ring_buffer_wrapper.cpp", "dfx_signal.cpp", "dfx_symbols_cache.cpp", "dfx_thread.cpp", "dfx_unwind_local.cpp", "dfx_unwind_remote.cpp", "dfx_util.cpp", "process_dumper.cpp", ] if (target_cpu == "arm") { sources += [ "dfx_regs_arm.cpp" ] #cflags += [ "-D__arm__" ] } else if (target_cpu == "arm64") { sources += [ "dfx_regs_arm64.cpp" ] cflags += [ "-D__aarch64__" ] } else if (target_cpu == "x86_64") { sources += [ "dfx_regs_x86_64.cpp" ] cflags += [ "-D__x86_64__" ] } deps = [ "$faultloggerd_path/common/dfxlog:static_common_log", "$faultloggerd_path/interfaces/innerkits/faultloggerd_client:libfaultloggerd", "//third_party/libunwind:libunwind", ] external_deps = [ "c_utils:utils", "hilog_native:libhilog", ] part_name = "faultloggerd" subsystem_name = "hiviewdfx" } ohos_executable("processdump") { install_enable = true configs = [ ":processdump_config" ] sources = [ "cppcrash_reporter.cpp", "dfx_config.cpp", "dfx_dump_request.cpp", "dfx_dump_res.cpp", "dfx_dump_writer.cpp", "dfx_elf.cpp", "dfx_fault_stack.cpp", "dfx_frame.cpp", "dfx_logger.cpp", "dfx_maps.cpp", "dfx_process.cpp", "dfx_ring_buffer_wrapper.cpp", "dfx_signal.cpp", "dfx_symbols_cache.cpp", "dfx_thread.cpp", "dfx_unwind_local.cpp", "dfx_unwind_remote.cpp", "dfx_util.cpp", "main.cpp", "process_dumper.cpp", ] if (target_cpu == "arm") { sources += [ "dfx_regs_arm.cpp" ] cflags = [ "-D__arm__" ] } else if (target_cpu == "arm64") { sources += [ "dfx_regs_arm64.cpp" ] cflags = [ "-D__aarch64__" ] } else if (target_cpu == "x86_64") { sources += [ "dfx_regs_x86_64.cpp" ] cflags = [ "-D__x86_64__" ] } cflags_cc = [ "-DDEBUG_CRASH_LOCAL_HANDLER" ] deps = [ "$faultloggerd_path/common/dfxlog:static_common_log", "$faultloggerd_path/common/util:dfx_cutil", "$faultloggerd_path/interfaces/innerkits/faultloggerd_client:libfaultloggerd", "$faultloggerd_path/interfaces/innerkits/signal_handler:dfx_local_handler", "//third_party/libunwind:libunwind", ] external_deps = [ "c_utils:utils", "hilog_native:libhilog", ] install_images = [ "system", "updater", ] part_name = "faultloggerd" subsystem_name = "hiviewdfx" } }