aboutsummaryrefslogtreecommitdiff
path: root/coregrind/m_errormgr.c
diff options
context:
space:
mode:
Diffstat (limited to 'coregrind/m_errormgr.c')
-rw-r--r--coregrind/m_errormgr.c128
1 files changed, 55 insertions, 73 deletions
diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c
index 047c7f36b..ec45800ee 100644
--- a/coregrind/m_errormgr.c
+++ b/coregrind/m_errormgr.c
@@ -289,16 +289,15 @@ static Bool eq_Error ( VgRes res, Error* e1, Error* e2 )
static void pp_Error ( Error* err )
{
if (VG_(clo_xml)) {
- VG_(message)(Vg_UserMsg, "<error>");
- VG_(message)(Vg_UserMsg, " <unique>0x%x</unique>",
- err->unique);
- VG_(message)(Vg_UserMsg, " <tid>%d</tid>", err->tid);
+ VG_UMSG("<error>");
+ VG_UMSG(" <unique>0x%x</unique>", err->unique);
+ VG_UMSG(" <tid>%d</tid>", err->tid);
}
if (!VG_(clo_xml)) {
if (VG_(tdict).tool_show_ThreadIDs_for_errors
&& err->tid > 0 && err->tid != last_tid_printed) {
- VG_(message)(Vg_UserMsg, "Thread %d:", err->tid );
+ VG_UMSG("Thread %d:", err->tid );
last_tid_printed = err->tid;
}
}
@@ -321,7 +320,7 @@ static void pp_Error ( Error* err )
}
if (VG_(clo_xml))
- VG_(message)(Vg_UserMsg, "</error>");
+ VG_UMSG("</error>");
}
/* Figure out if we want to perform a given action for this error, possibly
@@ -334,7 +333,7 @@ Bool VG_(is_action_requested) ( Char* action, Bool* clo )
if (*clo == False)
return False;
- VG_(message)(Vg_UserMsg, "");
+ VG_UMSG("");
again:
VG_(printf)(
@@ -432,9 +431,8 @@ static void gen_suppression(Error* err)
} else {
Char* name = VG_TDICT_CALL(tool_get_error_name, err);
if (NULL == name) {
- VG_(message)(Vg_UserMsg,
- "(%s does not allow error to be suppressed)",
- VG_(details).name);
+ VG_UMSG("(%s does not allow error to be suppressed)",
+ VG_(details).name);
return;
}
VG_(printf)("{\n");
@@ -504,29 +502,25 @@ void VG_(maybe_record_error) ( ThreadId tid,
|| n_errs_found >= M_COLLECT_NO_ERRORS_AFTER_FOUND)
&& !VG_(clo_xml)) {
if (!stopping_message) {
- VG_(message)(Vg_UserMsg, "");
+ VG_UMSG("");
if (n_errs_shown >= M_COLLECT_NO_ERRORS_AFTER_SHOWN) {
- VG_(message)(Vg_UserMsg,
+ VG_UMSG(
"More than %d different errors detected. "
"I'm not reporting any more.",
M_COLLECT_NO_ERRORS_AFTER_SHOWN );
} else {
- VG_(message)(Vg_UserMsg,
+ VG_UMSG(
"More than %d total errors detected. "
"I'm not reporting any more.",
M_COLLECT_NO_ERRORS_AFTER_FOUND );
}
- VG_(message)(Vg_UserMsg,
- "Final error counts will be inaccurate. Go fix your program!");
- VG_(message)(Vg_UserMsg,
- "Rerun with --error-limit=no to disable this cutoff. Note");
- VG_(message)(Vg_UserMsg,
- "that errors may occur in your program without prior warning from");
- VG_(message)(Vg_UserMsg,
- "Valgrind, because errors are no longer being displayed.");
- VG_(message)(Vg_UserMsg, "");
+ VG_UMSG("Final error counts will be inaccurate. Go fix your program!");
+ VG_UMSG("Rerun with --error-limit=no to disable this cutoff. Note");
+ VG_UMSG("that errors may occur in your program without prior warning from");
+ VG_UMSG("Valgrind, because errors are no longer being displayed.");
+ VG_UMSG("");
stopping_message = True;
}
return;
@@ -539,12 +533,10 @@ void VG_(maybe_record_error) ( ThreadId tid,
&& !VG_(clo_xml)) {
exe_res = Vg_LowRes;
if (!slowdown_message) {
- VG_(message)(Vg_UserMsg, "");
- VG_(message)(Vg_UserMsg,
- "More than %d errors detected. Subsequent errors",
- M_COLLECT_ERRORS_SLOWLY_AFTER);
- VG_(message)(Vg_UserMsg,
- "will still be recorded, but in less detail than before.");
+ VG_UMSG("");
+ VG_UMSG("More than %d errors detected. Subsequent errors",
+ M_COLLECT_ERRORS_SLOWLY_AFTER);
+ VG_UMSG("will still be recorded, but in less detail than before.");
slowdown_message = True;
}
}
@@ -631,7 +623,7 @@ void VG_(maybe_record_error) ( ThreadId tid,
if (p->supp == NULL) {
n_errs_found++;
if (!is_first_shown_context)
- VG_(message)(Vg_UserMsg, "");
+ VG_UMSG("");
pp_Error(p);
is_first_shown_context = False;
n_errs_shown++;
@@ -675,7 +667,7 @@ Bool VG_(unique_error) ( ThreadId tid, ErrorKind ekind, Addr a, Char* s,
if (print_error) {
if (!is_first_shown_context)
- VG_(message)(Vg_UserMsg, "");
+ VG_UMSG("");
pp_Error(&err);
is_first_shown_context = False;
n_errs_shown++;
@@ -703,7 +695,7 @@ static Bool show_used_suppressions ( void )
Bool any_supp;
if (VG_(clo_xml))
- VG_(message)(Vg_DebugMsg, "<suppcounts>");
+ VG_UMSG("<suppcounts>");
any_supp = False;
for (su = suppressions; su != NULL; su = su->next) {
@@ -718,12 +710,12 @@ static Bool show_used_suppressions ( void )
" </pair>",
su->count, su->sname);
} else {
- VG_(message)(Vg_DebugMsg, "supp: %6d %s", su->count, su->sname);
+ VG_DMSG("supp: %6d %s", su->count, su->sname);
}
}
if (VG_(clo_xml))
- VG_(message)(Vg_DebugMsg, "</suppcounts>");
+ VG_UMSG("</suppcounts>");
return any_supp;
}
@@ -762,11 +754,10 @@ void VG_(show_all_errors) ( void )
}
/* We only get here if not printing XML. */
- VG_(message)(Vg_UserMsg,
- "ERROR SUMMARY: "
- "%d errors from %d contexts (suppressed: %d from %d)",
- n_errs_found, n_err_contexts,
- n_errs_suppressed, n_supp_contexts );
+ VG_UMSG("ERROR SUMMARY: "
+ "%d errors from %d contexts (suppressed: %d from %d)",
+ n_errs_found, n_err_contexts,
+ n_errs_suppressed, n_supp_contexts );
if (VG_(clo_verbosity) <= 1)
return;
@@ -784,10 +775,9 @@ void VG_(show_all_errors) ( void )
}
if (p_min == NULL) VG_(tool_panic)("show_all_errors()");
- VG_(message)(Vg_UserMsg, "");
- VG_(message)(Vg_UserMsg, "%d errors in context %d of %d:",
- p_min->count,
- i+1, n_err_contexts);
+ VG_UMSG("");
+ VG_UMSG("%d errors in context %d of %d:",
+ p_min->count, i+1, n_err_contexts);
pp_Error( p_min );
if ((i+1 == VG_(clo_dump_error))) {
@@ -802,18 +792,17 @@ void VG_(show_all_errors) ( void )
}
if (n_supp_contexts > 0)
- VG_(message)(Vg_DebugMsg, "");
+ VG_UMSG( "");
any_supp = show_used_suppressions();
if (n_err_contexts > 0) {
if (any_supp)
- VG_(message)(Vg_UserMsg, "");
- VG_(message)(Vg_UserMsg,
- "IN SUMMARY: "
- "%d errors from %d contexts (suppressed: %d from %d)",
- n_errs_found, n_err_contexts, n_errs_suppressed,
- n_supp_contexts );
- VG_(message)(Vg_UserMsg, "");
+ VG_UMSG("");
+ VG_UMSG("IN SUMMARY: "
+ "%d errors from %d contexts (suppressed: %d from %d)",
+ n_errs_found, n_err_contexts, n_errs_suppressed,
+ n_supp_contexts );
+ VG_UMSG("");
}
}
@@ -822,21 +811,18 @@ void VG_(show_all_errors) ( void )
void VG_(show_error_counts_as_XML) ( void )
{
Error* err;
- VG_(message)(Vg_UserMsg, "<errorcounts>");
+ VG_UMSG("<errorcounts>");
for (err = errors; err != NULL; err = err->next) {
if (err->supp != NULL)
continue;
if (err->count <= 0)
continue;
- VG_(message)(
- Vg_UserMsg, " <pair>\n"
- " <count>%d</count>\n"
- " <unique>0x%x</unique>\n"
- " </pair>",
- err->count, err->unique
- );
+ VG_UMSG(" <pair>");
+ VG_UMSG(" <count>%d</count>", err->count);
+ VG_UMSG(" <unique>0x%x</unique>", err->unique);
+ VG_UMSG(" </pair>");
}
- VG_(message)(Vg_UserMsg, "</errorcounts>");
+ VG_UMSG("</errorcounts>");
}
@@ -974,9 +960,8 @@ static void load_one_suppressions_file ( Char* filename )
sres = VG_(open)( filename, VKI_O_RDONLY, 0 );
if (sres.isError) {
if (VG_(clo_xml))
- VG_(message)(Vg_UserMsg, "</valgrindoutput>\n");
- VG_(message)(Vg_UserMsg, "FATAL: can't open suppressions file \"%s\"",
- filename );
+ VG_UMSG("</valgrindoutput>\n");
+ VG_UMSG("FATAL: can't open suppressions file \"%s\"", filename );
VG_(exit)(1);
}
fd = sres.res;
@@ -1132,15 +1117,13 @@ static void load_one_suppressions_file ( Char* filename )
syntax_error:
if (VG_(clo_xml))
- VG_(message)(Vg_UserMsg, "</valgrindoutput>\n");
- VG_(message)(Vg_UserMsg,
- "FATAL: in suppressions file \"%s\" near line %d:",
- filename, lineno );
- VG_(message)(Vg_UserMsg,
- " %s", err_str );
+ VG_UMSG("</valgrindoutput>\n");
+ VG_UMSG("FATAL: in suppressions file \"%s\" near line %d:",
+ filename, lineno );
+ VG_UMSG(" %s", err_str );
VG_(close)(fd);
- VG_(message)(Vg_UserMsg, "exiting now.");
+ VG_UMSG("exiting now.");
VG_(exit)(1);
# undef BOMB
@@ -1154,8 +1137,7 @@ void VG_(load_suppressions) ( void )
suppressions = NULL;
for (i = 0; i < VG_(clo_n_suppressions); i++) {
if (VG_(clo_verbosity) > 1) {
- VG_(message)(Vg_DebugMsg, "Reading suppressions file: %s",
- VG_(clo_suppressions)[i] );
+ VG_DMSG("Reading suppressions file: %s", VG_(clo_suppressions)[i] );
}
load_one_suppressions_file( VG_(clo_suppressions)[i] );
}
@@ -1313,11 +1295,11 @@ static Supp* is_suppressible_error ( Error* err )
*/
void VG_(print_errormgr_stats) ( void )
{
- VG_(message)(Vg_DebugMsg,
+ VG_DMSG(
" errormgr: %'lu supplist searches, %'lu comparisons during search",
em_supplist_searches, em_supplist_cmps
);
- VG_(message)(Vg_DebugMsg,
+ VG_DMSG(
" errormgr: %'lu errlist searches, %'lu comparisons during search",
em_errlist_searches, em_errlist_cmps
);