Valgrind: r16407 - /trunk/coregrind/m_syswrap/syswrap-generic.c

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Valgrind: r16407 - /trunk/coregrind/m_syswrap/syswrap-generic.c

svn-2
Author: sewardj
Date: Mon May 22 09:50:07 2017
New Revision: 16407

Log:
Make the message "brk segment overflow in thread #%u: can't grow to %#lx"
be printed only once, rather than every time it happens.  Also make it
not be printed in silent mode (-q).

Modified:
    trunk/coregrind/m_syswrap/syswrap-generic.c

Modified: trunk/coregrind/m_syswrap/syswrap-generic.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-generic.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-generic.c Mon May 22 09:50:07 2017
@@ -1322,16 +1322,29 @@
    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;
    }
 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Valgrind-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/valgrind-developers
Reply | Threaded
Open this post in threaded view
|

Re: Valgrind: r16407 - /trunk/coregrind/m_syswrap/syswrap-generic.c

Petar Jovanovic
On Mon, May 22, 2017 at 10:50 AM,  <[hidden email]> wrote:

> Author: sewardj
> Date: Mon May 22 09:50:07 2017
> New Revision: 16407
>
> Log:
> Make the message "brk segment overflow in thread #%u: can't grow to %#lx"
> be printed only once, rather than every time it happens.  Also make it
> not be printed in silent mode (-q).
>
> Modified:
>     trunk/coregrind/m_syswrap/syswrap-generic.c
>
> Modified: trunk/coregrind/m_syswrap/syswrap-generic.c
> ==============================================================================
> --- trunk/coregrind/m_syswrap/syswrap-generic.c (original)
> +++ trunk/coregrind/m_syswrap/syswrap-generic.c Mon May 22 09:50:07 2017
> @@ -1322,16 +1322,29 @@
>     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;
>     }
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Valgrind-developers mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/valgrind-developers


Should this be followed by a change in the test suite?

Petar

diff --git a/memcheck/tests/linux/brk.stderr.exp
b/memcheck/tests/linux/brk.stderr.exp
index 8cbe622..ff83c1f 100644
--- a/memcheck/tests/linux/brk.stderr.exp
+++ b/memcheck/tests/linux/brk.stderr.exp
@@ -1,8 +1,7 @@

 brk segment overflow in thread #1: can't grow to 0x........
 (see section Limitations in user manual)
-brk segment overflow in thread #1: can't grow to 0x........
-(see section Limitations in user manual)
+NOTE: further instances of this message will not be shown

 HEAP SUMMARY:
     in use at exit: ... bytes in ... blocks
diff --git a/none/tests/linux/brk-overflow1.stderr.exp
b/none/tests/linux/brk-overflow1.stderr.exp
index 96741db..46242e3 100644
--- a/none/tests/linux/brk-overflow1.stderr.exp
+++ b/none/tests/linux/brk-overflow1.stderr.exp
@@ -1,4 +1,5 @@

 brk segment overflow in thread #1: can't grow to 0x........
 (see section Limitations in user manual)
+NOTE: further instances of this message will not be shown

diff --git a/none/tests/linux/brk-overflow2.stderr.exp
b/none/tests/linux/brk-overflow2.stderr.exp
index 5cdf1f7..46242e3 100644
--- a/none/tests/linux/brk-overflow2.stderr.exp
+++ b/none/tests/linux/brk-overflow2.stderr.exp
@@ -1,8 +1,5 @@

 brk segment overflow in thread #1: can't grow to 0x........
 (see section Limitations in user manual)
-brk segment overflow in thread #1: can't grow to 0x........
-(see section Limitations in user manual)
-brk segment overflow in thread #1: can't grow to 0x........
-(see section Limitations in user manual)
+NOTE: further instances of this message will not be shown

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Valgrind-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/valgrind-developers
Reply | Threaded
Open this post in threaded view
|

Re: Spam (9.522):Re: Valgrind: r16407 - /trunk/coregrind/m_syswrap/syswrap-generic.c

Julian Seward-2
On 23/05/17 15:06, Petar Jovanovic wrote:

>> Make the message "brk segment overflow in thread #%u: can't grow to %#lx"
>> be printed only once, rather than every time it happens.  Also make it
>> not be printed in silent mode (-q).

> Should this be followed by a change in the test suite?

Yes it should have been.  I should have run the test suite before
landing :-(

Thanks for spotting that.

J

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Valgrind-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/valgrind-developers