Add intercepts for more OSX 10.9 malloc_zone functions:
malloc_default_purgeable_zone malloc_create_zone
malloc_zone_check malloc_zone_register malloc_zone_unregister
malloc_set_zone_name malloc_get_zone_name
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14100 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c
index 85edbda..8d34ebb 100644
--- a/coregrind/m_replacemalloc/vg_replace_malloc.c
+++ b/coregrind/m_replacemalloc/vg_replace_malloc.c
@@ -94,7 +94,13 @@
10190 MALLOC_STATS
10200 MALLINFO
10210 DEFAULT_ZONE
- 10220 ZONE_CHECK
+ 10220 CREATE_ZONE
+ 10230 ZONE_FROM_PTR
+ 10240 ZONE_CHECK
+ 10250 ZONE_REGISTER
+ 10260 ZONE_UNREGISTER
+ 10270 ZONE_SET_NAME
+ 10280 ZONE_GET_NAME
*/
/* 2 Apr 05: the Portland Group compiler, which uses cfront/ARM style
@@ -1081,12 +1087,24 @@
DEFAULT_ZONE(VG_Z_LIBC_SONAME, malloc_default_zone);
DEFAULT_ZONE(SO_SYN_MALLOC, malloc_default_zone);
+DEFAULT_ZONE(VG_Z_LIBC_SONAME, malloc_default_purgeable_zone);
+DEFAULT_ZONE(SO_SYN_MALLOC, malloc_default_purgeable_zone);
+
+
+#define CREATE_ZONE(soname, fnname) \
+ \
+ void *VG_REPLACE_FUNCTION_EZU(10220,soname,fnname)(size_t sz, unsigned fl); \
+ void *VG_REPLACE_FUNCTION_EZU(10220,soname,fnname)(size_t sz, unsigned fl) \
+ { \
+ return &vg_default_zone; \
+ }
+CREATE_ZONE(VG_Z_LIBC_SONAME, malloc_create_zone);
#define ZONE_FROM_PTR(soname, fnname) \
\
- void *VG_REPLACE_FUNCTION_EZU(10220,soname,fnname) ( void* ptr ); \
- void *VG_REPLACE_FUNCTION_EZU(10220,soname,fnname) ( void* ptr ) \
+ void *VG_REPLACE_FUNCTION_EZU(10230,soname,fnname) ( void* ptr ); \
+ void *VG_REPLACE_FUNCTION_EZU(10230,soname,fnname) ( void* ptr ) \
{ \
return &vg_default_zone; \
}
@@ -1098,14 +1116,65 @@
// GrP fixme bypass libc's use of zone->introspect->check
#define ZONE_CHECK(soname, fnname) \
\
- int VG_REPLACE_FUNCTION_EZU(10230,soname,fnname)(void* zone); \
- int VG_REPLACE_FUNCTION_EZU(10230,soname,fnname)(void* zone) \
+ int VG_REPLACE_FUNCTION_EZU(10240,soname,fnname)(void* zone); \
+ int VG_REPLACE_FUNCTION_EZU(10240,soname,fnname)(void* zone) \
{ \
trigger_memcheck_error_if_undefined((ULong) zone); \
+ panic(#fnname); \
return 1; \
}
-//ZONE_CHECK(VG_Z_LIBC_SONAME, malloc_zone_check);
+ZONE_CHECK(VG_Z_LIBC_SONAME, malloc_zone_check);
+ZONE_CHECK(SO_SYN_MALLOC, malloc_zone_check);
+
+
+#define ZONE_REGISTER(soname, fnname) \
+ \
+ void VG_REPLACE_FUNCTION_EZU(10250,soname,fnname)(void* zone); \
+ void VG_REPLACE_FUNCTION_EZU(10250,soname,fnname)(void* zone) \
+ { \
+ trigger_memcheck_error_if_undefined((ULong) zone); \
+ }
+
+ZONE_REGISTER(VG_Z_LIBC_SONAME, malloc_zone_register);
+ZONE_REGISTER(SO_SYN_MALLOC, malloc_zone_register);
+
+
+#define ZONE_UNREGISTER(soname, fnname) \
+ \
+ void VG_REPLACE_FUNCTION_EZU(10260,soname,fnname)(void* zone); \
+ void VG_REPLACE_FUNCTION_EZU(10260,soname,fnname)(void* zone) \
+ { \
+ trigger_memcheck_error_if_undefined((ULong) zone); \
+ }
+
+ZONE_UNREGISTER(VG_Z_LIBC_SONAME, malloc_zone_unregister);
+ZONE_UNREGISTER(SO_SYN_MALLOC, malloc_zone_unregister);
+
+
+#define ZONE_SET_NAME(soname, fnname) \
+ \
+ void VG_REPLACE_FUNCTION_EZU(10270,soname,fnname)(void* zone, char* nm); \
+ void VG_REPLACE_FUNCTION_EZU(10270,soname,fnname)(void* zone, char* nm) \
+ { \
+ trigger_memcheck_error_if_undefined((ULong) zone); \
+ }
+
+ZONE_SET_NAME(VG_Z_LIBC_SONAME, malloc_set_zone_name);
+ZONE_SET_NAME(SO_SYN_MALLOC, malloc_set_zone_name);
+
+
+#define ZONE_GET_NAME(soname, fnname) \
+ \
+ char* VG_REPLACE_FUNCTION_EZU(10280,soname,fnname)(void* zone); \
+ char* VG_REPLACE_FUNCTION_EZU(10280,soname,fnname)(void* zone) \
+ { \
+ trigger_memcheck_error_if_undefined((ULong) zone); \
+ return vg_default_zone.zone_name; \
+ }
+
+ZONE_SET_NAME(VG_Z_LIBC_SONAME, malloc_get_zone_name);
+ZONE_SET_NAME(SO_SYN_MALLOC, malloc_get_zone_name);
#endif /* defined(VGO_darwin) */