Eric Pouech : A couple of new valgrind instrumentations for better support.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Feb 14 07:28:34 CST 2006


Module: wine
Branch: refs/heads/master
Commit: c67bc2260c8d58186d424f27e371b9865d7a35b0
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=c67bc2260c8d58186d424f27e371b9865d7a35b0

Author: Eric Pouech <eric.pouech at wanadoo.fr>
Date:   Tue Feb 14 13:06:29 2006 +0100

A couple of new valgrind instrumentations for better support.

---

 dlls/kernel/process.c    |    9 +++++++++
 dlls/ntdll/signal_i386.c |    7 +++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/dlls/kernel/process.c b/dlls/kernel/process.c
index 417e658..c81ba03 100644
--- a/dlls/kernel/process.c
+++ b/dlls/kernel/process.c
@@ -46,6 +46,10 @@
 #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;
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index 0cacd7a..46f9fa6 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -56,6 +56,10 @@
 #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
     }
 
     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;




More information about the wine-cvs mailing list