John Reiser : ntdll: Tell valgrind to load the . pdb debugging info for the module that was just loaded.

Alexandre Julliard julliard at winehq.org
Fri Jul 25 08:13:32 CDT 2008


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

Author: John Reiser <jreiser at BitWagon.com>
Date:   Thu Jul 24 10:21:33 2008 -0700

ntdll: Tell valgrind to load the .pdb debugging info for the module that was just loaded.

---

 dlls/ntdll/virtual.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index ef97eb2..78e38dc 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -41,8 +41,8 @@
 #ifdef HAVE_SYS_MMAN_H
 # include <sys/mman.h>
 #endif
-#ifdef HAVE_VALGRIND_MEMCHECK_H
-# include <valgrind/memcheck.h>
+#ifdef HAVE_VALGRIND_VALGRIND_H
+# include <valgrind/valgrind.h>
 #endif
 
 #define NONAMELESSUNION
@@ -898,6 +898,7 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
     struct stat st;
     struct file_view *view = NULL;
     char *ptr, *header_end;
+    int delta = 0;
 
     /* zero-map the whole range */
 
@@ -1088,7 +1089,6 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
         ((nt->FileHeader.Characteristics & IMAGE_FILE_DLL) ||
           !NtCurrentTeb()->Peb->ImageBaseAddress) )
     {
-        int delta = ptr - base;
         IMAGE_BASE_RELOCATION *rel, *end;
         const IMAGE_DATA_DIRECTORY *relocs;
 
@@ -1106,6 +1106,7 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
         relocs = &nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC];
         rel = (IMAGE_BASE_RELOCATION *)(ptr + relocs->VirtualAddress);
         end = (IMAGE_BASE_RELOCATION *)(ptr + relocs->VirtualAddress + relocs->Size);
+        delta = ptr - base;
 
         while (rel <= end - 1 && rel->SizeOfBlock)
         {
@@ -1154,6 +1155,9 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
     server_leave_uninterrupted_section( &csVirtual, &sigset );
 
     *addr_ptr = ptr;
+#ifdef VALGRIND_LOAD_PDB_DEBUGINFO
+    VALGRIND_LOAD_PDB_DEBUGINFO(fd, ptr, total_size, delta);
+#endif
     return STATUS_SUCCESS;
 
  error:




More information about the wine-cvs mailing list