platform_bionic/libc/malloc_debug/Android.bp
Tamas Berghammer ac81fe8657 Enable malloc debug using environment variables
Previously malloc debug can be enabled only using global settings
accessible to the root user only. This CL adds a new option to enable
it using environment variables making it possible to use it with pure
native (shell) applications on production builds (from shell user) and
prepares it for using it from logwrapper on production devices.

Remove the old environment variable and property since they are not
necessary.

Test: Enable malloc debug using environment variable and verify
Test: that it only affects the commands launched from the shell.
Test: Enable malloc debug using the property variable and verify
Test: that it affects all commands.
Test: Run all unit tests in 32 bit and 64 bit.
Change-Id: Iecb75a3471552f619f196ad550c5f41fcd9ce8e5
2016-11-17 13:13:27 -08:00

131 lines
2.7 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",
static_libs: ["libc_logging"],
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: [
"BacktraceData.cpp",
"Config.cpp",
"DebugData.cpp",
"debug_disable.cpp",
"FreeTrackData.cpp",
"GuardData.cpp",
"malloc_debug.cpp",
"RecordData.cpp",
"TrackData.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"],
},
},
static_libs: [
"libbase",
"libc_malloc_debug_backtrace",
"libc_logging",
],
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",
],
}
// ==============================================================
// Unit Tests
// ==============================================================
cc_test {
name: "malloc_debug_unit_tests",
multilib: {
lib32: {
suffix: "32",
},
lib64: {
suffix: "64",
},
},
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",
],
whole_static_libs: ["libc_malloc_debug"],
local_include_dirs: ["tests"],
include_dirs: ["bionic/libc"],
shared_libs: ["libbase"],
cflags: [
"-Wall",
"-Werror",
"-Wno-error=format-zero-length",
],
}