platform_bionic/libc/malloc_debug/Android.bp
Christopher Ferris 97b4747102 Disable malloc debug intercepts when exiting.
There is a hang when enabling leak_track since the dumping of the
leak data can wind up doing an allocation.

Add new system unit test to make sure this doesn't happen again.

Bug: 111146059

Test: Test program that leaks does not hang forever.
Test: Unit tests pass.
Change-Id: Icf99be58ba5db98ee124a471b957a086045f5870
2018-07-11 15:23:00 -07:00

167 lines
3.5 KiB
Text

// ==============================================================
// libc_malloc_debug_backtrace.a
// ==============================================================
// Used by libmemunreachable
cc_library_static {
name: "libc_malloc_debug_backtrace",
srcs: [
"backtrace.cpp",
"MapData.cpp",
],
stl: "libc++_static",
whole_static_libs: [
"libbase",
"libasync_safe",
"libdemangle",
],
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",
],
}
// ==============================================================
// 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",
"UnwindBacktrace.cpp",
],
stl: "libc++_static",
// Only need this for arm since libc++ uses its own unwind code that
// doesn't mix with the other default unwind code.
arch: {
arm: {
static_libs: ["libunwind_llvm"],
},
},
// Clang lld link flags do not work with special link rules
// for libunwind_llvm yet. Linked aosp_arm-eng image failed to
// boot up in the emulator. http://b/78118944.
use_clang_lld: false,
static_libs: [
"libasync_safe",
"libbase",
"libdemangle",
"libc_malloc_debug_backtrace",
],
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",
],
}
// ==============================================================
// Unit Tests
// ==============================================================
cc_test {
name: "malloc_debug_unit_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",
],
static_libs: [
"libc_malloc_debug",
"libdemangle",
],
shared_libs: [
"libbase",
"libunwindstack",
],
cflags: [
"-Wall",
"-Werror",
"-Wno-error=format-zero-length",
"-O0",
],
}
// ==============================================================
// System Tests
// ==============================================================
cc_test {
name: "malloc_debug_system_tests",
srcs: [
"tests/malloc_debug_system_tests.cpp",
],
shared_libs: [
"libbase",
"liblog",
"libunwindstack",
],
cflags: [
"-Wall",
"-Werror",
"-O0",
],
}