blob: 792d7d411387bdcc0ec672b4588cd5943794a7fe [file] [log] [blame]
# Copyright 2021 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/components.gni")
import("//build/cpp/sdk_source_set.gni")
import("//build/test.gni")
sdk_source_set("unwinder") {
category = "internal"
build_as_static = true
public = [
"cfi_module.h",
"cfi_parser.h",
"dwarf_expr.h",
"error.h",
"memory.h",
"module.h",
"platform.h",
"registers.h",
"unwind.h",
]
sdk_headers_for_internal_use = [
"cfi_module.h",
"cfi_parser.h",
"cfi_unwinder.h",
"dwarf_expr.h",
"fp_unwinder.h",
"plt_unwinder.h",
"scs_unwinder.h",
]
sources = [
"cfi_module.cc",
"cfi_parser.cc",
"cfi_unwinder.cc",
"dwarf_expr.cc",
"error.cc",
"fp_unwinder.cc",
"memory.cc",
"plt_unwinder.cc",
"registers.cc",
"scs_unwinder.cc",
"unwind.cc",
]
deps = []
friend = [ ":tests" ]
if (is_mac) {
deps += [ "//src/developer/debug/shared:elf_h_on_mac" ]
} else {
# UnwindLocal() is only available on ELF systems.
public += [
"third_party/libunwindstack/context.h",
"unwind_local.h",
]
sdk_headers_for_internal_use += [ "third_party/libunwindstack/context.h" ]
sources += [ "unwind_local.cc" ]
if (current_cpu == "x64") {
sources += [ "third_party/libunwindstack/context_x86_64.S" ]
}
}
if (is_fuchsia) {
public += [ "fuchsia.h" ]
sources += [ "fuchsia.cc" ]
} else if (is_linux) {
public += [ "linux.h" ]
sources += [ "linux.cc" ]
}
}
test("unwinder_tests_bin") {
output_name = "unwinder_tests"
sources = [
"dwarf_expr_unittest.cc",
"memory_unittest.cc",
]
deps = [
":unwinder",
"//src/lib/fxl/test:gtest_main",
"//third_party/googletest:gtest",
]
if (!is_mac) {
deps += [ "tests" ]
}
}
fuchsia_unittest_package("unwinder_tests") {
deps = [ ":unwinder_tests_bin" ]
}
group("tests") {
testonly = true
deps = [
":unwinder_tests",
":unwinder_tests_bin($host_toolchain)",
]
}