]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Merge patch from Jeremy Fitzhardinge:
authorJulian Seward <jseward@acm.org>
Tue, 22 Oct 2002 05:05:49 +0000 (05:05 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 22 Oct 2002 05:05:49 +0000 (05:05 +0000)
20-hg-secmap
  HELGRIND: fix bugs causing a torrent of "access to distingished map"
  messages. There were two: one is some absurdly broken rounding/padding
  code in set_address_range_state() (how did anything work!?). The other
  was some odd looking code in the tracking of attaching shared memory
  segments. Since they're semantically very similar to mmap, track them
  as such.

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

coregrind/vg_syscalls.c
helgrind/hg_main.c

index 7d1a48fe051f05e57e76562e470762957515d231..4fb58c46892f214c7118eb5d585f2e163dac93f0 100644 (file)
@@ -86,10 +86,10 @@ void mmap_segment ( Addr a, UInt len, UInt prot, Int fd )
    Bool nn, rr, ww, xx;
 
    /* Records segment, reads debug symbols if necessary */
-   if (prot & PROT_EXEC && fd != -1)
+   if ((prot & PROT_EXEC) && fd != -1)
       VG_(new_exe_segment) ( a, len );
 
-   nn = prot & PROT_NONE;
+   nn = False; /* PROT_NONE == 0; was = prot & PROT_NONE. */
    rr = prot & PROT_READ;
    ww = prot & PROT_WRITE;
    xx = prot & PROT_EXEC;
@@ -1778,7 +1778,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( post_mem_write, addr, segmentSize );
+                        VG_TRACK( new_mem_mmap, addr, segmentSize, False, True, True, False );
                      }
                   }
                   break;
index f625396fa9febdf78c09ed132b4b6020e86496bb..75b1b64797b6c3c3a0c8d7439210d87cf3ee6167 100644 (file)
@@ -760,7 +760,7 @@ static
 void set_address_range_state ( Addr a, UInt len /* in bytes */, 
                                VgeInitStatus status )
 {
-   Addr aligned_a, end, aligned_end;
+   Addr end;
 
 #  if DEBUG_MAKE_ACCESSES
    VG_(printf)("make_access: 0x%x, %u, status=%u\n", a, len, status);
@@ -782,12 +782,8 @@ void set_address_range_state ( Addr a, UInt len /* in bytes */,
     * len/4+1 words.  This works out which it is by aligning the block and
     * seeing if the end byte is in the same word as it is for the unaligned
     * block; if not, it's the awkward case. */
-   aligned_a   = a & 0xc;                       /* zero bottom two bits */
-   end         = a + len;
-   aligned_end = aligned_a + len;
-   if ((end & 0xc) != (aligned_end & 0xc)) {
-       end += 4;    /* len/4 + 1 case */
-   }
+   end = (a + len + 3) & ~3;   /* round up */
+   a   &= ~3;                  /* round down */
 
    /* Do it ... */
    switch (status) {
@@ -1256,6 +1252,7 @@ static void record_eraser_error ( ThreadState *tst, Addr a, Bool is_write,
                                  shadow_word prevstate )
 {
    HelgrindError err_extra;
+   static const shadow_word err_sw = { TID_INDICATING_ALL, Vge_Excl };
 
    clear_HelgrindError(&err_extra);
    err_extra.isWrite = is_write;
@@ -1266,12 +1263,7 @@ static void record_eraser_error ( ThreadState *tst, Addr a, Bool is_write,
                             (is_write ? "writing" : "reading"),
                             &err_extra);
 
-   /* Put location into error state to suppress future warnings */
-   {
-      shadow_word *sword = get_sword_addr(a);
-      sword->state = Vge_Excl;
-      sword->other = TID_INDICATING_ALL;
-   }
+   set_sword(a, err_sw);
 }
 
 static void record_mutex_error(ThreadId tid, hg_mutex_t *mutex,