Print error counts in the XML output.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3779 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c
index 79b2d15..260e4f5 100644
--- a/coregrind/m_errormgr.c
+++ b/coregrind/m_errormgr.c
@@ -253,6 +253,8 @@
 {
    if (VG_(clo_xml)) {
       VG_(message)(Vg_UserMsg, "<error>");
+      VG_(message)(Vg_UserMsg, "  <unique>0x%llx</unique>",
+                                  Ptr_to_ULong(err));
       VG_(message)(Vg_UserMsg, "  <tid>%d</tid>", err->tid);
    }
 
@@ -664,7 +666,8 @@
 }
 
 
-/* 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 @@
    }
 }
 
+
+/* Show occurrence counts of all errors, in XML form. */
+void VG_(show_error_counts_as_XML) ( void )
+{
+   Error* err;
+   VG_(message)(Vg_UserMsg, "<errorcounts>");
+   for (err = errors; err != NULL; err = err->next) {
+      if (err->supp != NULL)
+         continue;
+      if (err->count <= 0)
+         continue;
+      VG_(message)(
+         Vg_UserMsg, "  <pair><unique>0x%llx</unique>"
+                     "<count>%d</count></pair>",
+         Ptr_to_ULong(err), err->count
+      );
+   }
+   VG_(message)(Vg_UserMsg, "</errorcounts>");
+}
+
+
 /*------------------------------------------------------------*/
 /*--- Standard suppressions                                ---*/
 /*------------------------------------------------------------*/