]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Tidy up of messaging:
authorJulian Seward <jseward@acm.org>
Fri, 7 Aug 2009 15:46:56 +0000 (15:46 +0000)
committerJulian Seward <jseward@acm.org>
Fri, 7 Aug 2009 15:46:56 +0000 (15:46 +0000)
* For all tools and the core, don't show statistics when -v is in
  effect.  Instead, try to restrict -v to mostly user-useful
  stuff.

* A new flag --stats=no|yes [no] produces statistics output instead.

* Fix longstanding problem in that Memcheck's leak checker ran after
  the core's error manager module shut down, thereby not showing use
  counts of leak suppressions.  This fixes #186790.

* As a consequence, the leak checker text output of Memcheck has
  changed a bit -- leak check is done before the final error
  summary is done (much more logical), and the output has been
  tidied up a bit.

* Helgrind, Drd and Ptrcheck now also print "For counts of
  detected and suppressed errors, rerun with: -v", which makes
  them consistent with Memcheck in this regard.  These are
  filtered out by the regtest filter scripts.

For all tools except Memcheck, the regtests are unchanged.  On
Memcheck regtests still fail due to rearrangements of the leak
checker output.  This will be fixed by a followup commit.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10746

26 files changed:
cachegrind/cg_main.c
callgrind/main.c
coregrind/m_errormgr.c
coregrind/m_main.c
coregrind/m_options.c
drd/drd_main.c
drd/tests/filter_stderr
exp-ptrcheck/h_main.c
exp-ptrcheck/sg_main.c
exp-ptrcheck/tests/filter_stderr
helgrind/hg_main.c
helgrind/tests/filter_stderr
include/pub_tool_options.h
massif/ms_main.c
massif/tests/culling1.vgtest
massif/tests/culling2.vgtest
massif/tests/deep-B.vgtest
massif/tests/deep-C.vgtest
massif/tests/peak2.vgtest
massif/tests/realloc.vgtest
memcheck/mc_leakcheck.c
memcheck/mc_main.c
memcheck/mc_malloc_wrappers.c
memcheck/tests/filter_allocs
none/tests/cmdline1.stdout.exp
none/tests/cmdline2.stdout.exp

index 77e250a9330564159106754a7b13c3c6c2c5611b..b8c0a625c140fc0380a19b0c0158e1db2324bd6c 100644 (file)
@@ -1591,7 +1591,7 @@ static void cg_fini(Int exitcode)
    }
 
    // Various stats
