]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Merge patch from Jeremy Fitzhardinge:
authorJulian Seward <jseward@acm.org>
Wed, 23 Oct 2002 21:46:13 +0000 (21:46 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 23 Oct 2002 21:46:13 +0000 (21:46 +0000)
14-hg-mmap-magic-virgin
  This does two things:

  1. change the signatures of the new_mem_mmap and change_mem_mprotect
  functions to remove the pointless 'nn' argument. This makes them match
  the signature of new_mem_startup...

  2. change helgrind to mark memory created by mmap as if it were the
  same as other magically pre-inited memory. Implement this by pointing
  helgrind's new_mem_mmap function at new_mem_startup.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1263

addrcheck/ac_main.c
coregrind/vg_syscalls.c
helgrind/hg_main.c
include/vg_skin.h
memcheck/mc_main.c

index 23d1d08556de551e286efa7e2ad4f740b71e2625..bf0da4f067f351540e10c8a0cf02c44040374674 100644 (file)
@@ -1317,10 +1317,10 @@ void addrcheck_new_mem_heap ( Addr a, UInt len, Bool is_inited )
 
 static
 void addrcheck_set_perms (Addr a, UInt len, 
-                         Bool nn, Bool rr, Bool ww, Bool xx)
+                         Bool rr, Bool ww, Bool xx)
 {
-   DEBUG("addrcheck_set_perms(%p, %u, nn=%u, rr=%u ww=%u, xx=%u)\n",
-                              a, len, nn, rr, ww, xx);
+   DEBUG("addrcheck_set_perms(%p, %u, rr=%u ww=%u, xx=%u)\n",
+                              a, len, rr, ww, xx);
    if (rr || ww || xx) {
       SK_(make_accessible)(a, len);
    } else {
index 4fb58c46892f214c7118eb5d585f2e163dac93f0..9da32761a51a057e2fce94316437adc8cabd8c95 100644 (file)
@@ -83,18 +83,17 @@ void mash_addr_and_len( Addr* a, UInt* len)
 static
 void mmap_segment ( Addr a, UInt len, UInt prot, Int fd )
 {
-   Bool nn, rr, ww, xx;
+   Bool rr, ww, xx;
 
    /* Records segment, reads debug symbols if necessary */
    if ((prot & PROT_EXEC) && fd != -1)
       VG_(new_exe_segment) ( a, len );
 
-   nn = False; /* PROT_NONE == 0; was = prot & PROT_NONE. */
    rr = prot & PROT_READ;
    ww = prot & PROT_WRITE;
    xx = prot & PROT_EXEC;
 
-   VG_TRACK( new_mem_mmap, a, len, nn, rr, ww, xx );
+   VG_TRACK( new_mem_mmap, a, len, rr, ww, xx );
 }
 
 static
@@ -123,8 +122,8 @@ void munmap_segment ( Addr a, UInt len )
 static 
 void mprotect_segment ( Addr a, UInt len, Int prot )
 {
-   Bool nn, rr, ww, xx;
-   nn = prot & PROT_NONE;
+   Bool rr, ww, xx;
+
    rr = prot & PROT_READ;
    ww = prot & PROT_WRITE;
    xx = prot & PROT_EXEC;
@@ -133,7 +132,7 @@ void mprotect_segment ( Addr a, UInt len, Int prot )
    // if adding, should check and add to exe_seg list
    // easier to ignore both cases -- both v. unlikely?
    mash_addr_and_len(&a, &len);
-   VG_TRACK( change_mem_mprotect, a, len, nn, rr, ww, xx );
+   VG_TRACK( change_mem_mprotect, a, len, rr, ww, xx );
 }
 
 static 
@@ -162,7 +161,7 @@ void mremap_segment ( old_addr, old_size, new_addr, new_size )
       // what should the permissions on the new extended part be??
       // using 'rwx'
       VG_TRACK( new_mem_mmap,   new_addr+old_size, new_size-old_size,
-                                False, True, True, True );
+                                True, True, True );
    }
 }
 
