valgrind: Made Wine compliant will latest Valgrind macros (the one removed from 3.3.0 and deprecated since 3.2.0).

This commit is contained in:
Eric Pouech 2007-12-23 14:57:36 +01:00 committed by Alexandre Julliard
parent 7f3abe7757
commit aff968fb47
3 changed files with 16 additions and 6 deletions

View File

@ -140,7 +140,9 @@ static BOOL HEAP_IsRealArena( HEAP *heapPtr, DWORD flags, LPCVOID block, BOOL qu
static inline void mark_block_free( void *ptr, SIZE_T size ) static inline void mark_block_free( void *ptr, SIZE_T size )
{ {
if (TRACE_ON(heap) || WARN_ON(heap)) memset( ptr, ARENA_FREE_FILLER, size ); if (TRACE_ON(heap) || WARN_ON(heap)) memset( ptr, ARENA_FREE_FILLER, size );
#ifdef VALGRIND_MAKE_NOACCESS #if defined(VALGRIND_MAKE_MEM_NOACCESS)
VALGRIND_DISCARD( VALGRIND_MAKE_MEM_NOACCESS( ptr, size ));
#elif defined( VALGRIND_MAKE_NOACCESS)
VALGRIND_DISCARD( VALGRIND_MAKE_NOACCESS( ptr, size )); VALGRIND_DISCARD( VALGRIND_MAKE_NOACCESS( ptr, size ));
#endif #endif
} }
@ -148,7 +150,9 @@ static inline void mark_block_free( void *ptr, SIZE_T size )
/* mark a block of memory as initialized for debugging purposes */ /* mark a block of memory as initialized for debugging purposes */
static inline void mark_block_initialized( void *ptr, SIZE_T size ) static inline void mark_block_initialized( void *ptr, SIZE_T size )
{ {
#ifdef VALGRIND_MAKE_READABLE #if defined(VALGRIND_MAKE_MEM_DEFINED)
VALGRIND_DISCARD( VALGRIND_MAKE_MEM_DEFINED( ptr, size ));
#elif defined(VALGRIND_MAKE_READABLE)
VALGRIND_DISCARD( VALGRIND_MAKE_READABLE( ptr, size )); VALGRIND_DISCARD( VALGRIND_MAKE_READABLE( ptr, size ));
#endif #endif
} }
@ -156,13 +160,17 @@ static inline void mark_block_initialized( void *ptr, SIZE_T size )
/* mark a block of memory as uninitialized for debugging purposes */ /* mark a block of memory as uninitialized for debugging purposes */
static inline void mark_block_uninitialized( void *ptr, SIZE_T size ) static inline void mark_block_uninitialized( void *ptr, SIZE_T size )
{ {
#ifdef VALGRIND_MAKE_WRITABLE #if defined(VALGRIND_MAKE_MEM_UNDEFINED)
VALGRIND_DISCARD( VALGRIND_MAKE_MEM_UNDEFINED( ptr, size ));
#elif defined(VALGRIND_MAKE_WRITABLE)
VALGRIND_DISCARD( VALGRIND_MAKE_WRITABLE( ptr, size )); VALGRIND_DISCARD( VALGRIND_MAKE_WRITABLE( ptr, size ));
#endif #endif
if (TRACE_ON(heap) || WARN_ON(heap)) if (TRACE_ON(heap) || WARN_ON(heap))
{ {
memset( ptr, ARENA_INUSE_FILLER, size ); memset( ptr, ARENA_INUSE_FILLER, size );
#ifdef VALGRIND_MAKE_WRITABLE #if defined(VALGRIND_MAKE_MEM_UNDEFINED)
VALGRIND_DISCARD( VALGRIND_MAKE_MEM_UNDEFINED( ptr, size ));
#elif defined(VALGRIND_MAKE_WRITABLE)
/* make it uninitialized to valgrind again */ /* make it uninitialized to valgrind again */
VALGRIND_DISCARD( VALGRIND_MAKE_WRITABLE( ptr, size )); VALGRIND_DISCARD( VALGRIND_MAKE_WRITABLE( ptr, size ));
#endif #endif

View File

@ -936,7 +936,9 @@ static EXCEPTION_RECORD *setup_exception( SIGCONTEXT *sigcontext, raise_func fun
} }
stack--; /* push the stack_layout structure */ stack--; /* push the stack_layout structure */
#ifdef HAVE_VALGRIND_MEMCHECK_H #if defined(VALGRIND_MAKE_MEM_UNDEFINED)
VALGRIND_MAKE_MEM_UNDEFINED(stack, sizeof(*stack));
#elif defined(VALGRIND_MAKE_WRITABLE)
VALGRIND_MAKE_WRITABLE(stack, sizeof(*stack)); VALGRIND_MAKE_WRITABLE(stack, sizeof(*stack));
#endif #endif
stack->ret_addr = (void *)0xdeadbabe; /* raise_func must not return */ stack->ret_addr = (void *)0xdeadbabe; /* raise_func must not return */

View File

@ -150,7 +150,7 @@ static inline void writejump( const char *symbol, void *dest )
*(int *)(addr+1) = (unsigned char *)dest - (addr + 5); *(int *)(addr+1) = (unsigned char *)dest - (addr + 5);
mprotect((void*)((unsigned int)addr & ~(getpagesize()-1)), 5, PROT_READ|PROT_EXEC); mprotect((void*)((unsigned int)addr & ~(getpagesize()-1)), 5, PROT_READ|PROT_EXEC);
# ifdef HAVE_VALGRIND_MEMCHECK_H # ifdef VALGRIND_DISCARD_TRANSLATIONS
VALGRIND_DISCARD_TRANSLATIONS( addr, 5 ); VALGRIND_DISCARD_TRANSLATIONS( addr, 5 );
# endif # endif
#endif /* __GLIBC__ && __i386__ */ #endif /* __GLIBC__ && __i386__ */