MALLOC_TRACE(#fnname "(%llu)", (ULong)n ); \
\
v = (void*)VALGRIND_NON_SIMD_CALL1( info.tl_##vg_replacement, n ); \
- MALLOC_TRACE(" = %p", v ); \
+ MALLOC_TRACE(" = %p\n", v ); \
return v; \
}
MALLOC_TRACE(#fnname "(%p, %llu)", zone, (ULong)n ); \
\
v = (void*)VALGRIND_NON_SIMD_CALL1( info.tl_##vg_replacement, n ); \
- MALLOC_TRACE(" = %p", v ); \
+ MALLOC_TRACE(" = %p\n", v ); \
return v; \
}
MALLOC_TRACE(#fnname "(%llu)", (ULong)n ); \
\
v = (void*)VALGRIND_NON_SIMD_CALL1( info.tl_##vg_replacement, n ); \
- MALLOC_TRACE(" = %p", v ); \
+ MALLOC_TRACE(" = %p\n", v ); \
if (NULL == v) { \
VALGRIND_PRINTF_BACKTRACE( \
- "new/new[] failed and should throw an exception, but Valgrind\n" \
- " cannot throw exceptions and so is aborting instead. Sorry."); \
+ "new/new[] failed and should throw an exception, but Valgrind\n"); \
+ VALGRIND_PRINTF_BACKTRACE( \
+ " cannot throw exceptions and so is aborting instead. Sorry.\n"); \
_exit(1); \
} \
return v; \
void VG_REPLACE_FUNCTION_ZU(soname,fnname) (void *zone, void *p) \
{ \
if (!init_done) init(); \
- MALLOC_TRACE(#vg_replacement "(%p, %p)", zone, p ); \
+ MALLOC_TRACE(#vg_replacement "(%p, %p)\n", zone, p ); \
if (p == NULL) \
return; \
(void)VALGRIND_NON_SIMD_CALL1( info.tl_##vg_replacement, p ); \
void VG_REPLACE_FUNCTION_ZU(soname,fnname) (void *p) \
{ \
if (!init_done) init(); \
- MALLOC_TRACE(#vg_replacement "(%p)", p ); \
+ MALLOC_TRACE(#vg_replacement "(%p)\n", p ); \
if (p == NULL) \
return; \
(void)VALGRIND_NON_SIMD_CALL1( info.tl_##vg_replacement, p ); \
MALLOC_TRACE("calloc(%p, %llu,%llu)", zone, (ULong)nmemb, (ULong)size ); \
\
v = (void*)VALGRIND_NON_SIMD_CALL2( info.tl_calloc, nmemb, size ); \
- MALLOC_TRACE(" = %p", v ); \
+ MALLOC_TRACE(" = %p\n", v ); \
return v; \
}
/* Protect against overflow. See bug 24078. */ \
if (size && nmemb > (SizeT)-1 / size) return NULL; \
v = (void*)VALGRIND_NON_SIMD_CALL2( info.tl_calloc, nmemb, size ); \
- MALLOC_TRACE(" = %p", v ); \
+ MALLOC_TRACE(" = %p\n", v ); \
return v; \
}
return VG_REPLACE_FUNCTION_ZU(VG_Z_LIBC_SONAME,malloc) (new_size); \
if (new_size <= 0) { \
VG_REPLACE_FUNCTION_ZU(VG_Z_LIBC_SONAME,free)(ptrV); \
- MALLOC_TRACE(" = 0"); \
+ MALLOC_TRACE(" = 0\n"); \
return NULL; \
} \
v = (void*)VALGRIND_NON_SIMD_CALL2( info.tl_realloc, ptrV, new_size ); \
- MALLOC_TRACE(" = %p", v ); \
+ MALLOC_TRACE(" = %p\n", v ); \
return v; \
}
return VG_REPLACE_FUNCTION_ZU(VG_Z_LIBC_SONAME,malloc) (new_size); \
if (new_size <= 0) { \
VG_REPLACE_FUNCTION_ZU(VG_Z_LIBC_SONAME,free)(ptrV); \
- MALLOC_TRACE(" = 0"); \
+ MALLOC_TRACE(" = 0\n"); \
return NULL; \
} \
v = (void*)VALGRIND_NON_SIMD_CALL2( info.tl_realloc, ptrV, new_size ); \
- MALLOC_TRACE(" = %p", v ); \
+ MALLOC_TRACE(" = %p\n", v ); \
return v; \
}
while (0 != (alignment & (alignment - 1))) alignment++; \
\
v = (void*)VALGRIND_NON_SIMD_CALL2( info.tl_memalign, alignment, n ); \
- MALLOC_TRACE(" = %p", v ); \
+ MALLOC_TRACE(" = %p\n", v ); \
return v; \
}
while (0 != (alignment & (alignment - 1))) alignment++; \
\
v = (void*)VALGRIND_NON_SIMD_CALL2( info.tl_memalign, alignment, n ); \
- MALLOC_TRACE(" = %p", v ); \
+ MALLOC_TRACE(" = %p\n", v ); \
return v; \
}
return 0; \
\
pszB = (SizeT)VALGRIND_NON_SIMD_CALL1( info.tl_malloc_usable_size, p ); \
- MALLOC_TRACE(" = %llu", (ULong)pszB ); \
+ MALLOC_TRACE(" = %llu\n", (ULong)pszB ); \
\
return pszB; \
}
static void panic(const char *str)
{
- VALGRIND_PRINTF_BACKTRACE("Program aborting because of call to %s", str);
+ VALGRIND_PRINTF_BACKTRACE("Program aborting because of call to %s\n", str);
_exit(99);
*(int *)0 = 'x';
}
{ \
static struct vg_mallinfo mi; \
if (!init_done) init(); \
- MALLOC_TRACE("mallinfo()"); \
+ MALLOC_TRACE("mallinfo()\n"); \
(void)VALGRIND_NON_SIMD_CALL1( info.mallinfo, &mi ); \
return mi; \
}
<term><command><computeroutput>VALGRIND_PRINTF(format, ...)</computeroutput>:</command></term>
<listitem>
<para>printf a message to the log file when running under
- Valgrind. Nothing is output if not running under Valgrind.
- Returns the number of characters output.</para>
+ Valgrind, prefixed with the PID between a pair of
+ <computeroutput>**</computeroutput> markers. Nothing is output if not
+ running under Valgrind. Output is not produced until a newline is
+ encountered, or subequent Valgrind output is printed; this allows you
+ to build up a single line of output over multiple calls.
+ Returns the number of characters output, excluding the PID at the
+ start.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command><computeroutput>VALGRIND_PRINTF_BACKTRACE(format, ...)</computeroutput>:</command></term>
<listitem>
- <para>printf a message to the log file along with a stack
- backtrace when running under Valgrind. Nothing is output if
- not running under Valgrind. Returns the number of characters
- output.</para>
+ <para>Like <computeroutput>VALGRIND_PRINTF<computeroutput>, but prints
+ a stack backtrace immediately afterwards.</para>
</listitem>
</varlistentry>