@@ -1778,7 +1777,7 @@ void VG_(perform_assumed_nonblocking_syscall) ( ThreadId tid )
                      if ( segmentSize > 0 ) {
                         /* we don't distinguish whether it's read-only or
                          * read-write -- it doesn't matter really. */
-                        VG_TRACK( new_mem_mmap, addr, segmentSize, False, True, True, False );
+                        VG_TRACK( new_mem_mmap, addr, segmentSize, True, True, False );
                      }
                   }
                   break;
index 8d0b0e7770800b08a5f9721506ba59241c99d3fc..206152ce6e57269698e5e40c01e7887e1b7f42e5 100644 (file)
@@ -915,7 +915,7 @@ void eraser_new_mem_heap ( Addr a, UInt len, Bool is_inited )
 
 static
 void eraser_set_perms (Addr a, UInt len,
-                       Bool nn, Bool rr, Bool ww, Bool xx)
+                       Bool rr, Bool ww, Bool xx)
 {
    if      (rr) make_readable(a, len);
    else if (ww) make_writable(a, len);
@@ -1916,7 +1916,7 @@ void SK_(pre_clo_init)(VgDetails* details, VgNeeds* needs, VgTrackEvents* track)
    track->new_mem_stack_aligned = & make_writable_aligned;
    track->new_mem_stack_signal  = & make_writable;
    track->new_mem_brk           = & make_writable;
-   track->new_mem_mmap          = & eraser_set_perms;
+   track->new_mem_mmap          = & eraser_new_mem_startup;
 
    track->copy_mem_heap         = & copy_address_range_state;
    track->change_mem_mprotect   = & eraser_set_perms;
index 4a06beeb199eea3628abe9b7d977c752cbccaf18..819d1539fff14c7c9336c42ae5c0a3a266cfe727 100644 (file)
@@ -1277,13 +1277,11 @@ typedef
       void (*new_mem_stack_aligned) ( Addr a, UInt len );
       void (*new_mem_stack_signal)  ( Addr a, UInt len );
       void (*new_mem_brk)    ( Addr a, UInt len );
-      void (*new_mem_mmap)   ( Addr a, UInt len, 
-                               Bool nn, Bool rr, Bool ww, Bool xx );
+      void (*new_mem_mmap)   ( Addr a, UInt len, Bool rr, Bool ww, Bool xx );
 
       void (*copy_mem_heap)  ( Addr from, Addr to, UInt len );
       void (*copy_mem_remap) ( Addr from, Addr to, UInt len );
-      void (*change_mem_mprotect) ( Addr a, UInt len,  
-                                    Bool nn, Bool rr, Bool ww, Bool xx );
+      void (*change_mem_mprotect) ( Addr a, UInt len, Bool rr, Bool ww, Bool xx );
       
       /* Used on redzones around malloc'd blocks and at end of stack */
       void (*ban_mem_heap)   ( Addr a, UInt len );
index 42710b04ee6457f06f455aaa8593e5cf1739b14d..2484c1337e34ded0bf9c3fa78f00b17cc7008474 100644 (file)
@@ -889,10 +889,10 @@ void memcheck_new_mem_heap ( Addr a, UInt len, Bool is_inited )
 
 static
 void memcheck_set_perms (Addr a, UInt len, 
-                         Bool nn, Bool rr, Bool ww, Bool xx)
+                         Bool rr, Bool ww, Bool xx)
 {
-   DEBUG("memcheck_set_perms(%p, %u, nn=%u, rr=%u ww=%u, xx=%u)\n",
-                             a, len, nn, rr, ww, xx);
+   DEBUG("memcheck_set_perms(%p, %u, rr=%u ww=%u, xx=%u)\n",
+                             a, len, rr, ww, xx);
    if      (rr) SK_(make_readable)(a, len);
    else if (ww) SK_(make_writable)(a, len);
    else         SK_(make_noaccess)(a, len);