summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy McFadden <fadden@android.com>2009-07-21 15:25:23 -0700
committerAndy McFadden <fadden@android.com>2009-07-21 15:44:23 -0700
commit39f3745cf30efe38482ffead1c32f4e62f6fe32e (patch)
treec7ae2dcba7dd282d787961a641720dce723172ea
parentb56b5659b3996e98c2060f168d1cff1474e77d2a (diff)
downloadbionic-39f3745cf30efe38482ffead1c32f4e62f6fe32e.zip
bionic-39f3745cf30efe38482ffead1c32f4e62f6fe32e.tar.gz
bionic-39f3745cf30efe38482ffead1c32f4e62f6fe32e.tar.bz2
Restore malloc debug.
Some libc changes were preventing the initialization call from being made. The basic problem appears to be that libc_init_common.c is only built once, and it's only built for the non-debug libc.
-rw-r--r--libc/bionic/libc_init_common.c9
-rw-r--r--libc/bionic/libc_init_dynamic.c7
-rw-r--r--libc/bionic/libc_init_static.c6
-rw-r--r--libc/bionic/malloc_leak.c15
4 files changed, 21 insertions, 16 deletions
diff --git a/libc/bionic/libc_init_common.c b/libc/bionic/libc_init_common.c
index c77c162..d78d673 100644
--- a/libc/bionic/libc_init_common.c
+++ b/libc/bionic/libc_init_common.c
@@ -52,10 +52,6 @@ unsigned int __page_shift = PAGE_SHIFT;
int __system_properties_init(void);
-#ifdef MALLOCK_LEAK_CHECK
-void malloc_debug_init(void);
-#endif
-
void __libc_init_common(uintptr_t *elfdata)
{
int argc = *elfdata;
@@ -87,9 +83,4 @@ void __libc_init_common(uintptr_t *elfdata)
/* setup system properties - requires environment */
__system_properties_init();
-
- /* setup malloc leak checker, requires system properties */
-#if MALLOC_LEAK_CHECK
- malloc_debug_init();
-#endif
}
diff --git a/libc/bionic/libc_init_dynamic.c b/libc/bionic/libc_init_dynamic.c
index b8e1078..b479b27 100644
--- a/libc/bionic/libc_init_dynamic.c
+++ b/libc/bionic/libc_init_dynamic.c
@@ -77,6 +77,13 @@ void __libc_prenit(void)
tls_area[TLS_SLOT_BIONIC_PREINIT] = NULL;
__libc_init_common(elfdata);
+
+#ifdef MALLOC_LEAK_CHECK
+ /* setup malloc leak checker, requires system properties */
+ extern void malloc_debug_init(void);
+ malloc_debug_init();
+#endif
+
}
__noreturn void __libc_init(uintptr_t *elfdata,
diff --git a/libc/bionic/libc_init_static.c b/libc/bionic/libc_init_static.c
index d097b6b..e6264bb 100644
--- a/libc/bionic/libc_init_static.c
+++ b/libc/bionic/libc_init_static.c
@@ -68,6 +68,12 @@ __noreturn void __libc_init(uintptr_t *elfdata,
/* Initialize the C runtime environment */
__libc_init_common(elfdata);
+#ifdef MALLOC_LEAK_CHECK
+ /* setup malloc leak checker, requires system properties */
+ extern void malloc_debug_init(void);
+ malloc_debug_init();
+#endif
+
/* Several Linux ABIs don't pass the onexit pointer, and the ones that
* do never use it. Therefore, we ignore it.
*/
diff --git a/libc/bionic/malloc_leak.c b/libc/bionic/malloc_leak.c
index df09424..305f954 100644
--- a/libc/bionic/malloc_leak.c
+++ b/libc/bionic/malloc_leak.c
@@ -91,7 +91,14 @@ static pthread_mutex_t gAllocationsMutex = PTHREAD_MUTEX_INITIALIZER;
static HashTable gHashTable;
// =============================================================================
-// output fucntions
+// log functions
+// =============================================================================
+
+#define debug_log(format, ...) \
+ __libc_android_log_print(ANDROID_LOG_DEBUG, "malloc_leak", (format), ##__VA_ARGS__ )
+
+// =============================================================================
+// output functions
// =============================================================================
static int hash_entry_compare(const void* arg1, const void* arg2)
@@ -257,12 +264,6 @@ struct AllocationEntry {
uint32_t guard;
};
-// =============================================================================
-// log funtions
-// =============================================================================
-
-#define debug_log(format, ...) \
- __libc_android_log_print(ANDROID_LOG_DEBUG, "malloc_leak", (format), ##__VA_ARGS__ )
// =============================================================================
// Hash Table functions