From: Julian Seward Date: Thu, 23 Feb 2012 07:36:03 +0000 (+0000) Subject: Implement malloc_size for the vg_default_zone on Darwin. X-Git-Tag: svn/VALGRIND_3_8_0~454 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3e81d0d8312a19b6c03052291836c6b97c35899;p=thirdparty%2Fvalgrind.git Implement malloc_size for the vg_default_zone on Darwin. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12399 --- diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c index 06cb2f6897..3953911909 100644 --- a/coregrind/m_replacemalloc/vg_replace_malloc.c +++ b/coregrind/m_replacemalloc/vg_replace_malloc.c @@ -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),