]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Increase a hard limit that was reached in the wild.
authorNicholas Nethercote <njn@valgrind.org>
Fri, 5 Jun 2009 05:28:17 +0000 (05:28 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Fri, 5 Jun 2009 05:28:17 +0000 (05:28 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10250

coregrind/m_aspacemgr/aspacemgr-linux.c
coregrind/m_syswrap/syswrap-darwin.c

index 0af3bb5f23269303ba122b3bda4a894cf02df2ac..c9bf5b365cf9bf60dcb2a55067e4bc3d6d1baad0 100644 (file)
@@ -3374,6 +3374,8 @@ static void add_mapping_callback(Addr addr, SizeT len, UInt prot,
       else if (nsegments[i].kind == SkFree || nsegments[i].kind == SkResvn) {
           /* Add mapping for SkResvn regions */
          ChangedSeg* cs = &css_local[css_used_local];
+         // If this assert fails, the css_size arg passed to
+         // VG_(get_changed_segments) needs to be increased.
          aspacem_assert(css_used_local < css_size_local);
          cs->is_added = True;
          cs->start    = addr;
@@ -3433,8 +3435,9 @@ static void remove_mapping_callback(Addr addr, SizeT len)
       if (nsegments[i].kind != SkFree  &&  nsegments[i].kind != SkResvn) {
          // V has a mapping, kernel doesn't
          ChangedSeg* cs = &css_local[css_used_local];
+         // If this assert fails, the css_size arg passed to
+         // VG_(get_changed_segments) needs to be increased.
          aspacem_assert(css_used_local < css_size_local);
-         cs->is_added = True;
          cs->is_added = False;
          cs->start    = nsegments[i].start;
          cs->end      = nsegments[i].end;
index 20d665f0f5e587544a24261831546d5a3f8c064b..d9278e555a3bc89b151c06a76582b2bfafbf4c38 100644 (file)
@@ -592,10 +592,13 @@ void VG_(show_open_ports)(void)
 
 static void sync_mappings(const HChar *when, const HChar *where, Int num)
 {
-   // I haven't seen more than 1 segment be added or removed in a single calls
-   // to sync_mappings().  So 20 seems generous.  The upper bound is the
-   // number of segments currently in use.  --njn
-   #define CSS_SIZE     20
+   // Usually the number of segments added/removed in a single calls is very
+   // small e.g. 1.  But the limit was 20 at one point, and that wasn't enough
+   // for at least one invocation of Firefox.  If we need to go much bigger,
+   // should probably make VG_(get_changed_segments) fail if the size isn't
+   // big enough, and repeatedly redo it with progressively bigger dynamically
+   // allocated buffers until it succeeds.
+   #define CSS_SIZE     100
    ChangedSeg css[CSS_SIZE];
    Int        css_used;
    Int        i;