2020-01-17 21:05:03 +08:00
|
|
|
# Copyright 2019 Google LLC
|
2019-03-19 00:21:48 +08:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
# http://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.
|
|
|
|
|
2020-07-17 18:20:18 +08:00
|
|
|
load("//sandboxed_api/bazel:build_defs.bzl", "sapi_platform_copts")
|
|
|
|
load("//sandboxed_api/bazel:proto.bzl", "sapi_proto_library")
|
|
|
|
|
2019-03-19 00:21:48 +08:00
|
|
|
package(default_visibility = [
|
|
|
|
"//sandboxed_api/sandbox2:__subpackages__",
|
|
|
|
])
|
|
|
|
|
|
|
|
licenses(["notice"]) # Apache 2.0
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "ptrace_hook",
|
|
|
|
srcs = ["ptrace_hook.cc"],
|
|
|
|
hdrs = ["ptrace_hook.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts(),
|
2020-07-17 18:20:18 +08:00
|
|
|
visibility = ["@org_gnu_libunwind//:__subpackages__"],
|
2021-04-22 21:56:22 +08:00
|
|
|
deps = ["@com_google_absl//absl/strings"],
|
2019-03-19 00:21:48 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "unwind",
|
|
|
|
srcs = ["unwind.cc"],
|
|
|
|
hdrs = ["unwind.h"],
|
2019-05-09 20:21:11 +08:00
|
|
|
copts = sapi_platform_copts([
|
2019-03-19 00:21:48 +08:00
|
|
|
# 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",
|
2019-05-06 20:03:29 +08:00
|
|
|
"_UPT_create",
|
2019-03-19 00:21:48 +08:00
|
|
|
"_UPT_destroy",
|
|
|
|
"_Ux86_64_create_addr_space",
|
|
|
|
"_Ux86_64_destroy_addr_space",
|
|
|
|
"_Ux86_64_get_proc_name",
|
|
|
|
"_Ux86_64_get_reg",
|
2019-05-06 20:03:29 +08:00
|
|
|
"_Ux86_64_init_remote",
|
|
|
|
"_Ux86_64_step",
|
2019-03-19 00:21:48 +08:00
|
|
|
]
|
2019-05-09 20:21:11 +08:00
|
|
|
]),
|
2019-03-19 00:21:48 +08:00
|
|
|
deps = [
|
2020-07-17 18:20:18 +08:00
|
|
|
":ptrace_hook",
|
2019-09-25 22:13:33 +08:00
|
|
|
":unwind_cc_proto",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/sandbox2:comms",
|
|
|
|
"//sandboxed_api/sandbox2/util:maps_parser",
|
|
|
|
"//sandboxed_api/sandbox2/util:minielf",
|
2021-04-28 22:48:48 +08:00
|
|
|
"//sandboxed_api/util:file_helpers",
|
2019-03-19 00:21:48 +08:00
|
|
|
"//sandboxed_api/util:raw_logging",
|
2021-06-28 17:02:35 +08:00
|
|
|
"//sandboxed_api/util:status",
|
2021-01-14 01:25:25 +08:00
|
|
|
"//sandboxed_api/util:strerror",
|
2021-06-28 17:02:35 +08:00
|
|
|
"@com_google_absl//absl/status:statusor",
|
2019-03-19 00:21:48 +08:00
|
|
|
"@com_google_absl//absl/strings",
|
|
|
|
"@org_gnu_libunwind//:unwind-ptrace-wrapped",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
sapi_proto_library(
|
|
|
|
name = "unwind_proto",
|
|
|
|
srcs = ["unwind.proto"],
|
|
|
|
)
|