]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Make the message "brk segment overflow in thread #%u: can't grow to %#lx"
authorJulian Seward <jseward@acm.org>
Mon, 22 May 2017 08:50:07 +0000 (08:50 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 22 May 2017 08:50:07 +0000 (08:50 +0000)
be printed only once, rather than every time it happens.  Also make it
not be printed in silent mode (-q).

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

coregrind/m_syswrap/syswrap-generic.c

index 8e4ba695b1a86aa99410450d4e0da817639f85ec..b0fbfd9393ca3d27069c56de1c41bac211aa4989 100644 (file)
@@ -1322,16 +1322,29 @@ static Addr do_brk ( Addr newbrk, ThreadId tid )
    vg_assert(delta > 0);
    vg_assert(VG_IS_PAGE_ALIGNED(delta));
    
-   Bool overflow;
+   Bool overflow = False;
    if (! VG_(am_extend_into_adjacent_reservation_client)( aseg->start, delta,
                                                           &overflow)) {
-      if (overflow)
-         VG_(umsg)("brk segment overflow in thread #%u: can't grow to %#lx\n",
-                   tid, newbrkP);
-      else
-         VG_(umsg)("Cannot map memory to grow brk segment in thread #%u "
-                   "to %#lx\n", tid, newbrkP);
-      VG_(umsg)("(see section Limitations in user manual)\n");
+      if (overflow) {
+         static Bool alreadyComplained = False;
+         if (!alreadyComplained) {
+            alreadyComplained = True;
+            if (VG_(clo_verbosity) > 0) {
+               VG_(umsg)("brk segment overflow in thread #%u: "
+                         "can't grow to %#lx\n",
+                         tid, newbrkP);
+               VG_(umsg)("(see section Limitations in user manual)\n");
+               VG_(umsg)("NOTE: further instances of this message "
+                         "will not be shown\n");
+            }
+         }
+      } else {
+         if (VG_(clo_verbosity) > 0) {
+            VG_(umsg)("Cannot map memory to grow brk segment in thread #%u "
+                      "to %#lx\n", tid, newbrkP);
+            VG_(umsg)("(see section Limitations in user manual)\n");
+         }
+      }
       goto bad;
    }