From 651db2158938cb3089a024b90ff599b41bd87e5b Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Fri, 20 May 2005 02:29:52 +0000 Subject: [PATCH] Print error counts in the XML output. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3779 --- coregrind/m_errormgr.c | 26 +++++++++++++++++++++++++- coregrind/pub_core_errormgr.h | 10 ++++++---- coregrind/vg_main.c | 4 ++++ 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c index 79b2d15a3..260e4f585 100644 --- a/coregrind/m_errormgr.c +++ b/coregrind/m_errormgr.c @@ -253,6 +253,8 @@ static void pp_Error ( Error* err, Bool printCount ) { if (VG_(clo_xml)) { VG_(message)(Vg_UserMsg, ""); + VG_(message)(Vg_UserMsg, " 0x%llx", + Ptr_to_ULong(err)); VG_(message)(Vg_UserMsg, " %d", err->tid); } @@ -664,7 +666,8 @@ static Bool show_used_suppressions ( void ) } -/* This is called not from generated code but from the scheduler */ +/* Show all the errors that occurred, and possibly also the + suppressions used. */ void VG_(show_all_errors) ( void ) { Int i, n_min; @@ -749,6 +752,27 @@ void VG_(show_all_errors) ( void ) } } + +/* Show occurrence counts of all errors, in XML form. */ +void VG_(show_error_counts_as_XML) ( void ) +{ + Error* err; + VG_(message)(Vg_UserMsg, ""); + for (err = errors; err != NULL; err = err->next) { + if (err->supp != NULL) + continue; + if (err->count <= 0) + continue; + VG_(message)( + Vg_UserMsg, " 0x%llx" + "%d", + Ptr_to_ULong(err), err->count + ); + } + VG_(message)(Vg_UserMsg, ""); +} + + /*------------------------------------------------------------*/ /*--- Standard suppressions ---*/ /*------------------------------------------------------------*/ diff --git a/coregrind/pub_core_errormgr.h b/coregrind/pub_core_errormgr.h index 460297c3e..a40cdddc1 100644 --- a/coregrind/pub_core_errormgr.h +++ b/coregrind/pub_core_errormgr.h @@ -49,13 +49,15 @@ typedef } CoreErrorKind; -extern void VG_(load_suppressions) ( void ); +extern void VG_(load_suppressions) ( void ); -extern void VG_(show_all_errors) ( void ); +extern void VG_(show_all_errors) ( void ); -extern Bool VG_(is_action_requested) ( Char* action, Bool* clo ); +extern void VG_(show_error_counts_as_XML) ( void ); -extern UInt VG_(get_n_errs_found) ( void ); +extern Bool VG_(is_action_requested) ( Char* action, Bool* clo ); + +extern UInt VG_(get_n_errs_found) ( void ); #endif // __PUB_CORE_ERRORMGR_H diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c index a4b839c09..5910e36fc 100644 --- a/coregrind/vg_main.c +++ b/coregrind/vg_main.c @@ -2856,6 +2856,10 @@ void VG_(shutdown_actions)(ThreadId tid) VG_(message)(Vg_UserMsg, ""); if (VG_(clo_xml)) { + if (VG_(needs).core_errors || VG_(needs).tool_errors) { + VG_(show_error_counts_as_XML)(); + VG_(message)(Vg_UserMsg, ""); + } VG_(message)(Vg_UserMsg, "FINISHED"); VG_(message)(Vg_UserMsg, ""); }