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
diff --git a/libc/malloc_debug/Android.bp b/libc/malloc_debug/Android.bp
index 0cb4cca..01f42b7 100644
--- a/libc/malloc_debug/Android.bp
+++ b/libc/malloc_debug/Android.bp
@@ -142,3 +142,26 @@
"-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",
+ ],
+}