Implement malloc hooks.
Use the malloc debug framework to implement the malloc debug hooks
since it can introduce a performance issue.
Also, modify the bionic/tests/utils.h slightly to dump an error message
when the exe failed.
Bug: 30561479
Test: Ran malloc hook unit tests.
Test: Ran malloc debug unit tests.
Test: Enabled malloc hooks and ran bionic unit tests and verified no
Test: unexpected failures.
Test: Enabled malloc debug and malloc hooks and verified malloc debug wins.
Test: Enabled malloc debug using env, property, and property with name
Test: still works.
Change-Id: Ib50046a0493c5c2050cf831befb812310bdcc249
(cherry picked from commit d6a1dc23796696f73f483943534d4c5c4b312d39)
diff --git a/libc/malloc_hooks/exported64.map b/libc/malloc_hooks/exported64.map
new file mode 100644
index 0000000..5ebcf9f
--- /dev/null
+++ b/libc/malloc_hooks/exported64.map
@@ -0,0 +1,24 @@
+LIBC_MALLOC_HOOKS {
+ global:
+ hooks_aligned_alloc;
+ hooks_calloc;
+ hooks_finalize;
+ hooks_free;
+ hooks_free_malloc_leak_info;
+ hooks_get_malloc_leak_info;
+ hooks_initialize;
+ hooks_iterate;
+ hooks_mallinfo;
+ hooks_malloc;
+ hooks_malloc_backtrace;
+ hooks_malloc_disable;
+ hooks_malloc_enable;
+ hooks_malloc_usable_size;
+ hooks_mallopt;
+ hooks_memalign;
+ hooks_posix_memalign;
+ hooks_realloc;
+
+ local:
+ *;
+};