|
From: <sv...@va...> - 2006-01-19 03:35:43
|
Author: sewardj
Date: 2006-01-19 03:35:37 +0000 (Thu, 19 Jan 2006)
New Revision: 5550
Log:
Consistently call init() before doing any MALLOC_TRACE, since the
latter depends on function pointers obtained by the former.
Modified:
trunk/coregrind/m_replacemalloc/vg_replace_malloc.c
Modified: trunk/coregrind/m_replacemalloc/vg_replace_malloc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_replacemalloc/vg_replace_malloc.c 2006-01-18 04:25:=
20 UTC (rev 5549)
+++ trunk/coregrind/m_replacemalloc/vg_replace_malloc.c 2006-01-19 03:35:=
37 UTC (rev 5550)
@@ -107,8 +107,8 @@
{ \
void* v; \
\
+ if (!init_done) init(); \
MALLOC_TRACE(#fnname "(%llu)", (ULong)n ); \
- if (!init_done) init(); \
\
v =3D (void*)VALGRIND_NON_SIMD_CALL1( info.tl_##vg_replacement, n =
); \
MALLOC_TRACE(" =3D %p", v ); \
@@ -127,8 +127,8 @@
{ \
void* v; \
\
+ if (!init_done) init(); \
MALLOC_TRACE(#fnname "(%llu)", (ULong)n ); \
- if (!init_done) init(); \
\
v =3D (void*)VALGRIND_NON_SIMD_CALL1( info.tl_##vg_replacement, n =
); \
MALLOC_TRACE(" =3D %p", v ); \
@@ -223,10 +223,10 @@
void VG_REPLACE_FUNCTION_ZU(soname,fnname) (void *p); \
void VG_REPLACE_FUNCTION_ZU(soname,fnname) (void *p) \
{ \
+ if (!init_done) init(); \
MALLOC_TRACE(#vg_replacement "(%p)", p ); \
if (p =3D=3D NULL) \
return; \
- if (!init_done) init(); \
(void)VALGRIND_NON_SIMD_CALL1( info.tl_##vg_replacement, p ); \
}
=20
@@ -268,9 +268,9 @@
{ \
void* v; \
\
+ if (!init_done) init(); \
MALLOC_TRACE("calloc(%llu,%llu)", (ULong)nmemb, (ULong)size ); \
\
- if (!init_done) init(); \
v =3D (void*)VALGRIND_NON_SIMD_CALL2( info.tl_calloc, nmemb, size =
); \
MALLOC_TRACE(" =3D %p", v ); \
return v; \
@@ -286,6 +286,7 @@
{ \
void* v; \
\
+ if (!init_done) init(); \
MALLOC_TRACE("realloc(%p,%llu)", ptrV, (ULong)new_size ); \
\
if (ptrV =3D=3D NULL) \
@@ -297,7 +298,6 @@
MALLOC_TRACE(" =3D 0"); \
return NULL; \
} \
- if (!init_done) init(); \
v =3D (void*)VALGRIND_NON_SIMD_CALL2( info.tl_realloc, ptrV, new_s=
ize ); \
MALLOC_TRACE(" =3D %p", v ); \
return v; \
@@ -313,6 +313,7 @@
{ \
void* v; \
\
+ if (!init_done) init(); \
MALLOC_TRACE("memalign(al %llu, size %llu)", \
(ULong)alignment, (ULong)n ); \
\
@@ -323,7 +324,6 @@
/* Round up to nearest power-of-two if necessary (like glibc). */ =
\
while (0 !=3D (alignment & (alignment - 1))) alignment++; \
\
- if (!init_done) init(); \
v =3D (void*)VALGRIND_NON_SIMD_CALL2( info.tl_memalign, alignment,=
n ); \
MALLOC_TRACE(" =3D %p", v ); \
return v; \
@@ -393,11 +393,11 @@
{ \
SizeT pszB; \
\
+ if (!init_done) init(); \
MALLOC_TRACE("malloc_usable_size(%p)", p ); \
if (NULL =3D=3D p) \
return 0; \
\
- if (!init_done) init(); \
pszB =3D (SizeT)VALGRIND_NON_SIMD_CALL2( info.arena_payload_szB, \
VG_AR_CLIENT, p ); \
MALLOC_TRACE(" =3D %llu", (ULong)pszB ); \
@@ -440,8 +440,8 @@
struct vg_mallinfo VG_REPLACE_FUNCTION_ZU(soname, fnname) ( void ) \
{ \
static struct vg_mallinfo mi; \
+ if (!init_done) init(); \
MALLOC_TRACE("mallinfo()"); \
- if (!init_done) init(); \
(void)VALGRIND_NON_SIMD_CALL1( info.mallinfo, &mi ); \
return mi; \
}
|