sandboxed-api/sandboxed_api/sandbox2/unwind/BUILD.bazel
Christian Blichmann dc03c38df1 Enable stack traces on AArch64
Note that `//sandboxed_api/sandbox2:stack_trace_test` may still fail for
unrelated reasons, as we are linking libc statically, which is brittle. A
follow-up change will fix this.

PiperOrigin-RevId: 427175045
Change-Id: Ifb5ec2ac3d60f4bcc9708f26c834c83b75e769d7
2022-02-08 06:23:52 -08:00

76 lines
2.4 KiB
Python

# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
load("//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts")
load("//sandboxed_api/bazel:proto.bzl", "sapi_proto_library")
package(default_visibility = [
"//sandboxed_api/sandbox2:__subpackages__",
])
licenses(["notice"])
cc_library(
name = "ptrace_hook",
srcs = ["ptrace_hook.cc"],
hdrs = ["ptrace_hook.h"],
copts = sapi_platform_copts(),
visibility = ["@org_gnu_libunwind//:__subpackages__"],
deps = ["@com_google_absl//absl/strings"],
)
cc_library(
name = "unwind",
srcs = ["unwind.cc"],
hdrs = ["unwind.h"],
copts = sapi_platform_copts([
# TODO(cblichmann): Remove this, fix bazel/external/libunwind.BUILD
"-Iexternal/org_gnu_libunwind/include",
] + [
"-D{symbol}={symbol}_wrapped".format(symbol = symbol)
for symbol in [
"_UPT_accessors",
"_UPT_create",
"_UPT_destroy",
"_Ux86_64_create_addr_space",
"_Ux86_64_destroy_addr_space",
"_Ux86_64_get_proc_name",
"_Ux86_64_get_reg",
"_Ux86_64_init_remote",
"_Ux86_64_step",
]
]),
visibility = ["//visibility:public"],
deps = [
":ptrace_hook",
":unwind_cc_proto",
"//sandboxed_api/sandbox2:comms",
"//sandboxed_api/sandbox2/util:maps_parser",
"//sandboxed_api/sandbox2/util:minielf",
"//sandboxed_api/util:file_helpers",
"//sandboxed_api/util:raw_logging",
"//sandboxed_api/util:status",
"//sandboxed_api/util:strerror",
"@com_google_absl//absl/cleanup",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
"@org_gnu_libunwind//:unwind-ptrace-wrapped",
],
)
sapi_proto_library(
name = "unwind_proto",
srcs = ["unwind.proto"],
)