/* postamble */
VG_(printf_xml)("</error>\n");
+ VG_(printf_xml)("\n");
} else {
}
VG_TDICT_CALL( tool_pp_Error, err );
+ VG_(umsg)("\n");
do_actions_on_error(err, allow_db_attach);
-
}
}
-/* Shared between VG_(maybe_record_error)() and VG_(unique_error)(),
- just for pretty printing purposes. */
-static Bool is_first_shown_context = True;
-
static Int n_errs_shown = 0;
/* Top-level entry point to the error management subsystem.
if (p->supp == NULL) {
n_err_contexts++;
n_errs_found++;
- /* A bit of prettyprinting, to ensure there's a blank line
- in between each error. */
- if (!is_first_shown_context) {
- if (VG_(clo_xml))
- VG_(printf_xml)("\n");
- else
- VG_(umsg)("\n");
- }
/* Actually show the error; more complex than you might think. */
pp_Error( p, /*allow_db_attach*/True );
/* update stats */
- is_first_shown_context = False;
n_errs_shown++;
} else {
n_supp_contexts++;
}
if (print_error) {
- /* A bit of prettyprinting, to ensure there's a blank line
- in between each error. */
- if (!is_first_shown_context) {
- if (VG_(clo_xml))
- VG_(printf_xml)("\n");
- else
- VG_(umsg)("\n");
- }
/* Actually show the error; more complex than you might think. */
pp_Error(&err, allow_db_attach);
/* update stats */
- is_first_shown_context = False;
n_errs_shown++;
}
return False;
VG_(printf_xml)(" </pair>\n");
}
VG_(printf_xml)("</errorcounts>\n");
+ VG_(printf_xml)("\n");
}
VG_(printf_xml)("<preamble>\n");
/* Tool details */
- umsg_or_xml( "%s%s%s%s, %s.%s\n",
+ umsg_or_xml( "%s%s%s%s, %s%s\n",
xpre,
VG_(details).name,
NULL == VG_(details).version ? "" : "-",
if (VG_(strlen)(toolname) >= 4 && VG_STREQN(4, toolname, "exp-")) {
umsg_or_xml(
- "%sNOTE: This is an Experimental-Class Valgrind Tool.%s\n",
+ "%sNOTE: This is an Experimental-Class Valgrind Tool%s\n",
xpre, xpost
);
}
VG_(printf_xml)("</preamble>\n");
}
+ // Print the parent PID, and other stuff, if necessary.
if (!VG_(clo_xml) && VG_(clo_verbosity) > 0 && !logging_to_fd) {
VG_(umsg)("Parent PID: %d\n", VG_(getppid)());
}
VG_(printf_xml)("</args>\n");
}
- // Empty line after the preamble
- if (VG_(clo_verbosity) > 0)
- VG_(umsg)("\n");
+ // Last thing in the preamble is a blank line.
if (VG_(clo_xml))
VG_(printf_xml)("\n");
+ else if (VG_(clo_verbosity) > 0)
+ VG_(umsg)("\n");
if (VG_(clo_verbosity) > 1) {
SysRes fd;
// Finalisation: cleanup, messages, etc. Order not so important, only
// affects what order the messages come.
//--------------------------------------------------------------
- if (VG_(clo_verbosity) > 0)
- VG_(message)(Vg_UserMsg, "\n");
+ // First thing in the post-amble is a blank line.
if (VG_(clo_xml))
VG_(printf_xml)("\n");
+ else if (VG_(clo_verbosity) > 0)
+ VG_(message)(Vg_UserMsg, "\n");
if (VG_(clo_xml)) {
HChar buf[50];
VG_(printf_xml_no_f_c)( "<status>\n"
" <state>FINISHED</state>\n"
" <time>%t</time>\n"
- "</status>\n",
+ "</status>\n"
+ "\n",
buf);
}
/* 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" );
}
/* In XML mode, this merely prints the used suppressions. */
(could_core && is_signal_from_kernel(tid, sigNo, info->si_code))
) &&
!VG_(clo_xml) ) {
- VG_(umsg)("\n");
VG_(umsg)(
+ "\n"
"Process terminating with default action of signal %d (%s)%s\n",
sigNo, signame(sigNo), core ? ": dumping core" : "");
}
VG_(pp_ExeContext)(lr->key.allocated_at);
} else { /* ! if (xml) */
- emit("\n");
if (lr->indirect_szB > 0) {
emit(
"%'lu (%'lu direct, %'lu indirect) bytes in %'u blocks"
}
if (VG_(clo_verbosity) > 0 && !VG_(clo_xml)) {
- VG_(umsg)("\n");
VG_(umsg)("LEAK SUMMARY:\n");
- VG_(umsg)(" definitely lost: %'lu bytes in %'lu blocks.\n",
+ VG_(umsg)(" definitely lost: %'lu bytes in %'lu blocks\n",
MC_(bytes_leaked), MC_(blocks_leaked) );
- VG_(umsg)(" indirectly lost: %'lu bytes in %'lu blocks.\n",
+ VG_(umsg)(" indirectly lost: %'lu bytes in %'lu blocks\n",
MC_(bytes_indirect), MC_(blocks_indirect) );
- VG_(umsg)(" possibly lost: %'lu bytes in %'lu blocks.\n",
+ VG_(umsg)(" possibly lost: %'lu bytes in %'lu blocks\n",
MC_(bytes_dubious), MC_(blocks_dubious) );
- VG_(umsg)(" still reachable: %'lu bytes in %'lu blocks.\n",
+ VG_(umsg)(" still reachable: %'lu bytes in %'lu blocks\n",
MC_(bytes_reachable), MC_(blocks_reachable) );
- VG_(umsg)(" suppressed: %'lu bytes in %'lu blocks.\n",
+ VG_(umsg)(" suppressed: %'lu bytes in %'lu blocks\n",
MC_(bytes_suppressed), MC_(blocks_suppressed) );
if (!is_full_check &&
(MC_(blocks_leaked) + MC_(blocks_indirect) +
MC_(blocks_dubious) + MC_(blocks_reachable)) > 0) {
VG_(umsg)("Rerun with --leak-check=full to see details "
- "of leaked memory.\n");
+ "of leaked memory\n");
}
if (is_full_check &&
MC_(blocks_reachable) > 0 && !MC_(clo_show_reachable))
VG_(umsg)("To see them, rerun with: --leak-check=full "
"--show-reachable=yes\n");
}
+ VG_(umsg)("\n");
}
}
if (lc_n_chunks == 0) {
tl_assert(lc_chunks == NULL);
if (VG_(clo_verbosity) >= 1 && !VG_(clo_xml)) {
+ VG_(umsg)("All heap blocks were freed -- no leaks are possible\n");
VG_(umsg)("\n");
- VG_(umsg)("All heap blocks were freed -- no leaks are possible.\n");
}
return;
}
// Verbosity.
if (VG_(clo_verbosity) > 1 && !VG_(clo_xml)) {
- VG_(umsg)( "\n" );
- VG_(umsg)( "Searching for pointers to %'d not-freed blocks.\n",
+ VG_(umsg)( "Searching for pointers to %'d not-freed blocks\n",
lc_n_chunks );
}
// from the root-set has been traced.
lc_process_markstack(/*clique*/-1);
- if (VG_(clo_verbosity) > 1 && !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);
+ VG_(umsg)( "\n" );
+ }
// Trace all the leaked blocks to determine which are directly leaked and
// which are indirectly leaked. For each Unreached block, push it onto
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 a detailed leak analysis, rerun with: --leak-check=yes\n");
- }
-
- if (VG_(clo_verbosity) >= 1 && !VG_(clo_xml)) {
- VG_(message)(Vg_UserMsg, "\n");
+ } else {
+ if (VG_(clo_verbosity) == 1 && !VG_(clo_xml)) {
+ VG_(umsg)(
+ "For a detailed leak analysis, rerun with: --leak-check=full\n"
+ "\n"
+ );
+ }
}
if (VG_(clo_verbosity) == 1 && !VG_(clo_xml)) {
VG_(umsg)(
"HEAP SUMMARY:\n"
- );
- VG_(umsg)(
- " in use at exit: %'llu bytes in %'lu blocks.\n",
- nbytes, nblocks
- );
- VG_(umsg)(
- " total heap usage: %'lu allocs, %'lu frees, "
- "%'llu bytes allocated.\n",
+ " in use at exit: %'llu bytes in %'lu blocks\n"
+ " total heap usage: %'lu allocs, %'lu frees, %'llu bytes allocated\n"
+ "\n",
+ nbytes, nblocks,
cmalloc_n_mallocs,
cmalloc_n_frees, cmalloc_bs_mallocd
);