| # Copyright 2026 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("//build/bazel/platforms:constraints.bzl", "HOST_OS_CONSTRAINTS") | |
| load("//build/bazel/rules/cc:fx_cc_library.bzl", "fx_cc_library") | |
| package(default_applicable_licenses = ["//:license"]) | |
| # Allow same-package tests to include private sources such as | |
| # format_register.cc in GN. | |
| # @bazel2gn:raw_attribute:friend = [ ":*" ] | |
| fx_cc_library( | |
| name = "console", | |
| srcs = [ | |
| "analyze_memory.cc", | |
| "command.cc", | |
| "command_context.cc", | |
| "command_line_options.cc", | |
| "command_parser.cc", | |
| "command_sequence.cc", | |
| "command_utils.cc", | |
| "commands/verb_aspace.cc", | |
| "commands/verb_async_backtrace.cc", | |
| "commands/verb_attach.cc", | |
| "commands/verb_auth.cc", | |
| "commands/verb_backtrace.cc", | |
| "commands/verb_break.cc", | |
| "commands/verb_clear.cc", | |
| "commands/verb_cls.cc", | |
| "commands/verb_connect.cc", | |
| "commands/verb_continue.cc", | |
| "commands/verb_detach.cc", | |
| "commands/verb_disable.cc", | |
| "commands/verb_disassemble.cc", | |
| "commands/verb_disconnect.cc", | |
| "commands/verb_display.cc", | |
| "commands/verb_down.cc", | |
| "commands/verb_enable.cc", | |
| "commands/verb_exception_info.cc", | |
| "commands/verb_finish.cc", | |
| "commands/verb_handle.cc", | |
| "commands/verb_help.cc", | |
| "commands/verb_jump.cc", | |
| "commands/verb_kill.cc", | |
| "commands/verb_libs.cc", | |
| "commands/verb_list.cc", | |
| "commands/verb_locals.cc", | |
| "commands/verb_mem_analyze.cc", | |
| "commands/verb_mem_read.cc", | |
| "commands/verb_new.cc", | |
| "commands/verb_next.cc", | |
| "commands/verb_nexti.cc", | |
| "commands/verb_opendump.cc", | |
| "commands/verb_pause.cc", | |
| "commands/verb_print.cc", | |
| "commands/verb_ps.cc", | |
| "commands/verb_quit.cc", | |
| "commands/verb_regs.cc", | |
| "commands/verb_rm.cc", | |
| "commands/verb_run.cc", | |
| "commands/verb_run_component.cc", | |
| "commands/verb_run_test.cc", | |
| "commands/verb_savedump.cc", | |
| "commands/verb_stack_data.cc", | |
| "commands/verb_stack_usage.cc", | |
| "commands/verb_status.cc", | |
| "commands/verb_stderr.cc", | |
| "commands/verb_stdout.cc", | |
| "commands/verb_step.cc", | |
| "commands/verb_stepi.cc", | |
| "commands/verb_steps.cc", | |
| "commands/verb_sym_debug.cc", | |
| "commands/verb_sym_info.cc", | |
| "commands/verb_sym_near.cc", | |
| "commands/verb_sym_search.cc", | |
| "commands/verb_sym_stat.cc", | |
| "commands/verb_sys_info.cc", | |
| "commands/verb_tracepoint.cc", | |
| "commands/verb_until.cc", | |
| "commands/verb_up.cc", | |
| "commands/verb_watch.cc", | |
| "console.cc", | |
| "console_context.cc", | |
| "console_impl.cc", | |
| "console_noninteractive.cc", | |
| "did_you_mean.cc", | |
| "fd_streamer.cc", | |
| "format_async_task.cc", | |
| "format_context.cc", | |
| "format_exception.cc", | |
| "format_filter.cc", | |
| "format_frame.cc", | |
| "format_handle.cc", | |
| "format_location.cc", | |
| "format_memory.cc", | |
| "format_register.cc", | |
| "format_register_arm64.cc", | |
| "format_register_x64.cc", | |
| "format_settings.cc", | |
| "format_symbol.cc", | |
| "format_table.cc", | |
| "format_target.cc", | |
| "format_thread.cc", | |
| "format_tracepoint.cc", | |
| "input_location_parser.cc", | |
| "nouns.cc", | |
| "print_command_utils.cc", | |
| "script_runner.cc", | |
| "string_formatters.cc", | |
| "test_failure_stack_matcher.cc", | |
| "verbs.cc", | |
| "verbs_settings.cc", | |
| ], | |
| hdrs = [ | |
| "analyze_memory.h", | |
| "command.h", | |
| "command_context.h", | |
| "command_group.h", | |
| "command_line_options.h", | |
| "command_parser.h", | |
| "command_sequence.h", | |
| "command_utils.h", | |
| "commands/verb_aspace.h", | |
| "commands/verb_async_backtrace.h", | |
| "commands/verb_attach.h", | |
| "commands/verb_auth.h", | |
| "commands/verb_backtrace.h", | |
| "commands/verb_break.h", | |
| "commands/verb_clear.h", | |
| "commands/verb_cls.h", | |
| "commands/verb_connect.h", | |
| "commands/verb_continue.h", | |
| "commands/verb_detach.h", | |
| "commands/verb_disable.h", | |
| "commands/verb_disassemble.h", | |
| "commands/verb_disconnect.h", | |
| "commands/verb_display.h", | |
| "commands/verb_down.h", | |
| "commands/verb_enable.h", | |
| "commands/verb_exception_info.h", | |
| "commands/verb_finish.h", | |
| "commands/verb_handle.h", | |
| "commands/verb_help.h", | |
| "commands/verb_jump.h", | |
| "commands/verb_kill.h", | |
| "commands/verb_libs.h", | |
| "commands/verb_list.h", | |
| "commands/verb_locals.h", | |
| "commands/verb_mem_analyze.h", | |
| "commands/verb_mem_read.h", | |
| "commands/verb_new.h", | |
| "commands/verb_next.h", | |
| "commands/verb_nexti.h", | |
| "commands/verb_opendump.h", | |
| "commands/verb_pause.h", | |
| "commands/verb_print.h", | |
| "commands/verb_ps.h", | |
| "commands/verb_quit.h", | |
| "commands/verb_regs.h", | |
| "commands/verb_rm.h", | |
| "commands/verb_run.h", | |
| "commands/verb_run_component.h", | |
| "commands/verb_run_test.h", | |
| "commands/verb_savedump.h", | |
| "commands/verb_stack_data.h", | |
| "commands/verb_stack_usage.h", | |
| "commands/verb_status.h", | |
| "commands/verb_stderr.h", | |
| "commands/verb_stdout.h", | |
| "commands/verb_step.h", | |
| "commands/verb_stepi.h", | |
| "commands/verb_steps.h", | |
| "commands/verb_sym_debug.h", | |
| "commands/verb_sym_info.h", | |
| "commands/verb_sym_near.h", | |
| "commands/verb_sym_search.h", | |
| "commands/verb_sym_stat.h", | |
| "commands/verb_sys_info.h", | |
| "commands/verb_tracepoint.h", | |
| "commands/verb_until.h", | |
| "commands/verb_up.h", | |
| "commands/verb_watch.h", | |
| "console.h", | |
| "console_context.h", | |
| "console_impl.h", | |
| "console_noninteractive.h", | |
| "did_you_mean.h", | |
| "fd_streamer.h", | |
| "format_async_task.h", | |
| "format_context.h", | |
| "format_exception.h", | |
| "format_filter.h", | |
| "format_frame.h", | |
| "format_handle.h", | |
| "format_location.h", | |
| "format_memory.h", | |
| "format_register.h", | |
| "format_register_arm64.h", | |
| "format_register_x64.h", | |
| "format_settings.h", | |
| "format_symbol.h", | |
| "format_table.h", | |
| "format_target.h", | |
| "format_thread.h", | |
| "format_tracepoint.h", | |
| "input_location_parser.h", | |
| "nouns.h", | |
| "print_command_utils.h", | |
| "script_runner.h", | |
| "string_formatters.h", | |
| "switch_record.h", | |
| "test_failure_stack_matcher.h", | |
| "verbs.h", | |
| "verbs_settings.h", | |
| ], | |
| implementation_deps = [ | |
| "//src/lib/files", | |
| "//src/lib/llvm/host:LLVMDemangle", | |
| "//zircon/system/public", | |
| ], | |
| # Host-only in Bazel (depends on host-only //src/developer/debug/zxdb/client, | |
| # //src/developer/debug/zxdb/expr, //src/developer/debug/zxdb/format, | |
| # //src/developer/debug/zxdb/symbols, and //src/lib/llvm/host:LLVMDemangle); | |
| # keep unguarded in BUILD.gn. | |
| # @bazel2gn:skip | |
| target_compatible_with = HOST_OS_CONSTRAINTS, | |
| # format_register_unittest.cc includes format_register.cc directly; | |
| # expose it to same-package tests in Bazel without adding it to GN public. | |
| # @bazel2gn:skip | |
| textual_hdrs = ["format_register.cc"], | |
| visibility = [ | |
| "//src/developer/debug/e2e_tests:__pkg__", | |
| "//src/developer/debug/zxdb:__pkg__", | |
| "//src/developer/debug/zxdb/debug_adapter:__pkg__", | |
| "//tools/symbolizer:__pkg__", | |
| ], | |
| deps = [ | |
| "//sdk/lib/fit", | |
| "//sdk/lib/syslog/cpp", | |
| "//src/developer/debug/ipc", | |
| "//src/developer/debug/shared", | |
| "//src/developer/debug/zxdb/client", | |
| "//src/developer/debug/zxdb/common", | |
| "//src/developer/debug/zxdb/expr", | |
| "//src/developer/debug/zxdb/format", | |
| "//src/developer/debug/zxdb/symbols", | |
| "//src/lib/analytics/cpp/core_dev_tools", | |
| "//src/lib/cmdline", | |
| "//src/lib/fxl", | |
| "//src/lib/line_input", | |
| "@com_google_googletest//:gtest_prod", | |
| ], | |
| ) | |
| fx_cc_library( | |
| name = "test_support", | |
| testonly = True, | |
| srcs = ["mock_console.cc"], | |
| hdrs = ["mock_console.h"], | |
| implementation_deps = [ | |
| "//sdk/lib/syslog/cpp", | |
| "//src/developer/debug/shared", | |
| ], | |
| # Host-only in Bazel (depends on host-only :console and | |
| # //src/developer/debug/zxdb/client:test_support); keep unguarded in BUILD.gn. | |
| # @bazel2gn:skip | |
| target_compatible_with = HOST_OS_CONSTRAINTS, | |
| visibility = [ | |
| "//src/developer/debug/e2e_tests:__pkg__", | |
| "//src/developer/debug/zxdb/debug_adapter:__pkg__", | |
| ], | |
| deps = [ | |
| ":console", | |
| "//src/developer/debug/zxdb/client", | |
| "//src/developer/debug/zxdb/client:test_support", | |
| "//src/developer/debug/zxdb/format", | |
| "//src/lib/fxl", | |
| ], | |
| alwayslink = True, | |
| ) | |
| fx_cc_library( | |
| name = "tests", | |
| testonly = True, | |
| srcs = [ | |
| "analyze_memory_unittest.cc", | |
| "command_context_unittest.cc", | |
| "command_parser_unittest.cc", | |
| "command_sequence_unittest.cc", | |
| "command_utils_unittest.cc", | |
| "commands/breakpoint_command_test.h", | |
| "commands/verb_aspace_unittest.cc", | |
| "commands/verb_attach_unittest.cc", | |
| "commands/verb_break_unittest.cc", | |
| "commands/verb_clear_unittest.cc", | |
| "commands/verb_detach_unittest.cc", | |
| "commands/verb_disassemble_unittest.cc", | |
| "commands/verb_display_unittest.cc", | |
| "commands/verb_down_unittest.cc", | |
| "commands/verb_finish_unittest.cc", | |
| "commands/verb_list_unittest.cc", | |
| "commands/verb_new_rm_unittest.cc", | |
| "commands/verb_print_unittest.cc", | |
| "commands/verb_ps_unittest.cc", | |
| "commands/verb_quit_unittest.cc", | |
| "commands/verb_savedump_unittest.cc", | |
| "commands/verb_stack_data_unittest.cc", | |
| "commands/verb_stack_usage_unittest.cc", | |
| "commands/verb_status_unittest.cc", | |
| "commands/verb_steps_unittest.cc", | |
| "commands/verb_sym_info_unittest.cc", | |
| "commands/verb_sym_stat_unittest.cc", | |
| "commands/verb_tracepoint_unittest.cc", | |
| "commands/verb_up_unittest.cc", | |
| "commands/verb_watch_unittest.cc", | |
| "console_context_unittest.cc", | |
| "console_impl_unittest.cc", | |
| "console_test.cc", | |
| "console_test.h", | |
| "format_async_task_unittest.cc", | |
| "format_context_unittest.cc", | |
| "format_exception_unittest.cc", | |
| "format_filter_unittest.cc", | |
| "format_frame_unittest.cc", | |
| "format_handle_unittest.cc", | |
| "format_location_unittest.cc", | |
| "format_memory_unittest.cc", | |
| "format_register_unittest.cc", | |
| "format_settings_unittest.cc", | |
| "format_symbol_unittest.cc", | |
| "format_table_unittest.cc", | |
| "format_target_unittest.cc", | |
| "format_thread_unittest.cc", | |
| "format_tracepoint_unittest.cc", | |
| "input_location_parser_unittest.cc", | |
| "nouns_unittest.cc", | |
| "script_runner_unittest.cc", | |
| "string_formatters_unittest.cc", | |
| "test_failure_stack_matcher_unittest.cc", | |
| "verbs_settings_unittest.cc", | |
| ], | |
| implementation_deps = [ | |
| ":console", | |
| ":test_support", | |
| "//sdk/lib/syslog/cpp", | |
| "//src/developer/debug/ipc", | |
| "//src/developer/debug/shared", | |
| "//src/developer/debug/zxdb/client", | |
| "//src/developer/debug/zxdb/client:test_support", | |
| "//src/developer/debug/zxdb/common", | |
| "//src/developer/debug/zxdb/common:test_support", | |
| "//src/developer/debug/zxdb/expr", | |
| "//src/developer/debug/zxdb/expr:test_support", | |
| "//src/developer/debug/zxdb/format", | |
| "//src/developer/debug/zxdb/format:test_support", | |
| "//src/developer/debug/zxdb/symbols", | |
| "//src/developer/debug/zxdb/symbols:test_support", | |
| "//src/lib/files", | |
| "//src/lib/fxl", | |
| "//src/lib/llvm/host:LLVMBinaryFormat", | |
| "//zircon/system/public", | |
| "@com_google_googletest//:gtest", | |
| ], | |
| # Host-only in Bazel (depends on host-only :console and :test_support); | |
| # keep unguarded in BUILD.gn. | |
| # @bazel2gn:skip | |
| target_compatible_with = HOST_OS_CONSTRAINTS, | |
| alwayslink = True, | |
| ) |