Use libunwindbacktrace for debug malloc code.
Create a method of disabling the debug allocation code paths so that
it's possible to use the libunwindbacktrace library without any
modifications.
Use this path to create and destroy the maps for the process. It's not
stricly necessary in the init code since the symbols are not modified
until after the initialize calls.
Also, remove the debug_XXX source files that doesn't need to be in libc.so.
Fix the maps reading code since it was completely broken for 64 bit.
Bug: 16408686
Change-Id: I6b02ef6ce26fdb7a59ad1029e7cbba9accceb704
diff --git a/libc/Android.mk b/libc/Android.mk
index 15a68b9..9554e18 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -980,8 +980,6 @@
$(libc_arch_dynamic_src_files) \
$(libc_static_common_src_files) \
bionic/malloc_debug_common.cpp \
- bionic/debug_mapinfo.cpp \
- bionic/debug_stacktrace.cpp \
bionic/libc_init_dynamic.cpp \
bionic/NetdClient.cpp \
@@ -1047,7 +1045,10 @@
LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
LOCAL_CPPFLAGS := $(libc_common_cppflags)
-LOCAL_C_INCLUDES := $(libc_common_c_includes)
+# Make sure that unwind.h comes from libunwind.
+LOCAL_C_INCLUDES := \
+ external/libunwind/include \
+ $(libc_common_c_includes) \
LOCAL_SRC_FILES := \
bionic/debug_mapinfo.cpp \
@@ -1062,6 +1063,7 @@
LOCAL_SHARED_LIBRARIES := libc libdl
LOCAL_SYSTEM_SHARED_LIBRARIES :=
+LOCAL_WHOLE_STATIC_LIBRARIES := libunwindbacktrace
LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
# Don't install on release build