|
From: <sv...@va...> - 2006-05-22 11:20:28
|
Author: tom
Date: 2006-05-22 12:20:15 +0100 (Mon, 22 May 2006)
New Revision: 5920
Log:
When moving an address range add the new range before marking the old
one as free otherwise the filename referred to by the temporary copy
of the segment may be dropped from the segment name table when the old
range is freed even though the new range is going to use it.
Modified:
trunk/coregrind/m_aspacemgr/aspacemgr.c
Modified: trunk/coregrind/m_aspacemgr/aspacemgr.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_aspacemgr/aspacemgr.c 2006-05-22 11:15:47 UTC (rev =
5919)
+++ trunk/coregrind/m_aspacemgr/aspacemgr.c 2006-05-22 11:20:15 UTC (rev =
5920)
@@ -2932,7 +2932,7 @@
{
Int iLo, iHi;
SysRes sres;
- NSegment seg, oldseg;
+ NSegment seg;
=20
if (old_len =3D=3D 0 || new_len =3D=3D 0)
return False;
@@ -2969,8 +2969,19 @@
*need_discard =3D any_Ts_in_range( old_addr, old_len )
|| any_Ts_in_range( new_addr, new_len );
=20
- oldseg =3D nsegments[iLo];
+ seg =3D nsegments[iLo];
=20
+ /* Mark the new area based on the old seg. */
+ if (seg.kind =3D=3D SkFileC) {
+ seg.offset +=3D ((ULong)old_addr) - ((ULong)seg.start);
+ } else {
+ aspacem_assert(seg.kind =3D=3D SkAnonC);
+ aspacem_assert(seg.offset =3D=3D 0);
+ }
+ seg.start =3D new_addr;
+ seg.end =3D new_addr + new_len - 1;
+ add_segment( &seg );
+
/* Create a free hole in the old location. */
init_nsegment( &seg );
seg.kind =3D SkFree;
@@ -2978,17 +2989,6 @@
seg.end =3D old_addr + old_len - 1;
add_segment( &seg );
=20
- /* Mark the new area based on the old seg. */
- if (oldseg.kind =3D=3D SkFileC) {
- oldseg.offset +=3D ((ULong)old_addr) - ((ULong)oldseg.start);
- } else {
- aspacem_assert(oldseg.kind =3D=3D SkAnonC);
- aspacem_assert(oldseg.offset =3D=3D 0);
- }
- oldseg.start =3D new_addr;
- oldseg.end =3D new_addr + new_len - 1;
- add_segment( &oldseg );
-
AM_SANITY_CHECK;
return True;
}
|