From: Julian Seward Date: Mon, 22 May 2017 08:50:07 +0000 (+0000) Subject: Make the message "brk segment overflow in thread #%u: can't grow to %#lx" X-Git-Tag: svn/VALGRIND_3_13_0~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f2c63135b9a5dd614b5b9872e6c4a4ac260045e;p=thirdparty%2Fvalgrind.git 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). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16407 --- diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 8e4ba695b1..b0fbfd9393 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -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; }