-   if (VG_(clo_verbosity) > 1) {
+   if (VG_(clo_stats)) {
       Int debug_lookups = full_debugs      + fn_debugs +
                           file_line_debugs + no_debugs;
 
index 53ae058d039ea3ceecc770eaa99eca50fc794de7..c1ec141dfae8f40e862222495051a6ed56c56ee2 100644 (file)
@@ -1190,7 +1190,7 @@ void finish(void)
   if (VG_(clo_verbosity) == 0) return;
   
   /* Hash table stats */
-  if (VG_(clo_verbosity) > 1) {
+  if (VG_(clo_stats)) {
     int BB_lookups =
       CLG_(stat).full_debug_BBs +
       CLG_(stat).fn_name_debug_BBs +
index a92609ad38ee68d1cd98778effecdf42a495996c..41918357cce03fad73ccca5a8d44b90e50e4fc68 100644 (file)
@@ -806,7 +806,6 @@ static Bool show_used_suppressions ( void )
    for (su = suppressions; su != NULL; su = su->next) {
       if (su->count <= 0)
          continue;
-      any_supp = True;
       if (VG_(clo_xml)) {
          VG_(printf_xml_no_f_c)( "  <pair>\n"
                                  "    <count>%d</count>\n"
@@ -814,8 +813,12 @@ static Bool show_used_suppressions ( void )
                                  "  </pair>\n",
                                  su->count, su->sname );
       } else {
-         VG_(dmsg)("supp: %6d %s\n", su->count, su->sname);
+         // blank line before the first shown suppression, if any
+         if (!any_supp)
+            VG_(dmsg)("\n");
+         VG_(dmsg)("used_suppression: %6d %s\n", su->count, su->sname);
       }
+      any_supp = True;
    }
 
    if (VG_(clo_xml))
@@ -866,6 +869,9 @@ void VG_(show_all_errors) ( void )
    if (VG_(clo_verbosity) <= 1)
       return;
 
+   // We do the following only at -v or above, and only in non-XML
+   // mode
+
    /* Print the contexts in order of increasing error count. */
    for (i = 0; i < n_err_contexts; i++) {
       n_min = (1 << 30) - 1;
@@ -898,19 +904,16 @@ void VG_(show_all_errors) ( void )
       p_min->count = 1 << 30;
    } 
 
-   if (n_supp_contexts > 0) 
-      VG_(umsg)("\n");
    any_supp = show_used_suppressions();
 
-   if (n_err_contexts > 0) {
-      if (any_supp) 
-         VG_(umsg)("\n");
-      VG_(umsg)("IN SUMMARY: "
-                "%d errors from %d contexts (suppressed: %d from %d)\n",
-                n_errs_found, n_err_contexts, n_errs_suppressed,
-                n_supp_contexts );
+   if (any_supp) 
       VG_(umsg)("\n");
-   }
+   // reprint this, so users don't have to scroll way up to find
+   // the first printing
+   VG_(umsg)("ERROR SUMMARY: "
+             "%d errors from %d contexts (suppressed: %d from %d)\n",
+             n_errs_found, n_err_contexts, n_errs_suppressed,
+             n_supp_contexts );
 }
 
 
index 08a96a7c9e601da280721c1c5a47b1d40ca47ec9..edaf9193a7149398d567d5f73d6855c7415532ae 100644 (file)
@@ -119,7 +119,7 @@ static void usage_NORETURN ( Bool debug_help )
 "    --help-debug              show this message, plus debugging options\n"
 "    --version                 show version\n"
 "    -q --quiet                run silently; only print error msgs\n"
-"    -v --verbose              be more verbose, incl counts of errors\n"
+"    -v --verbose              be more verbose -- show misc extra info\n"
 "    --trace-children=no|yes   Valgrind-ise child processes (follow execve)? [no]\n"
 "    --child-silent-after-fork=no|yes omit child output between fork & exec? [no]\n"
 "    --track-fds=no|yes        track open file descriptors? [no]\n"
@@ -171,6 +171,7 @@ static void usage_NORETURN ( Bool debug_help )
    Char* usage2 = 
 "\n"
 "  debugging options for all Valgrind tools:\n"
+"    --stats=no|yes            show tool and core statistics [no]\n"
 "    -d                        show verbose debugging output\n"
 "    --sanity-level=<number>   level of sanity checking to do [1]\n"
 "    --trace-flags=<XXXXXXXX>   show generated code? (X = 0|1) [00000000]\n"
@@ -437,6 +438,7 @@ void main_process_cmd_line_options ( /*OUT*/Bool* logging_to_fd,
                VG_STREQ(arg, "--quiet"))
          VG_(clo_verbosity)--;
 
+      else if VG_BOOL_CLO(arg, "--stats",          VG_(clo_stats)) {}
       else if VG_BOOL_CLO(arg, "--xml",            VG_(clo_xml)) {}
       else if VG_BOOL_CLO(arg, "--db-attach",      VG_(clo_db_attach)) {}
       else if VG_BOOL_CLO(arg, "--demangle",       VG_(clo_demangle)) {}
@@ -2411,35 +2413,21 @@ void shutdown_actions_NORETURN( ThreadId tid,
    if (VG_(clo_track_fds))
       VG_(show_open_fds)();
 
-   /* ** HACK ALERT ** HACK ALERT ** HACK ALERT ** HACK ALERT ** */
-   if (VG_(clo_xml)) {
-      /* THIS IS WHAT WE SHOULD CHANGE IT TO */
-      /* For the moment, do it like this (the "right way") in XML
-         mode, so that output is as described in XML Protocol 4. */
-      /* A good test is memcheck/tests/amd64/defcfaexpr; ensure
-         the output does not change */
-      VG_TDICT_CALL(tool_fini, 0/*exitcode*/);
-
-      /* Show the error counts. */
-      if (VG_(needs).core_errors || VG_(needs).tool_errors) {
-         VG_(printf_xml)( "\n" );
-         VG_(show_error_counts_as_XML)();
-         VG_(printf_xml)( "\n" );
-      }
+   /* Call the tool's finalisation function.  This makes Memcheck's
+      leak checker run, and possibly chuck a bunch of leak errors into
+      the error management machinery. */
+   VG_TDICT_CALL(tool_fini, 0/*exitcode*/);
 
-      /* In XML mode, this merely prints the used suppressions. */
-      if (VG_(needs).core_errors || VG_(needs).tool_errors)
-         VG_(show_all_errors)();
-
-   } else {
-      /* THIS IS WHAT IT HAS ALWAYS BEEN,
-         resulting in  https://bugs.kde.org/show_bug.cgi?id=186790 */
-      if (VG_(needs).core_errors || VG_(needs).tool_errors)
-         VG_(show_all_errors)();
-
-      VG_TDICT_CALL(tool_fini, 0/*exitcode*/);
+   /* Show the error counts. */
+   if (VG_(needs).core_errors || VG_(needs).tool_errors) {
+      VG_(printf_xml)( "\n" );
+      VG_(show_error_counts_as_XML)();
+      VG_(printf_xml)( "\n" );
    }
-   /* END ** HACK ALERT ** HACK ALERT ** HACK ALERT ** HACK ALERT ** */
+
+   /* In XML mode, this merely prints the used suppressions. */
+   if (VG_(needs).core_errors || VG_(needs).tool_errors)
+      VG_(show_all_errors)();
 
    if (VG_(clo_xml)) {
       VG_(printf_xml)("\n");
@@ -2449,7 +2437,7 @@ void shutdown_actions_NORETURN( ThreadId tid,
 
    VG_(sanity_check_general)( True /*include expensive checks*/ );
 
-   if (VG_(clo_verbosity) > 1)
+   if (VG_(clo_stats))
       print_all_stats();
 
    /* Show a profile of the heap(s) at shutdown.  Optionally, first
index 0738befe53681008d990740e56a3515eb91426c9..3582818194ed5b66c6a373c0186a46f922e2b986 100644 (file)
@@ -51,6 +51,7 @@ Char*  VG_(clo_db_command)     = GDB_PATH " -nw %f %p";
 Int    VG_(clo_gen_suppressions) = 0;
 Int    VG_(clo_sanity_level)   = 1;
 Int    VG_(clo_verbosity)      = 1;
+Bool   VG_(clo_stats)          = False;
 Bool   VG_(clo_xml)            = False;
 HChar* VG_(clo_xml_user_comment) = NULL;
 Bool   VG_(clo_demangle)       = True;
index 840b8d5b9d73d2614aa8ada3240dab9a527eb1ba..03b523edfa78fec1fab66cabc55c110299fc8dea 100644 (file)
@@ -568,7 +568,13 @@ static void drd_start_client_code(const ThreadId tid, const ULong bbs_done)
 static void DRD_(fini)(Int exitcode)
 {
    // thread_print_all();
-   if (VG_(clo_verbosity) > 1 || DRD_(s_print_stats))
+   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_stats) || DRD_(s_print_stats))
    {
       ULong pu = DRD_(thread_get_update_conflict_set_count)();
       ULong pu_seg_cr = DRD_(thread_get_update_conflict_set_new_sg_count)();
index ee9ec45083a926bed9d28f6910e13c0fb6b727ad..e8aebb325ceba5d0fbe1150687bb4100824e1713 100755 (executable)
@@ -28,7 +28,8 @@ sed \
 -e "s/[@\$*]* (drd_pthread_intercepts.c:/ (drd_pthread_intercepts.c:/" \
 -e "s/ (\([a-zA-Z_]*\.c\):[0-9]*)/ (\1:?)/" \
 -e "s/ (\([a-zA-Z_]*\.h\):[0-9]*)/ (\1:?)/" \
--e "s/ (\([a-zA-Z_]*\.cpp\):[0-9]*)/ (\1:?)/" |
+-e "s/ (\([a-zA-Z_]*\.cpp\):[0-9]*)/ (\1:?)/" \
+-e "/^For counts of detected and suppressed errors, rerun with: -v$/d" |
 
 # Remove the message that more than hundred errors have been detected
 # (consists of two lines) and also the empty line above it.
index 7a91d3545947d381c8fb4d255bb8dae7a97f3f68..235b6589f9ece453a2f81de108e9cfdaa17a0dd2 100644 (file)
@@ -5328,7 +5328,13 @@ void h_post_clo_init ( void )
 
 void h_fini ( Int exitcode )
 {
-   if (VG_(clo_verbosity) >= 2) {
+   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_stats)) {
       VG_(message)(Vg_DebugMsg,
                    "  h_:  %'10llu client allocs, %'10llu client frees\n", 
                    stats__client_mallocs, stats__client_frees);
index 27ed7820782acd0a9cda76f7c7860293693dab31..5d324caa96128be43f580e1756de2cd1b13c2975 100644 (file)
@@ -2452,7 +2452,7 @@ void sg_pre_thread_first_insn ( ThreadId tid ) {
 
 void sg_fini(Int exitcode)
 {
-   if (VG_(clo_verbosity) >= 2) {
+   if (VG_(clo_stats)) {
       VG_(message)(Vg_DebugMsg,
          " sg_:  %'llu total accesses, of which:\n", stats__total_accesses);
       VG_(message)(Vg_DebugMsg,
index 11e5851a03585ad651cbe5a84bad9bfdccaad0e8..346262fa26cd64373212634805db4f2f8479765d 100755 (executable)
@@ -14,11 +14,12 @@ sed "s/(in \/.*libpthread.*)$/(in \/...libpthread...)/"             |
 # Anonymise paths like "__libc_start_main (../foo/bar/libc-quux.c:129)"
 sed "s/__libc_\(.*\) (.*)$/__libc_\1 (...libc...)/" |
 
-# Remove preambly stuff
+# Remove preambly stuff; also postambly stuff
 sed \
 -e "/^exp-ptrcheck, a heap, stack & global array overrun detector\.$/d" \
 -e "/^NOTE: This is an Experimental-Class Valgrind Tool.$/d"  \
--e "/^Copyright (C) 2003-200., and GNU GPL'd, by OpenWorks Ltd et al.$/d" |
+-e "/^Copyright (C) 2003-200., and GNU GPL'd, by OpenWorks Ltd et al.$/d" \
+-e "/^For counts of detected and suppressed errors, rerun with: -v$/d" |
 
 # Tidy up in cases where glibc (+ libdl + libpthread + ld) have
 # been built with debugging information, hence source locs are present.
index 7758a344df4cbd88faee12a97b59477e9f191aca..e6202623f4d013f0c27562651843fc7e7df78680 100644 (file)
@@ -4240,12 +4240,26 @@ static void hg_post_clo_init ( void )
 
 static void hg_fini ( Int exitcode )
 {
+   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)
+       && HG_(clo_history_level) >= 2) {
+      VG_(umsg)( 
+         "Use --history-level=approx or =none to gain increased speed, at\n" );
+      VG_(umsg)(
+         "the cost of reduced accuracy of conflicting-access information\n");
+   }
+
    if (SHOW_DATA_STRUCTURES)
       pp_everything( PP_ALL, "SK_(fini)" );
    if (HG_(clo_sanity_flags))
       all__sanity_check("SK_(fini)");
 
-   if (VG_(clo_verbosity) >= 2) {
+   if (VG_(clo_stats)) {
 
       if (1) {
          VG_(printf)("\n");
index 8b90d71265ce667fd480b9ba40478deaf079eaa6..07ea536ba13d8e827c41068acf67cace3e9e5010 100755 (executable)
@@ -7,8 +7,13 @@ $dir/../../tests/filter_stderr_basic                    |
 # Anonymise addresses
 $dir/../../tests/filter_addresses                       |
 
-# Remove "Helgrind, ..." line and the following copyright line.
-sed "/^Helgrind, a thread error detector/ , /./ d" |
+# Remove "Helgrind, ..." line and the following copyright line;
+# also the standard postamble (does such a word exist?)
+sed \
+ -e "/^Helgrind, a thread error detector/ , /./ d" \
+ -e "/^For counts of detected and suppressed errors, rerun with: -v$/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" |
 
 # Anonymise line numbers in hg_intercepts.c
 sed "s/hg_intercepts.c:[0-9]*/hg_intercepts.c:.../g"  |
index ec03af3b774e3ef1e93b4d59c47f0aa34d102cf3..f9e1b003d1ec66d8716412da72523ef894558b24 100644 (file)
 /* Verbosity level: 0 = silent, 1 (default), > 1 = more verbose. */
 extern Int  VG_(clo_verbosity);
 
+/* Show tool and core statistics */
+extern Bool VG_(clo_stats);
+
 /* Emit all messages as XML? default: NO */
 /* If clo_xml is set, various other options are set in a non-default
    way.  See vg_main.c and mc_main.c. */
index 585df2208b39495cd1d476bf0db015a3c5c6269e..ecfb31c9362a2afe25f2a0c366e45d96a1e9e1a3 100644 (file)
@@ -220,6 +220,12 @@ Number of snapshots: 50
       VG_(dmsg)("Massif: " format, ##args); \
    }
 
+// Used for printing stats when clo_stats == True.
+#define STATS(format, args...) \
+   if (VG_(clo_stats)) { \
+      VG_(dmsg)("Massif: " format, ##args); \
+   }
+
 //------------------------------------------------------------//
 //--- Statistics                                           ---//
 //------------------------------------------------------------//
@@ -2225,28 +2231,28 @@ static void ms_fini(Int exit_status)
 
    // Stats
    tl_assert(n_xpts > 0);  // always have alloc_xpt
-   VERB(1, "heap allocs:           %u\n", n_heap_allocs);
-   VERB(1, "heap reallocs:         %u\n", n_heap_reallocs);
-   VERB(1, "heap frees:            %u\n", n_heap_frees);
-   VERB(1, "ignored heap allocs:   %u\n", n_ignored_heap_allocs);
-   VERB(1, "ignored heap frees:    %u\n", n_ignored_heap_frees);
-   VERB(1, "ignored heap reallocs: %u\n", n_ignored_heap_reallocs);
-   VERB(1, "stack allocs:          %u\n", n_stack_allocs);
-   VERB(1, "stack frees:           %u\n", n_stack_frees);
-   VERB(1, "XPts:                  %u\n", n_xpts);
-   VERB(1, "top-XPts:              %u (%d%%)\n",
+   STATS("heap allocs:           %u\n", n_heap_allocs);
+   STATS("heap reallocs:         %u\n", n_heap_reallocs);
+   STATS("heap frees:            %u\n", n_heap_frees);
+   STATS("ignored heap allocs:   %u\n", n_ignored_heap_allocs);
+   STATS("ignored heap frees:    %u\n", n_ignored_heap_frees);
+   STATS("ignored heap reallocs: %u\n", n_ignored_heap_reallocs);
+   STATS("stack allocs:          %u\n", n_stack_allocs);
+   STATS("stack frees:           %u\n", n_stack_frees);
+   STATS("XPts:                  %u\n", n_xpts);
+   STATS("top-XPts:              %u (%d%%)\n",
       alloc_xpt->n_children,
       ( n_xpts ? alloc_xpt->n_children * 100 / n_xpts : 0));
-   VERB(1, "XPt init expansions:   %u\n", n_xpt_init_expansions);
-   VERB(1, "XPt later expansions:  %u\n", n_xpt_later_expansions);
-   VERB(1, "SXPt allocs:           %u\n", n_sxpt_allocs);
-   VERB(1, "SXPt frees:            %u\n", n_sxpt_frees);
-   VERB(1, "skipped snapshots:     %u\n", n_skipped_snapshots);
-   VERB(1, "real snapshots:        %u\n", n_real_snapshots);
-   VERB(1, "detailed snapshots:    %u\n", n_detailed_snapshots);
-   VERB(1, "peak snapshots:        %u\n", n_peak_snapshots);
-   VERB(1, "cullings:              %u\n", n_cullings);
-   VERB(1, "XCon redos:            %u\n", n_XCon_redos);
+   STATS("XPt init expansions:   %u\n", n_xpt_init_expansions);
+   STATS("XPt later expansions:  %u\n", n_xpt_later_expansions);
+   STATS("SXPt allocs:           %u\n", n_sxpt_allocs);
+   STATS("SXPt frees:            %u\n", n_sxpt_frees);
+   STATS("skipped snapshots:     %u\n", n_skipped_snapshots);
+   STATS("real snapshots:        %u\n", n_real_snapshots);
+   STATS("detailed snapshots:    %u\n", n_detailed_snapshots);
+   STATS("peak snapshots:        %u\n", n_peak_snapshots);
+   STATS("cullings:              %u\n", n_cullings);
+   STATS("XCon redos:            %u\n", n_XCon_redos);
 }
 
 
index c282f9bc8120824ef2d0606a20372aaa8a8e9ee2..eb5ad2f6d53e96e54de69e80e9743f18100b4023 100644 (file)
@@ -1,5 +1,5 @@
 prog: culling1
-vgopts: -v -v --stacks=no --time-unit=B --heap-admin=16 --massif-out-file=massif.out
+vgopts: -v -v --stats=yes --stacks=no --time-unit=B --heap-admin=16 --massif-out-file=massif.out
 vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 stderr_filter: filter_verbose
 cleanup: rm massif.out
index 9cd6032ae4d19bc78464cd179a9a1776222820dc..d0b234f217a2a713043b5da73577a50cc4c67e76 100644 (file)
@@ -1,5 +1,5 @@
 prog: culling2
-vgopts: -v -v --stacks=no --time-unit=B --heap-admin=16 --massif-out-file=massif.out
+vgopts: -v -v --stats=yes --stacks=no --time-unit=B --heap-admin=16 --massif-out-file=massif.out
 vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 stderr_filter: filter_verbose
 cleanup: rm massif.out
index f6e390d833b4c10730da09fcac0a86afd89fb768..ea3a3234c3d49abae68c53221ac6b859ac5c6de8 100644 (file)
@@ -1,5 +1,5 @@
 prog: deep
-vgopts: --stacks=no --time-unit=B --alloc-fn=a6 --alloc-fn=a7 --alloc-fn=a8 --alloc-fn=a9 --alloc-fn=a10 --alloc-fn=a11 --alloc-fn=a12 -v -v --depth=8 --massif-out-file=massif.out
+vgopts: --stats=yes --stacks=no --time-unit=B --alloc-fn=a6 --alloc-fn=a7 --alloc-fn=a8 --alloc-fn=a9 --alloc-fn=a10 --alloc-fn=a11 --alloc-fn=a12 -v -v --depth=8 --massif-out-file=massif.out
 vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 stderr_filter: filter_verbose
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
index b40ba36da37bfcd5276275ded74c86ff4749685f..34f92cda73e0a76ac7b0320b116829a781c4000d 100644 (file)
@@ -1,5 +1,5 @@
 prog: deep
-vgopts: --stacks=no --time-unit=B --alloc-fn=a3 --alloc-fn=a4 --alloc-fn=a5 --alloc-fn=a6 --alloc-fn=a7 --alloc-fn=a8 --alloc-fn=a9 --alloc-fn=a10 --alloc-fn=a11 --alloc-fn=a12 -v -v --depth=8 --massif-out-file=massif.out
+vgopts: --stacks=no --time-unit=B --alloc-fn=a3 --alloc-fn=a4 --alloc-fn=a5 --alloc-fn=a6 --alloc-fn=a7 --alloc-fn=a8 --alloc-fn=a9 --alloc-fn=a10 --alloc-fn=a11 --alloc-fn=a12 -v -v --stats=yes --depth=8 --massif-out-file=massif.out
 vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 stderr_filter: filter_verbose
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
index 91a6e496429bdc263ae89af594ab0fa88a046aa3..79e671ab194a5e8cf3389fddd0b9c8db619bc40a 100644 (file)
@@ -1,5 +1,5 @@
 prog: peak
-vgopts: --stacks=no --time-unit=B -v -v --peak-inaccuracy=10.0 --heap-admin=128 --massif-out-file=massif.out
+vgopts: --stacks=no --time-unit=B -v -v --stats=yes --peak-inaccuracy=10.0 --heap-admin=128 --massif-out-file=massif.out
 vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 stderr_filter: filter_verbose
 post: perl ../../massif/ms_print massif.out | ../../tests/filter_addresses
index 4344328979cf979b7f5ecbd86b1e31ed10e6ff85..bdb38d839e9a90f50a20600bcb8c7b0a937cbbc9 100644 (file)
@@ -1,5 +1,5 @@
 prog: realloc
-vgopts: -v -v --stacks=no --heap-admin=0 --time-unit=B --threshold=0 --massif-out-file=massif.out
+vgopts: -v -v --stats=yes --stacks=no --heap-admin=0 --time-unit=B --threshold=0 --massif-out-file=massif.out
 vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
 stderr_filter: filter_verbose
 post: perl ../../massif/ms_print --threshold=0 massif.out | ../../tests/filter_addresses
index ea1e1bea3fb1292a3816aa545624cf785a436c71..2e7513aa9960effc9fc2fe2d82fb820ee647151f 100644 (file)
@@ -918,6 +918,7 @@ void MC_(detect_memory_leaks) ( ThreadId tid, LeakCheckMode mode )
    if (lc_n_chunks == 0) {
       tl_assert(lc_chunks == NULL);
       if (VG_(clo_verbosity) >= 1 && !VG_(clo_xml)) {
+         VG_(umsg)("\n");
          VG_(umsg)("All heap blocks were freed -- no leaks are possible.\n");
       }
       return;
@@ -969,9 +970,11 @@ void MC_(detect_memory_leaks) ( ThreadId tid, LeakCheckMode mode )
    lc_markstack_top = -1;
 
    // Verbosity.
-   if (VG_(clo_verbosity) > 0 && !VG_(clo_xml))
-      VG_(umsg)( "searching for pointers to %'d not-freed blocks.\n",
+   if (VG_(clo_verbosity) > 1 && !VG_(clo_xml)) {
+      VG_(umsg)( "\n" );
+      VG_(umsg)( "Searching for pointers to %'d not-freed blocks.\n",
                  lc_n_chunks );
+   }
 
    // Scan the memory root-set, pushing onto the mark stack any blocks
    // pointed to.
@@ -1029,8 +1032,8 @@ void MC_(detect_memory_leaks) ( ThreadId tid, LeakCheckMode mode )
    // from the root-set has been traced.
    lc_process_markstack(/*clique*/-1);
 
-   if (VG_(clo_verbosity) > 0 && !VG_(clo_xml))
-      VG_(umsg)("checked %'lu bytes.\n", lc_scanned_szB);
+   if (VG_(clo_verbosity) > 1 && !VG_(clo_xml))
+      VG_(umsg)("Checked %'lu bytes.\n", lc_scanned_szB);
 
    // Trace all the leaked blocks to determine which are directly leaked and
    // which are indirectly leaked.  For each Unreached block, push it onto
index d83464fcda394863cf53461e255700d1c90e6a30..98043d51072f94fedcfda5340bc0ee91e7e80a54 100644 (file)
@@ -5569,15 +5569,24 @@ static void mc_fini ( Int exitcode )
 {
    MC_(print_malloc_stats)();
 
-   if (VG_(clo_verbosity) == 1 && !VG_(clo_xml)) {
-      if (MC_(clo_leak_check) == LC_Off)
-         VG_(message)(Vg_UserMsg, 
-            "For a detailed leak analysis,  rerun with: --leak-check=yes\n");
+   if (MC_(clo_leak_check) != LC_Off) {
+      MC_(detect_memory_leaks)(1/*bogus ThreadId*/, MC_(clo_leak_check));
+   }
 
+   if (VG_(clo_verbosity) == 1 && !VG_(clo_xml)
+       && MC_(clo_leak_check) == LC_Off) {
       VG_(message)(Vg_UserMsg, 
-                   "For counts of detected errors, rerun with: -v\n");
+         "For a detailed leak analysis, rerun with: --leak-check=yes\n");
    }
 
+   if (VG_(clo_verbosity) >= 1 && !VG_(clo_xml)) {
+      VG_(message)(Vg_UserMsg, "\n");
+   }
+
+   if (VG_(clo_verbosity) == 1 && !VG_(clo_xml)) {
+      VG_(message)(Vg_UserMsg, 
+                   "For counts of detected and suppressed errors, rerun with: -v\n");
+   }
 
    if (MC_(any_value_errors) && !VG_(clo_xml) && VG_(clo_verbosity) >= 1
        && MC_(clo_mc_level) == 2) {
@@ -5586,12 +5595,9 @@ static void mc_fini ( Int exitcode )
                    "uninitialised values come from\n");
    }
 
-   if (MC_(clo_leak_check) != LC_Off)
-      MC_(detect_memory_leaks)(1/*bogus ThreadId*/, MC_(clo_leak_check));
-
    done_prof_mem();
 
-   if (VG_(clo_verbosity) > 1) {
+   if (VG_(clo_stats)) {
       SizeT max_secVBit_szB, max_SMs_szB, max_shmem_szB;
       
       VG_(message)(Vg_DebugMsg,
index e1ceeb1a7fe806fe2685d73cd3f528ce45e979d3..bef9f5195b3b610d9a3c5d60c506eb3a1ba60c82 100644 (file)
@@ -902,17 +902,19 @@ void MC_(print_malloc_stats) ( void )
       nbytes += (ULong)mc->szB;
    }
 
-   VG_(message)(Vg_UserMsg, 
-      "malloc/free: in use at exit: %'llu bytes in %'lu blocks.\n",
+   VG_(umsg)(
+      "HEAP SUMMARY:\n"
+   );
+   VG_(umsg)(
+      "    in use at exit: %'llu bytes in %'lu blocks.\n",
       nbytes, nblocks
    );
-   VG_(message)(Vg_UserMsg, 
-      "malloc/free: %'lu allocs, %'lu frees, %'llu bytes allocated.\n",
+   VG_(umsg)(
+      "  total heap usage: %'lu allocs, %'lu frees, "
+      "%'llu bytes allocated.\n",
       cmalloc_n_mallocs,
       cmalloc_n_frees, cmalloc_bs_mallocd
    );
-   if (VG_(clo_verbosity) > 1)
-      VG_(message)(Vg_UserMsg, "\n");
 }
 
 /*--------------------------------------------------------------------*/
index 9013deb354e59a159c43bb2c7face174f5a98a35..5b58666b933e11baae39135f1f9d07d253c39c33 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
 
 ./filter_stderr |
-sed -e "s/malloc\/free: in use at exit: [0-9,]* bytes in [0-9,]* blocks./malloc\/free: in use at exit: ... bytes in ... blocks./" \
-    -e "s/malloc.free: [0-9,]* allocs, [0-9,]* frees, [0-9,]* bytes allocated./malloc\/free: ... allocs, ... frees, ... bytes allocated./"
+sed -e "s/in use at exit: [0-9,]* bytes in [0-9,]* blocks./in use at exit: ... bytes in ... blocks./" \
+    -e  "s/total heap usage: [0-9,]* allocs, [0-9,]* frees, [0-9,]* bytes allocated./total heap usage: ... allocs, ... frees, ... bytes allocated./"
 
index ee3dfdbf2084c5bf8fdcae94ccb4e7df1495e041..0fab2a28add8f3c3d6ec0cd555abbfaa47dfc5d9 100644 (file)
@@ -8,7 +8,7 @@ usage: valgrind [options] prog-and-args
     --help-debug              show this message, plus debugging options
     --version                 show version
     -q --quiet                run silently; only print error msgs
-    -v --verbose              be more verbose, incl counts of errors
+    -v --verbose              be more verbose -- show misc extra info
     --trace-children=no|yes   Valgrind-ise child processes (follow execve)? [no]
     --child-silent-after-fork=no|yes omit child output between fork & exec? [no]
     --track-fds=no|yes        track open file descriptors? [no]
index dc147a448efbee924e4585d0c5e43c756fefaff4..cb7e515c48ee8eae334a87c8e6dab1b0f2c0367a 100644 (file)
@@ -8,7 +8,7 @@ usage: valgrind [options] prog-and-args
     --help-debug              show this message, plus debugging options
     --version                 show version
     -q --quiet                run silently; only print error msgs
-    -v --verbose              be more verbose, incl counts of errors
+    -v --verbose              be more verbose -- show misc extra info
     --trace-children=no|yes   Valgrind-ise child processes (follow execve)? [no]
     --child-silent-after-fork=no|yes omit child output between fork & exec? [no]
     --track-fds=no|yes        track open file descriptors? [no]
@@ -60,6 +60,7 @@ usage: valgrind [options] prog-and-args
     (none)
 
   debugging options for all Valgrind tools:
+    --stats=no|yes            show tool and core statistics [no]
     -d                        show verbose debugging output
     --sanity-level=<number>   level of sanity checking to do [1]
     --trace-flags=<XXXXXXXX>   show generated code? (X = 0|1) [00000000]