Int i, n_min;
Error *p, *p_min;
Bool any_supp;
+ Bool any_error = False;
- if (verbosity == 0)
+ if (verbosity == 0 && !VG_(clo_show_error_list))
return;
/* If we're printing XML, just show the suppressions and stop. */
if (xml) {
- (void)show_used_suppressions();
+ if (VG_(clo_show_error_list))
+ (void)show_used_suppressions();
return;
}
/* We only get here if not printing XML. */
VG_(umsg)("ERROR SUMMARY: "
"%u errors from %u contexts (suppressed: %u from %u)\n",
- n_errs_found, n_err_contexts,
+ n_errs_found, n_err_contexts,
n_errs_suppressed, n_supp_contexts );
- if (verbosity <= 1)
+ if (!VG_(clo_show_error_list))
return;
- // We do the following only at -v or above, and only in non-XML
- // mode
+ // We do the following if VG_(clo_show_error_list)
+ // or at -v or above, and only in non-XML mode.
- /* Print the contexts in order of increasing error count.
+ /* Print the contexts in order of increasing error count.
Once an error is shown, we add a huge value to its count to filter it
out.
After having shown all errors, we reset count to the original value. */
// XXX: this isn't right. See bug 203651.
if (p_min == NULL) continue; //VG_(core_panic)("show_all_errors()");
+ any_error = True;
VG_(umsg)("\n");
VG_(umsg)("%d errors in context %d of %u:\n",
p_min->count, i+1, n_err_contexts);
}
p_min->count = p_min->count + (1 << 30);
- }
+ }
- /* reset the counts, otherwise a 2nd call does not show anything anymore */
+ /* reset the counts, otherwise a 2nd call does not show anything anymore */
for (p = errors; p != NULL; p = p->next) {
if (p->count >= (1 << 30))
p->count = p->count - (1 << 30);
any_supp = show_used_suppressions();
- if (any_supp)
+ if (any_supp)
VG_(umsg)("\n");
- // reprint this, so users don't have to scroll way up to find
+ // reprint summary, so users don't have to scroll way up to find
// the first printing
- VG_(umsg)("ERROR SUMMARY: "
- "%u errors from %u contexts (suppressed: %u from %u)\n",
- n_errs_found, n_err_contexts, n_errs_suppressed,
- n_supp_contexts );
+ if (any_supp || any_error)
+ VG_(umsg)("ERROR SUMMARY: "
+ "%u errors from %u contexts (suppressed: %u from %u)\n",
+ n_errs_found, n_err_contexts, n_errs_suppressed,
+ n_supp_contexts );
}
void VG_(show_last_error) ( void )
" --error-exitcode=<number> exit code to return if errors found [0=disable]\n"
" --error-markers=<begin>,<end> add lines with begin/end markers before/after\n"
" each error output in plain text mode [none]\n"
+" --show-error-list=no|yes show detected errors list and\n"
+" suppression counts at exit [no]\n"
+" -s same as --show-error-list=yes\n"
" --keep-debuginfo=no|yes Keep symbols etc for unloaded code [no]\n"
" This allows saved stack traces (e.g. memory leaks)\n"
" to include file/line info for code that has been\n"
Int toolname_len = VG_(strlen)(VG_(clo_toolname));
const HChar* tmp_str; // Used in a couple of places.
- /* Whether the user has explicitly provided --sigill-diagnostics.
+ /* Whether the user has explicitly provided --sigill-diagnostics
+ or --show-error-list.
If not explicitly given depends on general verbosity setting. */
Bool sigill_diag_set = False;
+ Bool show_error_list_set = False;
/* Log to stderr by default, but usage message goes to stdout. XML
output is initially disabled. */
startpos = *nextpos ? nextpos + 1 : nextpos;
}
}
+ else if VG_BOOL_CLO(arg, "--show-error-list", VG_(clo_show_error_list)) {
+ show_error_list_set = True; }
+ else if (VG_STREQ(arg, "-s")) {
+ VG_(clo_show_error_list) = True;
+ show_error_list_set = True;
+ }
else if VG_BOOL_CLO(arg, "--show-emwarns", VG_(clo_show_emwarns)) {}
else if VG_BOOL_CLO(arg, "--run-libc-freeres", VG_(clo_run_libc_freeres)) {}
if (!sigill_diag_set)
VG_(clo_sigill_diag) = (VG_(clo_verbosity) > 0);
+ if (!show_error_list_set) {
+ if (VG_(clo_xml))
+ VG_(clo_show_error_list) = VG_(clo_verbosity) >= 1;
+ else
+ VG_(clo_show_error_list) = VG_(clo_verbosity) >= 2;
+ }
+
if (VG_(clo_trace_notbelow) == -1) {
if (VG_(clo_trace_notabove) == -1) {
/* [] */
VG_TDICT_CALL(tool_fini, 0/*exitcode*/);
if (VG_(needs).core_errors || VG_(needs).tool_errors) {
- if (VG_(clo_verbosity) == 1 && !VG_(clo_xml))
- VG_(message)(Vg_UserMsg,
- "For counts of detected and suppressed errors, rerun with: -v\n");
+ if (VG_(clo_verbosity) == 1
+ && !VG_(clo_xml)
+ && !VG_(clo_show_error_list))
+ VG_(message)(Vg_UserMsg,
+ "For lists of detected and suppressed errors,"
+ " rerun with: -s\n");
/* Show the error counts. */
if (VG_(clo_xml)) {
HChar *VG_(clo_error_markers)[2] = {NULL, NULL};
Bool VG_(clo_exit_on_first_error) = False;
+Bool VG_(clo_show_error_list) = False;
+
#if defined(VGPV_arm_linux_android) \
|| defined(VGPV_x86_linux_android) \
|| defined(VGPV_mips32_linux_android) \
way. */
extern Int VG_(clo_error_exitcode);
+/* For tools that report errors, list detected errors and show suppression
+ usage counts at exit. Default: No.
+ Unless set explicitly by the user, the option is automatically
+ considered as set to yes for verbosity > 1. */
+extern Bool VG_(clo_show_error_list);
+
+
/* Markers used to mark the begin/end of an error, when errors are
printed in textual (non xml) format.
[0] is the error begin marker, [1] is the error end marker.
-e "s/ (\([a-zA-Z_]*\.cpp\):[0-9]*)/ (\1:?)/" \
-e "s/\( name [^ ]*\)-[0-9]*\( oflag \)/\1\2/" \
-e '/^ by 0x[0-9a-fA-F]*: process_dl_debug (in \/lib[0-9]*\/ld-[0-9.]*\.so)$/d' \
--e "/^For counts of detected and suppressed errors, rerun with: -v$/d" |
+-e "/^For detected errors list and suppressed errors count, rerun with: -s$/d" |
# Remove the message that more than hundred errors have been detected
# (consists of two lines) and also the empty line above it.
-e "/^exp-sgcheck, a stack and global array overrun detector$/d" \
-e "/^NOTE: This is an Experimental-Class Valgrind Tool$/d" \
-e "/^Copyright (C) 2003-201., and GNU GPL'd, by OpenWorks Ltd et al.$/d" \
--e "/^For counts of detected and suppressed errors, rerun with: -v$/d" |
+-e "/^For detected errors list and suppressed errors count, rerun with: -s$/d" |
# Tidy up in cases where glibc (+ libdl + libpthread + ld) have
# been built with debugging information, hence source locs are present.
# do not contain them (at least on gcc110/fedora18).
sed \
-e "/^Helgrind, a thread error detector/ , /./ d" \
- -e "/^For counts of detected and suppressed errors, rerun with: -v$/d" \
+ -e "/^For detected errors list and suppressed errors count, rerun with: -s$/d" \
-e "/^Use --history-level=approx or =none to gain increased speed, at$/d" \
-e "/^the cost of reduced accuracy of conflicting-access information$/d" \
-e "/pthread_create_WRK (hg_intercepts.c:/d" |