602 lines
16 KiB
Plaintext
602 lines
16 KiB
Plaintext
//
|
|
// Copyright (C) 2017 The Android Open Source Project
|
|
//
|
|
// 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.
|
|
//
|
|
|
|
package {
|
|
default_applicable_licenses: [
|
|
"Android-Apache-2.0",
|
|
"system_unwinding_libunwindstack_license",
|
|
],
|
|
}
|
|
|
|
license {
|
|
name: "system_unwinding_libunwindstack_license",
|
|
visibility: [":__subpackages__"],
|
|
license_kinds: [
|
|
"SPDX-license-identifier-BSD",
|
|
],
|
|
license_text: ["LICENSE_BSD"],
|
|
}
|
|
|
|
cc_defaults {
|
|
name: "libunwindstack_flags",
|
|
|
|
host_supported: true,
|
|
|
|
cflags: [
|
|
"-Wall",
|
|
"-Werror",
|
|
"-Wextra",
|
|
],
|
|
|
|
target: {
|
|
darwin: {
|
|
enabled: false,
|
|
},
|
|
linux_bionic: {
|
|
enabled: true,
|
|
},
|
|
},
|
|
}
|
|
|
|
libunwindstack_common_src_files = [
|
|
"AndroidUnwinder.cpp",
|
|
"ArmExidx.cpp",
|
|
"DexFiles.cpp",
|
|
"DwarfCfa.cpp",
|
|
"DwarfEhFrameWithHdr.cpp",
|
|
"DwarfMemory.cpp",
|
|
"DwarfOp.cpp",
|
|
"DwarfSection.cpp",
|
|
"Elf.cpp",
|
|
"ElfInterface.cpp",
|
|
"ElfInterfaceArm.cpp",
|
|
"Global.cpp",
|
|
"JitDebug.cpp",
|
|
"MapInfo.cpp",
|
|
"Maps.cpp",
|
|
"Memory.cpp",
|
|
"MemoryMte.cpp",
|
|
"MemoryXz.cpp",
|
|
"Regs.cpp",
|
|
"RegsArm.cpp",
|
|
"RegsArm64.cpp",
|
|
"RegsX86.cpp",
|
|
"RegsX86_64.cpp",
|
|
"RegsMips.cpp",
|
|
"RegsMips64.cpp",
|
|
"Symbols.cpp",
|
|
"ThreadEntry.cpp",
|
|
"ThreadUnwinder.cpp",
|
|
"Unwinder.cpp",
|
|
]
|
|
|
|
cc_defaults {
|
|
name: "libunwindstack_defaults",
|
|
defaults: ["libunwindstack_flags"],
|
|
export_include_dirs: ["include"],
|
|
|
|
srcs: libunwindstack_common_src_files,
|
|
|
|
cflags: [
|
|
"-Wexit-time-destructors",
|
|
"-fno-c++-static-destructors",
|
|
],
|
|
|
|
target: {
|
|
host: {
|
|
// Always disable optimizations for host to make it easier to debug.
|
|
cflags: [
|
|
"-O0",
|
|
"-g",
|
|
],
|
|
},
|
|
bionic: {
|
|
header_libs: ["bionic_libc_platform_headers"],
|
|
static_libs: ["libasync_safe"],
|
|
},
|
|
},
|
|
|
|
arch: {
|
|
x86: {
|
|
srcs: ["AsmGetRegsX86.S"],
|
|
},
|
|
x86_64: {
|
|
srcs: ["AsmGetRegsX86_64.S"],
|
|
},
|
|
},
|
|
|
|
static_libs: [
|
|
"libprocinfo",
|
|
],
|
|
|
|
shared_libs: [
|
|
"libbase",
|
|
"liblog",
|
|
"liblzma",
|
|
],
|
|
}
|
|
|
|
cc_library {
|
|
name: "libunwindstack",
|
|
vendor_available: true,
|
|
product_available: true,
|
|
recovery_available: true,
|
|
vendor_ramdisk_available: true,
|
|
// TODO(b/153609531): remove when no longer needed.
|
|
native_bridge_supported: true,
|
|
vndk: {
|
|
enabled: true,
|
|
support_system_process: true,
|
|
},
|
|
defaults: ["libunwindstack_defaults"],
|
|
srcs: [
|
|
"DexFile.cpp",
|
|
"LogAndroid.cpp",
|
|
],
|
|
cflags: ["-DDEXFILE_SUPPORT"],
|
|
static_libs: ["libdexfile_support"],
|
|
runtime_libs: ["libdexfile"], // libdexfile_support dependency
|
|
|
|
target: {
|
|
vendor: {
|
|
cflags: ["-UDEXFILE_SUPPORT"],
|
|
exclude_srcs: ["DexFile.cpp"],
|
|
exclude_static_libs: ["libdexfile_support"],
|
|
exclude_runtime_libs: ["libdexfile"],
|
|
},
|
|
product: {
|
|
cflags: ["-UDEXFILE_SUPPORT"],
|
|
exclude_srcs: ["DexFile.cpp"],
|
|
exclude_static_libs: ["libdexfile_support"],
|
|
exclude_runtime_libs: ["libdexfile"],
|
|
},
|
|
recovery: {
|
|
cflags: ["-UDEXFILE_SUPPORT"],
|
|
exclude_srcs: ["DexFile.cpp"],
|
|
exclude_static_libs: ["libdexfile_support"],
|
|
exclude_runtime_libs: ["libdexfile"],
|
|
},
|
|
vendor_ramdisk: {
|
|
cflags: ["-UDEXFILE_SUPPORT"],
|
|
exclude_srcs: ["DexFile.cpp"],
|
|
exclude_static_libs: ["libdexfile_support"],
|
|
exclude_runtime_libs: ["libdexfile"],
|
|
},
|
|
native_bridge: {
|
|
cflags: ["-UDEXFILE_SUPPORT"],
|
|
exclude_srcs: ["DexFile.cpp"],
|
|
exclude_static_libs: ["libdexfile_support"],
|
|
exclude_runtime_libs: ["libdexfile"],
|
|
},
|
|
},
|
|
|
|
apex_available: [
|
|
"//apex_available:platform",
|
|
"com.android.art",
|
|
"com.android.art.debug",
|
|
],
|
|
min_sdk_version: "29",
|
|
}
|
|
|
|
// Make sure that the code can be compiled without Android Logging.
|
|
cc_library {
|
|
name: "libunwindstack_stdout_log",
|
|
defaults: ["libunwindstack_defaults"],
|
|
srcs: [
|
|
"LogStdout.cpp",
|
|
],
|
|
}
|
|
|
|
// Static library without DEX support to avoid dependencies on the ART APEX.
|
|
cc_library_static {
|
|
name: "libunwindstack_no_dex",
|
|
ramdisk_available: true,
|
|
recovery_available: true,
|
|
vendor_ramdisk_available: true,
|
|
defaults: ["libunwindstack_defaults"],
|
|
srcs: ["LogAndroid.cpp"],
|
|
|
|
visibility: [
|
|
"//external/gwp_asan",
|
|
"//system/core/debuggerd",
|
|
"//system/core/init",
|
|
"//system/unwinding/libbacktrace",
|
|
],
|
|
apex_available: [
|
|
"//apex_available:platform",
|
|
"com.android.runtime",
|
|
],
|
|
}
|
|
|
|
//-------------------------------------------------------------------------
|
|
// Utils
|
|
//-------------------------------------------------------------------------
|
|
cc_library {
|
|
name: "libunwindstack_utils",
|
|
defaults: ["libunwindstack_flags"],
|
|
export_include_dirs: ["utils"],
|
|
shared_libs: [
|
|
"libbase",
|
|
"libunwindstack",
|
|
"libprocinfo",
|
|
],
|
|
whole_static_libs: [
|
|
"libc++fs",
|
|
"libz",
|
|
],
|
|
srcs: [
|
|
"utils/MemoryFake.cpp",
|
|
"utils/OfflineUnwindUtils.cpp",
|
|
"utils/PidUtils.cpp",
|
|
"utils/ProcessTracer.cpp",
|
|
],
|
|
}
|
|
|
|
//-------------------------------------------------------------------------
|
|
// Unit Tests
|
|
//-------------------------------------------------------------------------
|
|
cc_library_shared {
|
|
name: "libunwindstack_local",
|
|
defaults: ["libunwindstack_flags"],
|
|
srcs: ["tests/TestLocal.cpp"],
|
|
|
|
cflags: [
|
|
"-O0",
|
|
"-g",
|
|
],
|
|
|
|
shared_libs: [
|
|
"libunwindstack",
|
|
],
|
|
}
|
|
|
|
cc_defaults {
|
|
name: "libunwindstack_testlib_flags",
|
|
defaults: ["libunwindstack_flags"],
|
|
|
|
srcs: [
|
|
"tests/AndroidUnwinderTest.cpp",
|
|
"tests/ArmExidxDecodeTest.cpp",
|
|
"tests/ArmExidxExtractTest.cpp",
|
|
"tests/DexFileTest.cpp",
|
|
"tests/DexFilesTest.cpp",
|
|
"tests/DwarfCfaLogTest.cpp",
|
|
"tests/DwarfCfaTest.cpp",
|
|
"tests/DwarfDebugFrameTest.cpp",
|
|
"tests/DwarfEhFrameTest.cpp",
|
|
"tests/DwarfEhFrameWithHdrTest.cpp",
|
|
"tests/DwarfMemoryTest.cpp",
|
|
"tests/DwarfOpLogTest.cpp",
|
|
"tests/DwarfOpTest.cpp",
|
|
"tests/DwarfSectionTest.cpp",
|
|
"tests/DwarfSectionImplTest.cpp",
|
|
"tests/ElfCacheTest.cpp",
|
|
"tests/ElfFake.cpp",
|
|
"tests/ElfInterfaceArmTest.cpp",
|
|
"tests/ElfInterfaceTest.cpp",
|
|
"tests/ElfTest.cpp",
|
|
"tests/ElfTestUtils.cpp",
|
|
"tests/GlobalDebugImplTest.cpp",
|
|
"tests/GlobalTest.cpp",
|
|
"tests/IsolatedSettings.cpp",
|
|
"tests/JitDebugTest.cpp",
|
|
"tests/LocalUpdatableMapsTest.cpp",
|
|
"tests/LogFake.cpp",
|
|
"tests/MapInfoCreateMemoryTest.cpp",
|
|
"tests/MapInfoGetBuildIDTest.cpp",
|
|
"tests/MapInfoGetElfTest.cpp",
|
|
"tests/MapInfoGetLoadBiasTest.cpp",
|
|
"tests/MapInfoTest.cpp",
|
|
"tests/MapsTest.cpp",
|
|
"tests/MemoryBufferTest.cpp",
|
|
"tests/MemoryCacheTest.cpp",
|
|
"tests/MemoryFileTest.cpp",
|
|
"tests/MemoryLocalTest.cpp",
|
|
"tests/MemoryOfflineBufferTest.cpp",
|
|
"tests/MemoryOfflineTest.cpp",
|
|
"tests/MemoryRangeTest.cpp",
|
|
"tests/MemoryRangesTest.cpp",
|
|
"tests/MemoryRemoteTest.cpp",
|
|
"tests/MemoryTest.cpp",
|
|
"tests/MemoryThreadCacheTest.cpp",
|
|
"tests/MemoryMteTest.cpp",
|
|
"tests/MemoryXzTest.cpp",
|
|
"tests/RegsInfoTest.cpp",
|
|
"tests/RegsIterateTest.cpp",
|
|
"tests/RegsRemoteTest.cpp",
|
|
"tests/RegsStepIfSignalHandlerTest.cpp",
|
|
"tests/RegsTest.cpp",
|
|
"tests/SymbolsTest.cpp",
|
|
"tests/TestUtils.cpp",
|
|
"tests/UnwindOfflineTest.cpp",
|
|
"tests/UnwindTest.cpp",
|
|
"tests/UnwinderTest.cpp",
|
|
"tests/VerifyBionicTerminationTest.cpp",
|
|
"utils/tests/ProcessTracerTest.cpp",
|
|
],
|
|
|
|
cflags: [
|
|
"-O0",
|
|
"-g",
|
|
],
|
|
|
|
shared_libs: [
|
|
"libbase",
|
|
"liblog",
|
|
"liblzma",
|
|
"libunwindstack",
|
|
],
|
|
|
|
static_libs: [
|
|
"libdexfile_support",
|
|
"libgmock",
|
|
"libprocinfo",
|
|
"libunwindstack_utils",
|
|
],
|
|
|
|
test_suites: ["device-tests"],
|
|
data: [
|
|
"tests/files/boot_arm.oat.gnu_debugdata",
|
|
"tests/files/boot_arm.oat.gnu_debugdata.xz",
|
|
"tests/files/boot_arm.oat.gnu_debugdata.xz.non-power",
|
|
"tests/files/boot_arm.oat.gnu_debugdata.xz.odd-sizes",
|
|
"tests/files/boot_arm.oat.gnu_debugdata.xz.one-block",
|
|
"tests/files/elf32.xz",
|
|
"tests/files/elf64.xz",
|
|
"offline_files/common/*",
|
|
"offline_files/apk_rorx_arm64/*",
|
|
"offline_files/apk_rorx_unreadable_arm64/*",
|
|
"offline_files/apk_rx_arm64/*",
|
|
"offline_files/apk_rx_unreadable_arm64/*",
|
|
"offline_files/apk_soname_at_end_arm64/*",
|
|
"offline_files/art_quick_osr_stub_arm/*",
|
|
"offline_files/bad_eh_frame_hdr_arm64/*",
|
|
"offline_files/debug_frame_first_x86/*",
|
|
"offline_files/debug_frame_load_bias_arm/*",
|
|
"offline_files/eh_frame_bias_x86/*",
|
|
"offline_files/eh_frame_hdr_begin_x86_64/*",
|
|
"offline_files/empty_arm64/*",
|
|
"offline_files/invalid_elf_offset_arm/*",
|
|
"offline_files/jit_debug_arm/*",
|
|
"offline_files/jit_map_arm/*",
|
|
"offline_files/gnu_debugdata_arm/*",
|
|
"offline_files/load_bias_different_section_bias_arm64/*",
|
|
"offline_files/load_bias_ro_rx_x86_64/*",
|
|
"offline_files/offset_arm/*",
|
|
"offline_files/pauth_pc_arm64/*",
|
|
"offline_files/shared_lib_in_apk_arm64/*",
|
|
"offline_files/shared_lib_in_apk_memory_only_arm64/*",
|
|
"offline_files/shared_lib_in_apk_single_map_arm64/*",
|
|
"offline_files/signal_load_bias_arm/*",
|
|
"offline_files/signal_fde_x86/*",
|
|
"offline_files/signal_fde_x86_64/*",
|
|
"offline_files/straddle_arm/*",
|
|
"offline_files/jit_debug_x86/*",
|
|
"offline_files/straddle_arm64/*",
|
|
"offline_files/bluetooth_arm64/pc_1/*",
|
|
"offline_files/bluetooth_arm64/pc_2/*",
|
|
"offline_files/bluetooth_arm64/pc_3/*",
|
|
"offline_files/bluetooth_arm64/pc_4/*",
|
|
"offline_files/photos_reset_arm64/*",
|
|
"offline_files/youtube_compiled_arm64/*",
|
|
"offline_files/yt_music_arm64/*",
|
|
"offline_files/maps_compiled_arm64/28613_main-thread/*",
|
|
"offline_files/maps_compiled_arm64/28644/*",
|
|
"offline_files/maps_compiled_arm64/28648/*",
|
|
"offline_files/maps_compiled_arm64/28656_oat_odex_jar/*",
|
|
"offline_files/maps_compiled_arm64/28667/*",
|
|
],
|
|
|
|
target: {
|
|
android: {
|
|
header_libs: ["bionic_libc_platform_headers"],
|
|
},
|
|
linux_bionic: {
|
|
header_libs: ["bionic_libc_platform_headers"],
|
|
},
|
|
},
|
|
}
|
|
|
|
cc_test {
|
|
name: "libunwindstack_unit_test",
|
|
defaults: ["libunwindstack_testlib_flags"],
|
|
isolated: true,
|
|
data: [
|
|
":libunwindstack_local",
|
|
],
|
|
}
|
|
|
|
//-------------------------------------------------------------------------
|
|
// Fuzzers
|
|
//-------------------------------------------------------------------------
|
|
cc_defaults {
|
|
name: "libunwindstack_fuzz_defaults",
|
|
host_supported: true,
|
|
defaults: ["libunwindstack_flags"],
|
|
cflags: [
|
|
"-Wexit-time-destructors",
|
|
"-fno-c++-static-destructors",
|
|
"-g",
|
|
],
|
|
shared_libs: [
|
|
"libbase",
|
|
"liblog",
|
|
"liblzma",
|
|
"libunwindstack",
|
|
],
|
|
static_libs: [
|
|
"libdexfile_support",
|
|
"libunwindstack_utils",
|
|
],
|
|
}
|
|
|
|
cc_fuzz {
|
|
name: "libunwindstack_fuzz_unwinder",
|
|
defaults: ["libunwindstack_fuzz_defaults"],
|
|
srcs: [
|
|
"tests/ElfFake.cpp",
|
|
"tests/fuzz/UnwinderComponentCreator.cpp",
|
|
"tests/fuzz/UnwinderFuzz.cpp",
|
|
],
|
|
}
|
|
|
|
//-------------------------------------------------------------------------
|
|
// Tools
|
|
//-------------------------------------------------------------------------
|
|
cc_defaults {
|
|
name: "libunwindstack_tools",
|
|
defaults: ["libunwindstack_flags"],
|
|
|
|
shared_libs: [
|
|
"libunwindstack_stdout_log",
|
|
"libbase",
|
|
"liblzma",
|
|
],
|
|
target: {
|
|
// Always disable optimizations for host to make it easier to debug.
|
|
host: {
|
|
cflags: [
|
|
"-O0",
|
|
"-g",
|
|
],
|
|
},
|
|
},
|
|
}
|
|
|
|
cc_binary {
|
|
name: "unwind",
|
|
defaults: ["libunwindstack_tools"],
|
|
|
|
srcs: [
|
|
"tools/unwind.cpp",
|
|
],
|
|
}
|
|
|
|
cc_binary {
|
|
name: "unwind_info",
|
|
defaults: ["libunwindstack_tools"],
|
|
|
|
srcs: [
|
|
"tools/unwind_info.cpp",
|
|
],
|
|
}
|
|
|
|
cc_binary {
|
|
name: "unwind_symbols",
|
|
defaults: ["libunwindstack_tools"],
|
|
|
|
srcs: [
|
|
"tools/unwind_symbols.cpp",
|
|
],
|
|
}
|
|
|
|
cc_binary {
|
|
name: "unwind_for_offline",
|
|
defaults: ["libunwindstack_tools"],
|
|
static_libs: [
|
|
"libunwindstack_utils",
|
|
"libc++fs",
|
|
],
|
|
|
|
srcs: [
|
|
"tools/unwind_for_offline.cpp",
|
|
],
|
|
}
|
|
|
|
cc_binary {
|
|
name: "unwind_reg_info",
|
|
defaults: ["libunwindstack_tools"],
|
|
|
|
srcs: [
|
|
"tools/unwind_reg_info.cpp",
|
|
],
|
|
}
|
|
|
|
//-------------------------------------------------------------------------
|
|
// Benchmarks
|
|
//-------------------------------------------------------------------------
|
|
cc_benchmark {
|
|
name: "unwind_benchmarks",
|
|
host_supported: true,
|
|
defaults: ["libunwindstack_flags"],
|
|
|
|
// Disable optimizations so that all of the calls are not optimized away.
|
|
cflags: [
|
|
"-O0",
|
|
],
|
|
|
|
srcs: [
|
|
"benchmarks/ElfBenchmark.cpp",
|
|
"benchmarks/MapsBenchmark.cpp",
|
|
"benchmarks/SymbolBenchmark.cpp",
|
|
"benchmarks/Utils.cpp",
|
|
"benchmarks/local_unwind_benchmarks.cpp",
|
|
"benchmarks/main.cpp",
|
|
"benchmarks/remote_unwind_benchmarks.cpp",
|
|
"benchmarks/thread_unwind_benchmarks.cpp",
|
|
"benchmarks/OfflineUnwindBenchmarks.cpp",
|
|
"benchmarks/EvalBenchmark.cpp",
|
|
],
|
|
|
|
data: [
|
|
"benchmarks/files/*",
|
|
"offline_files/common/*",
|
|
"offline_files/jit_debug_arm/*",
|
|
"offline_files/straddle_arm64/*",
|
|
"offline_files/bluetooth_arm64/pc_1/*",
|
|
"offline_files/bluetooth_arm64/pc_2/*",
|
|
"offline_files/bluetooth_arm64/pc_3/*",
|
|
"offline_files/bluetooth_arm64/pc_4/*",
|
|
"offline_files/photos_reset_arm64/*",
|
|
"offline_files/youtube_compiled_arm64/*",
|
|
"offline_files/yt_music_arm64/*",
|
|
"offline_files/maps_compiled_arm64/28613_main-thread/*",
|
|
"offline_files/maps_compiled_arm64/28644/*",
|
|
"offline_files/maps_compiled_arm64/28648/*",
|
|
"offline_files/maps_compiled_arm64/28656_oat_odex_jar/*",
|
|
"offline_files/maps_compiled_arm64/28667/*",
|
|
],
|
|
|
|
shared_libs: [
|
|
"libbase",
|
|
"libunwindstack",
|
|
],
|
|
|
|
static_libs: [
|
|
"libunwindstack_utils",
|
|
"libprocinfo",
|
|
],
|
|
|
|
target: {
|
|
android: {
|
|
static_libs: [
|
|
"libmeminfo",
|
|
],
|
|
},
|
|
},
|
|
}
|
|
|
|
// Generates the elf data for use in the tests for .gnu_debugdata frames.
|
|
// Once these files are generated, use the xz command to compress the data.
|
|
cc_binary_host {
|
|
name: "gen_gnudebugdata",
|
|
defaults: ["libunwindstack_flags"],
|
|
|
|
srcs: [
|
|
"tests/GenGnuDebugdata.cpp",
|
|
],
|
|
}
|