]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Implement malloc_size for the vg_default_zone on Darwin.
authorJulian Seward <jseward@acm.org>
Thu, 23 Feb 2012 07:36:03 +0000 (07:36 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 23 Feb 2012 07:36:03 +0000 (07:36 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12399

coregrind/m_replacemalloc/vg_replace_malloc.c

index 06cb2f6897b3714fedab971d6a8b83550fa6a681..395391190934354aa41d87e595e37be3a4ce7907 100644 (file)
@@ -950,10 +950,20 @@ static void panic(const char *str)
 
 #if defined(VGO_darwin)
 
+static size_t my_malloc_size ( void* zone, void* ptr )
+{
+   /* Implement "malloc_size" by handing the request through to the
+      tool's .tl_usable_size method. */
+   if (!init_done) init();
+   size_t res = (size_t)VALGRIND_NON_SIMD_CALL1(
+                           info.tl_malloc_usable_size, ptr);
+   return res;
+}
+
 static vki_malloc_zone_t vg_default_zone = {
     NULL, // reserved1
     NULL, // reserved2
-    NULL, // GrP fixme: malloc_size
+    my_malloc_size, // JRS fixme: is this right?
     (void*)VG_REPLACE_FUNCTION_EZU(10020,VG_Z_LIBC_SONAME,malloc_zone_malloc), 
     (void*)VG_REPLACE_FUNCTION_EZU(10060,VG_Z_LIBC_SONAME,malloc_zone_calloc), 
     (void*)VG_REPLACE_FUNCTION_EZU(10130,VG_Z_LIBC_SONAME,malloc_zone_valloc),