| # Copyright 2022 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| load( |
| "@fuchsia_sdk//fuchsia:defs.bzl", |
| "fuchsia_cc_binary", |
| "fuchsia_component", |
| "fuchsia_component_manifest", |
| "fuchsia_package", |
| ) |
| |
| cc_library( |
| name = "lib", |
| srcs = [ |
| "align.cc", |
| "align.h", |
| "arch.cc", |
| "arch.h", |
| "arch_types.h", |
| "automation_handler.cc", |
| "automation_handler.h", |
| "automation_instruction_executor.cc", |
| "automation_instruction_executor.h", |
| "binary_launcher.h", |
| "breakpoint.cc", |
| "breakpoint.h", |
| "component_manager.cc", |
| "component_manager.h", |
| "debug_agent.cc", |
| "debug_registers.h", |
| "debugged_process.cc", |
| "debugged_process.h", |
| "debugged_thread.cc", |
| "debugged_thread.h", |
| "elf_utils.cc", |
| "elf_utils.h", |
| "exception_handle.h", |
| "filter.cc", |
| "filter.h", |
| "general_registers.cc", |
| "general_registers.h", |
| "hardware_breakpoint.cc", |
| "hardware_breakpoint.h", |
| "job_handle.cc", |
| "job_handle.h", |
| "limbo_provider.h", |
| "module_list.cc", |
| "module_list.h", |
| "process_breakpoint.cc", |
| "process_breakpoint.h", |
| "process_handle.h", |
| "process_handle_observer.h", |
| "remote_api.h", |
| "remote_api_adapter.cc", |
| "software_breakpoint.cc", |
| "software_breakpoint.h", |
| "stdio_handles.h", |
| "suspend_handle.h", |
| "system_interface.cc", |
| "system_interface.h", |
| "test_realm.cc", |
| "test_realm.h", |
| "thread_handle.h", |
| "time.h", |
| "unwind.cc", |
| "unwind.h", |
| "watchpoint.cc", |
| "watchpoint.h", |
| "watchpoint_info.h", |
| "zircon_binary_launcher.cc", |
| "zircon_binary_launcher.h", |
| "zircon_component_manager.cc", |
| "zircon_component_manager.h", |
| "zircon_exception_handle.cc", |
| "zircon_exception_handle.h", |
| "zircon_job_handle.cc", |
| "zircon_job_handle.h", |
| "zircon_limbo_provider.cc", |
| "zircon_limbo_provider.h", |
| "zircon_process_handle.cc", |
| "zircon_process_handle.h", |
| "zircon_suspend_handle.cc", |
| "zircon_suspend_handle.h", |
| "zircon_system_interface.cc", |
| "zircon_thread_handle.cc", |
| "zircon_thread_handle.h", |
| "zircon_utils.cc", |
| "zircon_utils.h", |
| ] + select( |
| { |
| "@platforms//cpu:x86_64": [ |
| "arch_x64.cc", |
| "debug_registers_x64.cc", |
| ], |
| "@platforms//cpu:arm64": [ |
| "arch_arm64.cc", |
| "debug_registers_arm64.cc", |
| ], |
| # TODO(121729): Add riscv64 support. |
| }, |
| ), |
| hdrs = [ |
| "debug_agent.h", |
| "remote_api_adapter.h", |
| "zircon_system_interface.h", |
| ], |
| linkstatic = True, |
| deps = [ |
| "//third_party/crashpad:minidump", |
| "//third_party/crashpad:snapshot", |
| "//third_party/crashpad:util", |
| "@com_google_googletest//:gtest_main", |
| "@fuchsia_sdk//fidl/fuchsia.io:fuchsia.io_cc", |
| "@fuchsia_sdk//fidl/fuchsia.kernel:fuchsia.kernel_cc", |
| "@fuchsia_sdk//pkg/async-loop-cpp", |
| "@fuchsia_sdk//pkg/async-loop-default", |
| "@fuchsia_sdk//pkg/fit", |
| "@fuchsia_sdk//pkg/zx", |
| "@internal_sdk//fidl/fuchsia.exception:fuchsia.exception_cc", |
| "@internal_sdk//fidl/fuchsia.sys2:fuchsia.sys2_cc", |
| "@internal_sdk//fidl/fuchsia.test.manager:fuchsia.test.manager_cc", |
| "@internal_sdk//pkg/syslog_cpp", |
| "@internal_sdk//src/developer/debug/ipc_ipc", |
| "@internal_sdk//src/developer/debug/shared_shared", |
| "@internal_sdk//src/lib/containers/cpp_cpp", |
| "@internal_sdk//src/lib/diagnostics/accessor2logger_accessor2logger", |
| "@internal_sdk//src/lib/elflib_elflib", |
| "@internal_sdk//src/lib/process_process", |
| "@internal_sdk//src/lib/unwinder_unwinder", |
| "@prebuilt_llvm//:llvm_includes", |
| ], |
| ) |
| |
| fuchsia_cc_binary( |
| name = "debug_agent", |
| srcs = ["main.cc"], |
| deps = [":lib"], |
| ) |
| |
| fuchsia_cc_binary( |
| name = "debug_agent_launcher", |
| srcs = ["main_launcher.cc"], |
| deps = [ |
| "@fuchsia_sdk//pkg/async-loop-cpp", |
| "@fuchsia_sdk//pkg/async-loop-default", |
| "@fuchsia_sdk//pkg/sys_cpp", |
| "@internal_sdk//fidl/fuchsia.debugger:fuchsia.debugger_cc", |
| "@internal_sdk//pkg/syslog_cpp", |
| ], |
| ) |
| |
| fuchsia_component_manifest( |
| name = "manifest", |
| src = "meta/debug_agent.cml", |
| ) |
| |
| fuchsia_component( |
| name = "component", |
| manifest = ":manifest", |
| deps = [ |
| ":debug_agent", |
| ":debug_agent_launcher", |
| ], |
| ) |
| |
| fuchsia_package( |
| name = "pkg", |
| package_name = "debug_agent", |
| components = [":component"], |
| package_repository_name = "fuchsia.com", |
| # TODO(jayzhuang): Figure out how to express the following in Bazel. |
| # |
| # if (include_helper_executables) { |
| # # These executables are not used by tests or the agent, but are useful for |
| # # replicating behaviour in development. |
| # deps += [ |
| # ":zxdb_test_app", |
| # "test_data:helper_executables", |
| # ] |
| # } |
| ) |