A couple of new valgrind instrumentations for better support.
authorEric Pouech <eric.pouech@wanadoo.fr>
Tue, 14 Feb 2006 12:06:29 +0000 (13:06 +0100)
committerAlexandre Julliard <julliard@winehq.org>
Tue, 14 Feb 2006 12:06:29 +0000 (13:06 +0100)
dlls/kernel/process.c
dlls/ntdll/signal_i386.c

index 417e658..c81ba03 100644 (file)
 #include "wine/unicode.h"
 #include "wine/debug.h"
 
+#ifdef HAVE_VALGRIND_MEMCHECK_H
+#include <valgrind/memcheck.h>
+#endif
+
 WINE_DEFAULT_DEBUG_CHANNEL(process);
 WINE_DECLARE_DEBUG_CHANNEL(file);
 WINE_DECLARE_DEBUG_CHANNEL(relay);
@@ -932,6 +936,11 @@ static void *init_stack(void)
     NtCurrentTeb()->Tib.StackBase     = (char *)base + stack_size;
     NtCurrentTeb()->Tib.StackLimit    = (char *)base + page_size;
 
+#ifdef VALGRIND_STACK_REGISTER
+    /* no need to de-register the stack as it's the one of the main thread */
+    VALGRIND_STACK_REGISTER(NtCurrentTeb()->Tib.StackLimit, NtCurrentTeb()->Tib.StackBase);
+#endif
+
     /* setup guard page */
     VirtualProtect( base, page_size, PAGE_NOACCESS, NULL );
     return NtCurrentTeb()->Tib.StackBase;
index 0cacd7a..46f9fa6 100644 (file)
 #include "wine/library.h"
 #include "ntdll_misc.h"
 
+#ifdef HAVE_VALGRIND_MEMCHECK_H
+#include <valgrind/memcheck.h>
+#endif
+
 /***********************************************************************
  * signal context platform-specific definitions
  */
@@ -983,6 +987,9 @@ static EXCEPTION_RECORD *setup_exception( SIGCONTEXT *sigcontext, raise_func fun
     }
 
     stack--;  /* push the stack_layout structure */
+#ifdef HAVE_VALGRIND_MEMCHECK_H
+    VALGRIND_MAKE_WRITABLE(stack, sizeof(*stack));
+#endif
     stack->ret_addr     = (void *)0xdeadbabe;  /* raise_func must not return */
     stack->rec_ptr      = &stack->rec;
     stack->context_ptr  = &stack->context;