From: Julian Seward Date: Thu, 13 Jun 2002 17:23:38 +0000 (+0000) Subject: Add --event-horizon=yes|no [yes] so that the limit on errors shown X-Git-Tag: svn/VALGRIND_1_0_3~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f5d408d6025f4a34c506aea6d5625426b73db1d;p=thirdparty%2Fvalgrind.git Add --event-horizon=yes|no [yes] so that the limit on errors shown can be disabled if desired. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@414 --- diff --git a/coregrind/valgrind.in b/coregrind/valgrind.in index 713506f5f7..fbec27c0a4 100755 --- a/coregrind/valgrind.in +++ b/coregrind/valgrind.in @@ -41,6 +41,8 @@ do --verbose) vgopts="$vgopts -v"; shift;; -q) vgopts="$vgopts $arg"; shift;; --quiet) vgopts="$vgopts $arg"; shift;; + --event-horizon=no) vgopts="$vgopts $arg"; shift;; + --event-horizon=yes) vgopts="$vgopts $arg"; shift;; --check-addrVs=no) vgopts="$vgopts $arg"; shift;; --check-addrVs=yes) vgopts="$vgopts $arg"; shift;; --gdb-attach=no) vgopts="$vgopts $arg"; shift;; @@ -121,6 +123,7 @@ if [ $# = 0 ] || [ z"$dousage" = z1 ]; then echo " --gdb-attach=no|yes start GDB when errors detected? [no]" echo " --demangle=no|yes automatically demangle C++ names? [yes]" echo " --num-callers= show callers in stack traces [4]" + echo " --event-horizon=no|yes stop showing new errors if too many? [yes]" echo " --partial-loads-ok=no|yes too hard to explain here; see manual [yes]" echo " --leak-check=no|yes search for memory leaks at exit? [no]" echo " --leak-resolution=low|med|high" diff --git a/coregrind/vg_errcontext.c b/coregrind/vg_errcontext.c index d5e0abb43d..60eaba05e2 100644 --- a/coregrind/vg_errcontext.c +++ b/coregrind/vg_errcontext.c @@ -497,8 +497,9 @@ static void VG_(maybe_add_context) ( ErrContext* ec ) 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 (VG_(clo_event_horizon) + && (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, ""); @@ -516,6 +517,12 @@ static void VG_(maybe_add_context) ( ErrContext* ec ) VG_(message)(Vg_UserMsg, "Final error counts will be inaccurate. Go fix your program!"); + VG_(message)(Vg_UserMsg, + "Rerun with --event-horizon=no to disable this cutoff. Note"); + VG_(message)(Vg_UserMsg, + "that your program may now segfault without prior warning from"); + VG_(message)(Vg_UserMsg, + "Valgrind, because errors are no longer being displayed."); VG_(message)(Vg_UserMsg, ""); stopping_message = True; vg_ignore_errors = True; diff --git a/coregrind/vg_include.h b/coregrind/vg_include.h index a48076515e..97d6b4e3d6 100644 --- a/coregrind/vg_include.h +++ b/coregrind/vg_include.h @@ -218,8 +218,10 @@ typedef struct { #define VG_CLO_MAX_SFILES 10 +/* Should we stop collecting errors if too many appear? default: YES */ +extern Bool VG_(clo_event_horizon); /* Shall we V-check addrs (they are always A checked too): default: YES */ -extern Bool VG_(clo_check_addrVs); +extern Bool VG_(clo_check_addrVs); /* Enquire about whether to attach to GDB at errors? default: NO */ extern Bool VG_(clo_GDB_attach); /* Sanity-check level: 0 = none, 1 (default), > 1 = expensive. */ diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c index 29cd3d631e..ceec5d0452 100644 --- a/coregrind/vg_main.c +++ b/coregrind/vg_main.c @@ -399,6 +399,7 @@ UInt VG_(num_scheduling_events_MAJOR) = 0; Values derived from command-line options. ------------------------------------------------------------------ */ +Bool VG_(clo_event_horizon); Bool VG_(clo_check_addrVs); Bool VG_(clo_GDB_attach); Int VG_(sanity_level); @@ -532,6 +533,7 @@ static void process_cmd_line_options ( void ) # define STREQN(nn,s1,s2) (0==VG_(strncmp_ws)((s1),(s2),(nn))) /* Set defaults. */ + VG_(clo_event_horizon) = True; VG_(clo_check_addrVs) = True; VG_(clo_GDB_attach) = False; VG_(sanity_level) = 1; @@ -708,6 +710,11 @@ static void process_cmd_line_options ( void ) else if (STREQ(argv[i], "-q") || STREQ(argv[i], "--quiet")) VG_(clo_verbosity)--; + else if (STREQ(argv[i], "--event-horizon=yes")) + VG_(clo_event_horizon) = True; + else if (STREQ(argv[i], "--event-horizon=no")) + VG_(clo_event_horizon) = False; + else if (STREQ(argv[i], "--check-addrVs=yes")) VG_(clo_check_addrVs) = True; else if (STREQ(argv[i], "--check-addrVs=no")) diff --git a/valgrind.in b/valgrind.in index 713506f5f7..fbec27c0a4 100755 --- a/valgrind.in +++ b/valgrind.in @@ -41,6 +41,8 @@ do --verbose) vgopts="$vgopts -v"; shift;; -q) vgopts="$vgopts $arg"; shift;; --quiet) vgopts="$vgopts $arg"; shift;; + --event-horizon=no) vgopts="$vgopts $arg"; shift;; + --event-horizon=yes) vgopts="$vgopts $arg"; shift;; --check-addrVs=no) vgopts="$vgopts $arg"; shift;; --check-addrVs=yes) vgopts="$vgopts $arg"; shift;; --gdb-attach=no) vgopts="$vgopts $arg"; shift;; @@ -121,6 +123,7 @@ if [ $# = 0 ] || [ z"$dousage" = z1 ]; then echo " --gdb-attach=no|yes start GDB when errors detected? [no]" echo " --demangle=no|yes automatically demangle C++ names? [yes]" echo " --num-callers= show callers in stack traces [4]" + echo " --event-horizon=no|yes stop showing new errors if too many? [yes]" echo " --partial-loads-ok=no|yes too hard to explain here; see manual [yes]" echo " --leak-check=no|yes search for memory leaks at exit? [no]" echo " --leak-resolution=low|med|high" diff --git a/vg_errcontext.c b/vg_errcontext.c index d5e0abb43d..60eaba05e2 100644 --- a/vg_errcontext.c +++ b/vg_errcontext.c @@ -497,8 +497,9 @@ static void VG_(maybe_add_context) ( ErrContext* ec ) 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 (VG_(clo_event_horizon) + && (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, ""); @@ -516,6 +517,12 @@ static void VG_(maybe_add_context) ( ErrContext* ec ) VG_(message)(Vg_UserMsg, "Final error counts will be inaccurate. Go fix your program!"); + VG_(message)(Vg_UserMsg, + "Rerun with --event-horizon=no to disable this cutoff. Note"); + VG_(message)(Vg_UserMsg, + "that your program may now segfault without prior warning from"); + VG_(message)(Vg_UserMsg, + "Valgrind, because errors are no longer being displayed."); VG_(message)(Vg_UserMsg, ""); stopping_message = True; vg_ignore_errors = True; diff --git a/vg_include.h b/vg_include.h index a48076515e..97d6b4e3d6 100644 --- a/vg_include.h +++ b/vg_include.h @@ -218,8 +218,10 @@ typedef struct { #define VG_CLO_MAX_SFILES 10 +/* Should we stop collecting errors if too many appear? default: YES */ +extern Bool VG_(clo_event_horizon); /* Shall we V-check addrs (they are always A checked too): default: YES */ -extern Bool VG_(clo_check_addrVs); +extern Bool VG_(clo_check_addrVs); /* Enquire about whether to attach to GDB at errors? default: NO */ extern Bool VG_(clo_GDB_attach); /* Sanity-check level: 0 = none, 1 (default), > 1 = expensive. */ diff --git a/vg_main.c b/vg_main.c index 29cd3d631e..ceec5d0452 100644 --- a/vg_main.c +++ b/vg_main.c @@ -399,6 +399,7 @@ UInt VG_(num_scheduling_events_MAJOR) = 0; Values derived from command-line options. ------------------------------------------------------------------ */ +Bool VG_(clo_event_horizon); Bool VG_(clo_check_addrVs); Bool VG_(clo_GDB_attach); Int VG_(sanity_level); @@ -532,6 +533,7 @@ static void process_cmd_line_options ( void ) # define STREQN(nn,s1,s2) (0==VG_(strncmp_ws)((s1),(s2),(nn))) /* Set defaults. */ + VG_(clo_event_horizon) = True; VG_(clo_check_addrVs) = True; VG_(clo_GDB_attach) = False; VG_(sanity_level) = 1; @@ -708,6 +710,11 @@ static void process_cmd_line_options ( void ) else if (STREQ(argv[i], "-q") || STREQ(argv[i], "--quiet")) VG_(clo_verbosity)--; + else if (STREQ(argv[i], "--event-horizon=yes")) + VG_(clo_event_horizon) = True; + else if (STREQ(argv[i], "--event-horizon=no")) + VG_(clo_event_horizon) = False; + else if (STREQ(argv[i], "--check-addrVs=yes")) VG_(clo_check_addrVs) = True; else if (STREQ(argv[i], "--check-addrVs=no"))