|
From: <sv...@va...> - 2012-02-23 07:40:41
|
Author: sewardj
Date: 2012-02-23 07:36:03 +0000 (Thu, 23 Feb 2012)
New Revision: 12399
Log:
Implement malloc_size for the vg_default_zone on Darwin.
Modified:
trunk/coregrind/m_replacemalloc/vg_replace_malloc.c
Modified: trunk/coregrind/m_replacemalloc/vg_replace_malloc.c
===================================================================
--- trunk/coregrind/m_replacemalloc/vg_replace_malloc.c 2012-02-22 20:23:29 UTC (rev 12398)
+++ trunk/coregrind/m_replacemalloc/vg_replace_malloc.c 2012-02-23 07:36:03 UTC (rev 12399)
@@ -950,10 +950,20 @@
#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),
|