|
From: Ashley P. <as...@qu...> - 2006-10-25 18:44:45
|
Attached is a patch to include extra information in the xml output.
This is data which is printed normally but missing from xml, it makes it
tricky to re-form the normal output from the xml if the xml is
incomplete.
Ashley,
ashley:valgrind> svn diff memcheck/
Index: memcheck/mc_malloc_wrappers.c
===================================================================
--- memcheck/mc_malloc_wrappers.c (revision 6341)
+++ memcheck/mc_malloc_wrappers.c (working copy)
@@ -791,9 +791,7 @@
if (VG_(clo_verbosity) == 0)
return;
- if (VG_(clo_xml))
- return;
-
+
/* Count memory still in use. */
VG_(HT_ResetIter)(MC_(malloc_list));
while ( (mc = VG_(HT_Next)(MC_(malloc_list))) ) {
@@ -801,6 +799,21 @@
nbytes += mc->size;
}
+ if (VG_(clo_xml)) {
+ VG_(message)(Vg_UserMsg,
+ "<malloc_use>");
+ VG_(message)(Vg_UserMsg,
+ " <at_exit><bytes>%lu</bytes><blocks>%lu</blocks></at_exit>",
+ nbytes, nblocks);
+ VG_(message)(Vg_UserMsg,
+ " <total><allocs>%lu</allocs><frees>%lu</frees><bytes>%lu</bytes></total>",
+ cmalloc_n_mallocs,
+ cmalloc_n_frees, cmalloc_bs_mallocd);
+ VG_(message)(Vg_UserMsg,
+ "</malloc_use>");
+ return;
+ }
+
VG_(message)(Vg_UserMsg,
"malloc/free: in use at exit: %,lu bytes in %,lu blocks.",
nbytes, nblocks);
Index: memcheck/mc_leakcheck.c
===================================================================
--- memcheck/mc_leakcheck.c (revision 6341)
+++ memcheck/mc_leakcheck.c (working copy)
@@ -938,6 +938,23 @@
"To see them, rerun with: --show-reachable=yes");
}
}
+ if (VG_(clo_verbosity) > 0 && VG_(clo_xml)) {
+ VG_(message)(Vg_UserMsg, "<leak_summary>");
+ VG_(message)(Vg_UserMsg, " <lost>");
+ VG_(message)(Vg_UserMsg, " <definitely><bytes>%lu</bytes><blocks>%lu</blocks></definitely>",
+ MC_(bytes_leaked), blocks_leaked );
+ if (blocks_indirect > 0)
+ VG_(message)(Vg_UserMsg, " <indirectly><bytes>%lu</bytes><blocks>%lu</blocks></indirectly>",
+ MC_(bytes_indirect), blocks_indirect );
+ VG_(message)(Vg_UserMsg, " <possibly><bytes>%lu</bytes><blocks>%lu</blocks></possibly>",
+ MC_(bytes_dubious), blocks_dubious );
+ VG_(message)(Vg_UserMsg, " </lost>");
+ VG_(message)(Vg_UserMsg, " <reachable><bytes>%lu</bytes><blocks>%lu</blocks></reachable>",
+ MC_(bytes_reachable), blocks_reachable );
+ VG_(message)(Vg_UserMsg, " <suppressed><bytes>%lu</bytes><blocks>%lu</blocks></suppressed>",
+ MC_(bytes_suppressed), blocks_suppressed );
+ VG_(message)(Vg_UserMsg, "</leak_summary>");
+ }
VG_(free) ( lc_shadows );
VG_(free) ( lc_markstack );
|