blob: 2c78eb59fc7c8c62bd3c8a81380c3d6428775b0b [file] [log] [blame]
# Copyright 2017 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/package.gni")
# Set manually to true to compile the zxdb_test_app.cc file for manual debugger
# testing of various conditions.
include_test_app = false
static_library("lib") {
sources = [
"arch.cc",
"arch.h",
"breakpoint.cc",
"breakpoint.h",
"debug_agent.cc",
"debug_agent.h",
"debugged_job.cc",
"debugged_job.h",
"debugged_process.cc",
"debugged_process.h",
"debugged_thread.cc",
"debugged_thread.h",
"launcher.cc",
"launcher.h",
"object_util.cc",
"object_util.h",
"process_breakpoint.cc",
"process_breakpoint.h",
"process_info.cc",
"process_info.h",
"process_memory_accessor.h",
"remote_api.h",
"remote_api_adapter.cc",
"remote_api_adapter.h",
"system_info.cc",
"system_info.h",
"unwind.cc",
"unwind.h",
]
if (current_cpu == "x64") {
sources += [
"arch_x64.cc",
"arch_x64.h",
"arch_x64_helpers.cc",
"arch_x64_helpers.h",
]
} else if (current_cpu == "arm64") {
sources += [
"arch_arm64.cc",
"arch_arm64.h",
]
} else {
assert(false)
}
public_deps = [
"//garnet/lib/debug_ipc:agent",
"//garnet/lib/debug_ipc/helper",
"//garnet/lib/process",
"//garnet/public/lib/fxl",
"//garnet/public/lib/svc/cpp",
"//zircon/public/fidl/fuchsia-sysinfo:fuchsia-sysinfo_c",
"//zircon/public/lib/ngunwind",
]
}
if (include_test_app) {
executable("zxdb_test_app") {
if (is_debug) {
# Force no optimization in debug builds.
configs -= [ "//build/config:debug" ]
cflags = [ "-O0" ]
}
sources = [
"zxdb_test_app.cc",
]
deps = [
"//zircon/public/lib/zx",
]
}
}
executable("bin") {
output_name = "debug_agent"
sources = [
"main.cc",
]
deps = [
":lib",
"//garnet/public/lib/component/cpp:environment_services",
]
}
package("debug_agent") {
deps = [
":bin",
]
meta = [
{
path = rebase_path("meta/debug_agent.cmx")
dest = "debug_agent.cmx"
},
]
binary = "debug_agent"
}
executable("tests") {
testonly = true
output_name = "debug_agent_tests"
sources = [
"breakpoint_unittest.cc",
"debugged_job_unittest.cc",
"debugged_thread_unittest.cc",
"process_breakpoint_unittest.cc",
"process_info_unittests.cc",
"system_info_unittests.cc",
]
if (current_cpu == "x64") {
sources += [ "arch_x64_helpers_unittest.cc" ]
}
deps = [
":lib",
"//garnet/bin/debug_agent/integration_tests",
"//garnet/lib/debug_ipc:tests",
"//garnet/public/lib/component/cpp:environment_services",
"//garnet/public/lib/fxl/test:gtest_main",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
]
}
package("debug_agent_tests") {
testonly = true
package_name = "debug_agent_tests"
deps = [
":tests",
"//garnet/bin/debug_agent/test_data:debug_agent_so_test_exe",
"//garnet/bin/debug_agent/test_data:debug_agent_test_so",
"//garnet/bin/debug_agent/test_data:process_loop",
"//garnet/bin/debug_agent/test_data:process_spawner",
]
binaries = [{
shell = true
name = "debug_agent_so_test"
}, {
name = "process_spawner"
}, {
name = "process_loop"
}]
loadable_modules = [{
name = "debug_agent_test_so.so"
}]
tests = [{
name = "debug_agent_tests"
}]
meta = [{
path = "meta/debug_agent_tests.cmx"
dest = "debug_agent_tests.cmx"
}]
if (include_test_app) {
deps += [ ":zxdb_test_app" ]
tests += [
{
name = "zxdb_test_app"
},
]
}
}