]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
VG_(maybe_add_context): also stop collecting errors when the total
authorJulian Seward <jseward@acm.org>
Wed, 24 Apr 2002 21:03:47 +0000 (21:03 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 24 Apr 2002 21:03:47 +0000 (21:03 +0000)
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
coregrind/vg_include.h
vg_errcontext.c
vg_include.h

index ac945e8fbf20d869a1eea94df4e29d178a05e962..fae6df098739a9cf257193614dbbec8bd543ee2f 100644 (file)
@@ -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;
index 19b635fb106510468571c07d6d6524b3c3ebce17..7ffafa0a2917c473e6ae0611a2e42f81df48f0b3 100644 (file)
 /* 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. */
index ac945e8fbf20d869a1eea94df4e29d178a05e962..fae6df098739a9cf257193614dbbec8bd543ee2f 100644 (file)
@@ -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;
index 19b635fb106510468571c07d6d6524b3c3ebce17..7ffafa0a2917c473e6ae0611a2e42f81df48f0b3 100644 (file)
 /* 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. */