From 1a257661deed3d6689034e1399d1424ed9f76220 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Wed, 24 Apr 2002 21:03:47 +0000 Subject: [PATCH] VG_(maybe_add_context): also stop collecting errors when the total number (in contrast to the total number of _different_) of them gets too high. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@139 --- coregrind/vg_errcontext.c | 29 ++++++++++++++++++++++------- coregrind/vg_include.h | 6 +++++- vg_errcontext.c | 29 ++++++++++++++++++++++------- vg_include.h | 6 +++++- 4 files changed, 54 insertions(+), 16 deletions(-) diff --git a/coregrind/vg_errcontext.c b/coregrind/vg_errcontext.c index ac945e8fbf..fae6df0987 100644 --- a/coregrind/vg_errcontext.c +++ b/coregrind/vg_errcontext.c @@ -466,16 +466,31 @@ static void VG_(maybe_add_context) ( ErrContext* ec ) vg_assert(ec->tid >= 0 && ec->tid < VG_N_THREADS); - /* After M_VG_COLLECT_NO_ERRORS_AFTER different errors have been - found, just refuse to collect any more. */ - if (vg_n_errs_shown >= M_VG_COLLECT_NO_ERRORS_AFTER) { + /* After M_VG_COLLECT_NO_ERRORS_AFTER_SHOWN different errors have + been found, or M_VG_COLLECT_NO_ERRORS_AFTER_FOUND total errors + have been found, just refuse to collect any more. This stops + the burden of the error-management system becoming excessive in + extremely buggy programs, although it does make it pretty + pointless to continue the Valgrind run after this point. */ + if (vg_n_errs_shown >= M_VG_COLLECT_NO_ERRORS_AFTER_SHOWN + || vg_n_errs_found >= M_VG_COLLECT_NO_ERRORS_AFTER_FOUND) { if (!stopping_message) { VG_(message)(Vg_UserMsg, ""); + + if (vg_n_errs_shown >= M_VG_COLLECT_NO_ERRORS_AFTER_SHOWN) { + VG_(message)(Vg_UserMsg, + "More than %d different errors detected. " + "I'm not reporting any more.", + M_VG_COLLECT_NO_ERRORS_AFTER_SHOWN ); + } else { + VG_(message)(Vg_UserMsg, + "More than %d total errors detected. " + "I'm not reporting any more.", + M_VG_COLLECT_NO_ERRORS_AFTER_FOUND ); + } + VG_(message)(Vg_UserMsg, - "More than %d errors detected. I'm not reporting any more.", - M_VG_COLLECT_NO_ERRORS_AFTER); - VG_(message)(Vg_UserMsg, - "Final error counts may be inaccurate. Go fix your program!"); + "Final error counts will be inaccurate. Go fix your program!"); VG_(message)(Vg_UserMsg, ""); stopping_message = True; vg_ignore_errors = True; diff --git a/coregrind/vg_include.h b/coregrind/vg_include.h index 19b635fb10..7ffafa0a29 100644 --- a/coregrind/vg_include.h +++ b/coregrind/vg_include.h @@ -98,7 +98,11 @@ /* After this many different unsuppressed errors have been observed, stop collecting errors at all, and tell the user their program is evidently a steaming pile of camel dung. */ -#define M_VG_COLLECT_NO_ERRORS_AFTER 500 +#define M_VG_COLLECT_NO_ERRORS_AFTER_SHOWN 500 + +/* After this many total errors have been observed, stop collecting + errors at all. Counterpart to M_VG_COLLECT_NO_ERRORS_AFTER_SHOWN. */ +#define M_VG_COLLECT_NO_ERRORS_AFTER_FOUND 5000 /* These many bytes below %ESP are considered addressible if we're doing the --workaround-gcc296-bugs hack. */ diff --git a/vg_errcontext.c b/vg_errcontext.c index ac945e8fbf..fae6df0987 100644 --- a/vg_errcontext.c +++ b/vg_errcontext.c @@ -466,16 +466,31 @@ static void VG_(maybe_add_context) ( ErrContext* ec ) vg_assert(ec->tid >= 0 && ec->tid < VG_N_THREADS); - /* After M_VG_COLLECT_NO_ERRORS_AFTER different errors have been - found, just refuse to collect any more. */ - if (vg_n_errs_shown >= M_VG_COLLECT_NO_ERRORS_AFTER) { + /* After M_VG_COLLECT_NO_ERRORS_AFTER_SHOWN different errors have + been found, or M_VG_COLLECT_NO_ERRORS_AFTER_FOUND total errors + have been found, just refuse to collect any more. This stops + the burden of the error-management system becoming excessive in + extremely buggy programs, although it does make it pretty + pointless to continue the Valgrind run after this point. */ + if (vg_n_errs_shown >= M_VG_COLLECT_NO_ERRORS_AFTER_SHOWN + || vg_n_errs_found >= M_VG_COLLECT_NO_ERRORS_AFTER_FOUND) { if (!stopping_message) { VG_(message)(Vg_UserMsg, ""); + + if (vg_n_errs_shown >= M_VG_COLLECT_NO_ERRORS_AFTER_SHOWN) { + VG_(message)(Vg_UserMsg, + "More than %d different errors detected. " + "I'm not reporting any more.", + M_VG_COLLECT_NO_ERRORS_AFTER_SHOWN ); + } else { + VG_(message)(Vg_UserMsg, + "More than %d total errors detected. " + "I'm not reporting any more.", + M_VG_COLLECT_NO_ERRORS_AFTER_FOUND ); + } + VG_(message)(Vg_UserMsg, - "More than %d errors detected. I'm not reporting any more.", - M_VG_COLLECT_NO_ERRORS_AFTER); - VG_(message)(Vg_UserMsg, - "Final error counts may be inaccurate. Go fix your program!"); + "Final error counts will be inaccurate. Go fix your program!"); VG_(message)(Vg_UserMsg, ""); stopping_message = True; vg_ignore_errors = True; diff --git a/vg_include.h b/vg_include.h index 19b635fb10..7ffafa0a29 100644 --- a/vg_include.h +++ b/vg_include.h @@ -98,7 +98,11 @@ /* After this many different unsuppressed errors have been observed, stop collecting errors at all, and tell the user their program is evidently a steaming pile of camel dung. */ -#define M_VG_COLLECT_NO_ERRORS_AFTER 500 +#define M_VG_COLLECT_NO_ERRORS_AFTER_SHOWN 500 + +/* After this many total errors have been observed, stop collecting + errors at all. Counterpart to M_VG_COLLECT_NO_ERRORS_AFTER_SHOWN. */ +#define M_VG_COLLECT_NO_ERRORS_AFTER_FOUND 5000 /* These many bytes below %ESP are considered addressible if we're doing the --workaround-gcc296-bugs hack. */ -- 2.47.2