[llvm-commits] [compiler-rt] r163690 - /compiler-rt/trunk/lib/asan/asan_malloc_mac.cc

Alexander Potapenko glider at google.com
Wed Sep 12 02:38:52 PDT 2012


Author: glider
Date: Wed Sep 12 04:38:51 2012
New Revision: 163690

URL: http://llvm.org/viewvc/llvm-project?rev=163690&view=rev
Log:
Initial support for malloc_zone_statistics. All counters are set to zero now.
This is required to overcome a crash in mstats() (http://code.google.com/p/address-sanitizer/issues/detail?id=109)

Modified:
    compiler-rt/trunk/lib/asan/asan_malloc_mac.cc

Modified: compiler-rt/trunk/lib/asan/asan_malloc_mac.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_malloc_mac.cc?rev=163690&r1=163689&r2=163690&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_malloc_mac.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_malloc_mac.cc Wed Sep 12 04:38:51 2012
@@ -312,17 +312,13 @@
   asan_mz_force_unlock();
 }
 
-// This function is currently unused, and we build with -Werror.
-#if 0
 void mi_statistics(malloc_zone_t *zone, malloc_statistics_t *stats) {
-  // TODO(csilvers): figure out how to fill these out
-  // TODO(glider): port this from tcmalloc when ready.
+  // TODO(glider): fill these correctly.
   stats->blocks_in_use = 0;
   stats->size_in_use = 0;
   stats->max_size_in_use = 0;
   stats->size_allocated = 0;
 }
-#endif
 
 #if defined(MAC_OS_X_VERSION_10_6) && \
     MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
@@ -364,6 +360,7 @@
   asan_introspection.log = &mi_log;
   asan_introspection.force_lock = &mi_force_lock;
   asan_introspection.force_unlock = &mi_force_unlock;
+  asan_introspection.statistics = &mi_statistics;
 
   internal_memset(&asan_zone, 0, sizeof(malloc_zone_t));
 





More information about the llvm-commits mailing list