dfbc59ae51
The new object incorporates all Android specific knowledge into a single place and makes everything simpler. Fixed a bug where if backtrace_full was enabled, the AddBacktrace function would always set the size to the maximum number of frames instead of the actual number of frames. Added a new smoke system tests for backtrace_full. Modified the smoke test to do a malloc/free, so it's really a smoke test. Bug: 232575330 Test: Unit tests pass on device. Test: Verify the full backtrace actually produces valid backtraces. Test: Run bionic-unit-tests with backtrace_full enabled. Test: Run bionic-benchmarks --benchmark_filter=stdlib_malloc_free_decay1/512 Change-Id: I23128a73a8691007e1c7f69e0c99bb4dcd713db8
194 lines
4.1 KiB
Text
194 lines
4.1 KiB
Text
// ==============================================================
|
|
// libc_malloc_debug_backtrace.a
|
|
// ==============================================================
|
|
// Used by libmemunreachable
|
|
package {
|
|
// See: http://go/android-license-faq
|
|
// A large-scale-change added 'default_applicable_licenses' to import
|
|
// all of the 'license_kinds' from "bionic_libc_license"
|
|
// to get the below license kinds:
|
|
// SPDX-license-identifier-Apache-2.0
|
|
// SPDX-license-identifier-BSD
|
|
default_applicable_licenses: ["bionic_libc_license"],
|
|
}
|
|
|
|
cc_library_static {
|
|
name: "libc_malloc_debug_backtrace",
|
|
vendor_available: true,
|
|
|
|
srcs: [
|
|
"backtrace.cpp",
|
|
"MapData.cpp",
|
|
],
|
|
|
|
stl: "libc++_static",
|
|
|
|
whole_static_libs: [
|
|
"libbase",
|
|
"libasync_safe",
|
|
],
|
|
|
|
include_dirs: ["bionic/libc"],
|
|
|
|
export_include_dirs: ["."],
|
|
|
|
sanitize: {
|
|
never: true,
|
|
},
|
|
native_coverage: false,
|
|
|
|
// -Wno-error=format-zero-length needed for gcc to compile.
|
|
cflags: [
|
|
"-Wall",
|
|
"-Werror",
|
|
"-Wno-error=format-zero-length",
|
|
],
|
|
|
|
apex_available: [
|
|
"//apex_available:platform",
|
|
"com.android.runtime",
|
|
],
|
|
}
|
|
|
|
// ==============================================================
|
|
// libc_malloc_debug.so
|
|
// ==============================================================
|
|
cc_library {
|
|
name: "libc_malloc_debug",
|
|
|
|
srcs: [
|
|
"Config.cpp",
|
|
"DebugData.cpp",
|
|
"debug_disable.cpp",
|
|
"GuardData.cpp",
|
|
"malloc_debug.cpp",
|
|
"PointerData.cpp",
|
|
"RecordData.cpp",
|
|
"Unreachable.cpp",
|
|
"UnwindBacktrace.cpp",
|
|
],
|
|
|
|
stl: "libc++_static",
|
|
|
|
static_libs: [
|
|
"libasync_safe",
|
|
"libbase",
|
|
"libc_malloc_debug_backtrace",
|
|
"libmemunreachable",
|
|
],
|
|
|
|
shared_libs: [
|
|
"libunwindstack",
|
|
],
|
|
|
|
multilib: {
|
|
lib32: {
|
|
version_script: "exported32.map",
|
|
},
|
|
lib64: {
|
|
version_script: "exported64.map",
|
|
},
|
|
},
|
|
allow_undefined_symbols: true,
|
|
include_dirs: ["bionic/libc"],
|
|
|
|
sanitize: {
|
|
never: true,
|
|
},
|
|
native_coverage: false,
|
|
|
|
// -Wno-error=format-zero-length needed for gcc to compile.
|
|
cflags: [
|
|
"-Wall",
|
|
"-Werror",
|
|
"-fno-stack-protector",
|
|
"-Wno-error=format-zero-length",
|
|
"-Wthread-safety",
|
|
],
|
|
|
|
apex_available: [
|
|
"com.android.runtime",
|
|
],
|
|
static: {
|
|
apex_available: [
|
|
"//apex_available:platform",
|
|
],
|
|
},
|
|
}
|
|
|
|
// ==============================================================
|
|
// Unit Tests
|
|
// ==============================================================
|
|
cc_test {
|
|
name: "malloc_debug_unit_tests",
|
|
test_suites: ["device-tests"],
|
|
|
|
srcs: [
|
|
"tests/backtrace_fake.cpp",
|
|
"tests/log_fake.cpp",
|
|
"tests/libc_fake.cpp",
|
|
"tests/malloc_debug_config_tests.cpp",
|
|
"tests/malloc_debug_unit_tests.cpp",
|
|
],
|
|
|
|
local_include_dirs: ["tests"],
|
|
include_dirs: [
|
|
"bionic/libc",
|
|
"bionic/libc/async_safe/include",
|
|
],
|
|
|
|
header_libs: [
|
|
"bionic_libc_platform_headers",
|
|
],
|
|
|
|
static_libs: [
|
|
"libc_malloc_debug",
|
|
"libtinyxml2",
|
|
],
|
|
|
|
shared_libs: [
|
|
"libbase",
|
|
"libunwindstack",
|
|
],
|
|
|
|
cflags: [
|
|
"-Wall",
|
|
"-Werror",
|
|
"-Wno-error=format-zero-length",
|
|
"-O0",
|
|
],
|
|
}
|
|
|
|
// ==============================================================
|
|
// System Tests
|
|
// ==============================================================
|
|
cc_test {
|
|
name: "malloc_debug_system_tests",
|
|
isolated: true,
|
|
|
|
include_dirs: [
|
|
"bionic/libc",
|
|
"bionic", // For SKIP_WITH_HWASAN.
|
|
],
|
|
|
|
header_libs: [
|
|
"bionic_libc_platform_headers",
|
|
],
|
|
|
|
srcs: [
|
|
"tests/malloc_debug_system_tests.cpp",
|
|
],
|
|
|
|
shared_libs: [
|
|
"libbase",
|
|
"liblog",
|
|
"libunwindstack",
|
|
],
|
|
|
|
cflags: [
|
|
"-Wall",
|
|
"-Werror",
|
|
"-O0",
|
|
],
|
|
test_suites: ["general-tests"],
|
|
}
|