blob: 54166a1fc0669a84d8975ba192da3e7895fc3fc2 [file] [log] [blame]
# Copyright 2018 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.
import("//build/config/clang/clang.gni")
static_library("symbols") {
# The client library one directory up instantiates the "Impl" classes using
# the non-public headers.
friend = [
":*",
"//src/developer/debug/zxdb/client/*",
]
public = [
"arch.h",
"array_type.h",
"base_type.h",
"code_block.h",
"collection.h",
"data_member.h",
"dwarf_expr_eval.h",
"dwarf_tag.h",
"enumeration.h",
"file_line.h",
"function.h",
"function_type.h",
"identifier.h",
"inherited_from.h",
"input_location.h",
"lazy_symbol.h",
"line_details.h",
"loaded_module_symbols.h",
"location.h",
"member_ptr.h",
"modified_type.h",
"module_symbol_index.h",
"module_symbol_index_node.h",
"module_symbol_status.h",
"module_symbols.h",
"namespace.h",
"process_symbols.h",
"resolve_options.h",
"symbol.h",
"symbol_context.h",
"symbol_data_provider.h",
"symbol_factory.h",
"symbol_utils.h",
"system_symbols.h",
"target_symbols.h",
"type.h",
"type_utils.h",
"value.h",
"variable.h",
"variable_location.h",
"visit_scopes.h",
]
sources = [
"arch.cc",
"array_type.cc",
"base_type.cc",
"build_id_index.cc",
"build_id_index.h",
"code_block.cc",
"collection.cc",
"data_member.cc",
"dwarf_die_decoder.cc",
"dwarf_die_decoder.h",
"dwarf_expr_eval.cc",
"dwarf_symbol_factory.cc",
"dwarf_symbol_factory.h",
"dwarf_tag.cc",
"enumeration.cc",
"file_line.cc",
"find_line.cc",
"find_line.h",
"function.cc",
"function_type.cc",
"identifier.cc",
"inherited_from.cc",
"lazy_symbol.cc",
"line_details.cc",
"line_table.h",
"line_table_impl.cc",
"line_table_impl.h",
"loaded_module_symbols.cc",
"location.cc",
"member_ptr.cc",
"modified_type.cc",
"module_symbol_index.cc",
"module_symbol_index_node.cc",
"module_symbols.cc",
"module_symbols_impl.cc",
"module_symbols_impl.h",
"namespace.cc",
"process_symbols.cc",
"symbol.cc",
"symbol_context.cc",
"symbol_data_provider.cc",
"symbol_utils.cc",
"system_symbols.cc",
"target_symbols.cc",
"type.cc",
"type_utils.cc",
"value.cc",
"variable.cc",
"variable_location.cc",
"visit_scopes.cc",
]
# This library can not use any part of the debugger other than the "common"
# base helpers.
public_deps = [
"//src/developer/debug/ipc:client",
"//src/developer/debug/shared",
"//src/developer/debug/zxdb/common",
"//src/lib/elflib",
"//src/lib/fxl",
]
deps = [
"//garnet/third_party/llvm:LLVMDebugInfoDWARF",
"//src/lib/elflib",
]
}
static_library("test_support") {
testonly = true
sources = [
"index_test_support.cc",
"index_test_support.h",
"mock_line_table.cc",
"mock_line_table.h",
"mock_module_symbols.cc",
"mock_module_symbols.h",
"mock_symbol_data_provider.cc",
"mock_symbol_data_provider.h",
"process_symbols_test_setup.cc",
"process_symbols_test_setup.h",
"type_test_support.cc",
"type_test_support.h",
"variable_test_support.cc",
"variable_test_support.h",
]
deps = [
":symbols",
"//garnet/third_party/llvm:LLVMDebugInfoDWARF",
]
}
# Copies the test libraries for zxdb tests to use when run on Linux or Mac.
default_shared_out_dir =
get_label_info("//anything(${default_toolchain}-shared)", "root_out_dir")
copy("copy_test_so") {
sources = [
"$default_shared_out_dir/lib.unstripped/libzxdb_symbol_test.so",
"test_data/libsymbol_test_so.targetso",
"test_data/libsymbol_test_so_stripped.targetso",
]
# Use a ".targetso" extension because this isn't a library that can actually
# loaded on the host platform.
outputs = [
"$root_out_dir/test_data/zxdb/{{source_name_part}}.targetso",
]
deps = [
"test_data:zxdb_symbol_test(${default_toolchain}-shared)",
]
}
if (current_toolchain == host_toolchain) {
copy("copy_test_elf_file") {
# This file is a small valid ELF file for testing the parser with.
# It was generated by compiling the program:
# int main() { return 1; }
# on Linux with:
# gcc -O2 file.c
sources = [
"test_data/small_test_file.elf",
]
outputs = [
"$root_out_dir/test_data/zxdb/small_test_file.elf",
]
metadata = {
test_runtime_deps = outputs
}
}
}
source_set("tests") {
testonly = true
sources = [
"build_id_index_unittest.cc",
"code_block_unittest.cc",
"dwarf_expr_eval_unittest.cc",
"dwarf_symbol_factory_unittest.cc",
"dwarf_test_util.cc",
"dwarf_test_util.h",
"find_line_unittest.cc",
"function_type_unittest.cc",
"identifier_unittest.cc",
"loaded_module_symbols_unittest.cc",
"member_ptr_unittest.cc",
"mock_symbol_data_provider_unittest.cc",
"modified_type_unittest.cc",
"module_symbol_index_node_unittest.cc",
"module_symbol_index_unittest.cc",
"module_symbols_impl_unittest.cc",
"process_symbols_unittest.cc",
"symbol_utils_unittest.cc",
"target_symbols_unittest.cc",
"test_symbol_module.cc",
"type_utils_unittest.cc",
"variable_location_unittest.cc",
"visit_scopes_unittest.cc",
]
deps = [
":copy_test_elf_file($host_toolchain)",
":symbols",
":test_support",
"//garnet/third_party/llvm:LLVMDebugInfoDWARF",
"//src/developer/debug/zxdb/common:test_support",
"//third_party/googletest:gtest",
]
data_deps = [
":copy_test_so",
]
metadata = {
test_runtime_deps = get_target_outputs(":copy_test_so")
}
}
source_set("perf_tests") {
testonly = true
sources = [
"module_symbol_index_perftest.cc",
]
deps = [
":symbols",
"//src/developer/debug/zxdb/common:perf_test",
]
}