VG_TRACK(die_mem_brk, VG_(brk_base), seg->end + 1 - VG_(brk_base));
}
+static void PRINTF_CHECK(1, 2)
+possibly_complain_brk(const HChar *format, ...)
+{
+ static Bool alreadyComplained = False;
+ if (!alreadyComplained) {
+ alreadyComplained = True;
+ if (VG_(clo_verbosity) > 0) {
+ va_list vargs;
+ va_start(vargs, format);
+ VG_(vmessage)(Vg_UserMsg, format, vargs);
+ va_end(vargs);
+ VG_(umsg)("(See section Limitations in the user manual.)\n");
+ VG_(umsg)("NOTE: further instances of this message will not be "
+ "shown.\n");
+ }
+ }
+}
+
PRE(sys_brk)
{
/* unsigned long brk(caddr_t end_data_segment); */
vg_assert(VG_(brk_base) == VG_(brk_limit));
if (!VG_(setup_client_dataseg)()) {
- VG_(umsg)("Cannot map memory to initialize brk segment in thread #%d "
- "at %#lx\n", tid, VG_(brk_base));
+ possibly_complain_brk("Cannot map memory to initialize brk segment in "
+ "thread #%d at %#lx\n", tid, VG_(brk_base));
SET_STATUS_Failure(VKI_ENOMEM);
return;
}
Bool ok = VG_(am_create_reservation)(resvn_start, resvn_size, SmLower,
anon_size);
if (!ok) {
- VG_(umsg)("brk segment overflow in thread #%d: can't grow "
- "to %#lx\n", tid, new_brk);
+ possibly_complain_brk("brk segment overflow in thread #%d: can not "
+ "grow to %#lx\n", tid, new_brk);
SET_STATUS_Failure(VKI_ENOMEM);
return;
}
/* Address space manager will merge old and new data segments. */
sres = VG_(am_mmap_anon_fixed_client)(anon_start, anon_size, prot);
if (sr_isError(sres)) {
- VG_(umsg)("Cannot map memory to grow brk segment in thread #%d "
- "to %#lx\n", tid, new_brk);
+ possibly_complain_brk("Cannot map memory to grow brk segment in "
+ "thread #%d to %#lx\n", tid, new_brk);
SET_STATUS_Failure(VKI_ENOMEM);
return;
}
+
Invalid read of size 1
at 0x........: test_begin (brk.c:19)
by 0x........: main (brk.c:78)
by 0x........: main (brk.c:78)
Address 0x........ is 0 bytes after the brk data segment limit 0x........
-brk segment overflow in thread #1: can't grow to 0x........
+brk segment overflow in thread #1: can not grow to 0x........
+(See section Limitations in the user manual.)
+NOTE: further instances of this message will not be shown.
+
+HEAP SUMMARY:
+ in use at exit: 0 bytes in 0 blocks
+ total heap usage: 0 allocs, 0 frees, 0 bytes allocated
+
+For a detailed leak analysis, rerun with: --leak-check=full
+
+For counts of detected and suppressed errors, rerun with: -v
+ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)