Blame SOURCES/valgrind-3.11.0-aspacemgr.patch

0ab3a1
commit b28a423827a1c7917c6f3f3eba23b9432077dfbd
0ab3a1
Author: florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9>
0ab3a1
Date:   Sat Jan 16 21:44:31 2016 +0000
0ab3a1
0ab3a1
    In ML_(am_allocate_segname) do not set the reference count of the
0ab3a1
    slot to 1. Rather do that in add_segment which is where the segment
0ab3a1
    refering to that name actually comes into existence.
0ab3a1
    Properly handle the case in add_segment where the to-be-added segment
0ab3a1
    and one (or more) of the segments it replaces have the same name
0ab3a1
    This may occur when doing a mremap.
0ab3a1
    
0ab3a1
    
0ab3a1
    git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15761 a5019735-40e9-0310-863c-91ae7b9d1cf9
0ab3a1
0ab3a1
diff --git a/coregrind/m_aspacemgr/aspacemgr-linux.c b/coregrind/m_aspacemgr/aspacemgr-linux.c
0ab3a1
index 0a8f675..f6c1a41 100644
0ab3a1
--- a/coregrind/m_aspacemgr/aspacemgr-linux.c
0ab3a1
+++ b/coregrind/m_aspacemgr/aspacemgr-linux.c
0ab3a1
@@ -1445,6 +1445,15 @@ static void add_segment ( const NSegment* seg )
0ab3a1
 
0ab3a1
    split_nsegments_lo_and_hi( sStart, sEnd, &iLo, &iHi );
0ab3a1
 
0ab3a1
+   /* Increase the reference count of SEG's name. We need to do this
0ab3a1
+      *before* decreasing the reference count of the names of the replaced
0ab3a1
+      segments. Consider the case where the segment name of SEG and one of
0ab3a1
+      the replaced segments are the same. If the refcount of that name is 1,
0ab3a1
+      then decrementing first would put the slot for that name on the free
0ab3a1
+      list. Attempting to increment the refcount later would then fail
0ab3a1
+      because the slot is no longer allocated. */
0ab3a1
+   ML_(am_inc_refcount)(seg->fnIdx);
0ab3a1
+
0ab3a1
    /* Now iLo .. iHi inclusive is the range of segment indices which
0ab3a1
       seg will replace.  If we're replacing more than one segment,
0ab3a1
       slide those above the range down to fill the hole. Before doing
0ab3a1
diff --git a/coregrind/m_aspacemgr/aspacemgr-segnames.c b/coregrind/m_aspacemgr/aspacemgr-segnames.c
0ab3a1
index ef3d3ef..8e74356 100644
0ab3a1
--- a/coregrind/m_aspacemgr/aspacemgr-segnames.c
0ab3a1
+++ b/coregrind/m_aspacemgr/aspacemgr-segnames.c
0ab3a1
@@ -309,7 +309,7 @@ ML_(am_allocate_segname)(const HChar *name)
0ab3a1
             freeslot_chain = next_freeslot;
0ab3a1
          else
0ab3a1
             put_slotindex(prev, next_freeslot);
0ab3a1
-         put_refcount(ix, 1);
0ab3a1
+         put_refcount(ix, 0);
0ab3a1
          put_slotsize(ix, size);
0ab3a1
          VG_(strcpy)(segnames + ix, name);
0ab3a1
          ++num_segnames;
0ab3a1
@@ -336,7 +336,7 @@ ML_(am_allocate_segname)(const HChar *name)
0ab3a1
 
0ab3a1
    /* copy it in */
0ab3a1
    ix = segnames_used;
0ab3a1
-   put_refcount(ix, 1);
0ab3a1
+   put_refcount(ix, 0);
0ab3a1
    put_slotsize(ix, len + 1);
0ab3a1
    VG_(strcpy)(segnames + ix, name);
0ab3a1
    segnames_used += need;
0ab3a1
commit e345eb50c0c5e96ac60b2bc21fbe9f281c20b9e6
0ab3a1
Author: florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9>
0ab3a1
Date:   Sat Jan 16 21:12:57 2016 +0000
0ab3a1
0ab3a1
    Remove code that has no effect. Looks like a leftover from early
0ab3a1
    debugging days.
0ab3a1
    
0ab3a1
    
0ab3a1
    git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15760 a5019735-40e9-0310-863c-91ae7b9d1cf9
0ab3a1
0ab3a1
diff --git a/coregrind/m_aspacemgr/aspacemgr-segnames.c b/coregrind/m_aspacemgr/aspacemgr-segnames.c
0ab3a1
index 761608d..ef3d3ef 100644
0ab3a1
--- a/coregrind/m_aspacemgr/aspacemgr-segnames.c
0ab3a1
+++ b/coregrind/m_aspacemgr/aspacemgr-segnames.c
0ab3a1
@@ -250,9 +250,7 @@ dec_refcount(UInt ix)
0ab3a1
          UInt size = get_slotsize(ix);
0ab3a1
          /* Chain this slot in the freelist */
0ab3a1
          put_slotindex(ix, freeslot_chain);
0ab3a1
-         get_slotindex(ix);
0ab3a1
          put_slotsize(ix + slotsize_size, size);
0ab3a1
-         get_slotindex(ix);
0ab3a1
          freeslot_chain = ix;
0ab3a1
          --num_segnames;
0ab3a1
          if (0) VG_(am_show_nsegments)(0, "AFTER DECREASE rc -> 0");