Minor refinements/bug-fixes to XML printing.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3837 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_debuginfo/symtab.c b/coregrind/m_debuginfo/symtab.c
index 5ed4141..3153fd8 100644
--- a/coregrind/m_debuginfo/symtab.c
+++ b/coregrind/m_debuginfo/symtab.c
@@ -2448,29 +2448,39 @@
if (VG_(clo_xml)) {
+ Bool human_readable = True;
+ HChar* maybe_newline = human_readable ? "\n " : "";
+ HChar* maybe_newline2 = human_readable ? "\n " : "";
+
/* Print in XML format, dumping in as much info as we know. */
APPEND("<frame>");
VG_(sprintf)(ibuf,"<ip>0x%llx</ip>", (ULong)eip);
+ APPEND(maybe_newline);
APPEND(ibuf);
if (know_objname) {
+ APPEND(maybe_newline);
APPEND("<obj>");
APPEND(buf_obj);
APPEND("</obj>");
}
if (know_fnname) {
+ APPEND(maybe_newline);
APPEND("<fn>");
APPEND(buf_fn);
APPEND("</fn>");
}
if (know_srcloc) {
+ APPEND(maybe_newline);
APPEND("<file>");
APPEND(buf_srcloc);
APPEND("</file>");
+ APPEND(maybe_newline);
APPEND("<line>");
VG_(sprintf)(ibuf,"%d",lineno);
APPEND(ibuf);
APPEND("</line>");
}
+ APPEND(maybe_newline2);
APPEND("</frame>");
} else {
diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c
index a2d0a7c..01d90b1 100644
--- a/coregrind/m_errormgr.c
+++ b/coregrind/m_errormgr.c
@@ -660,7 +660,10 @@
any_supp = True;
if (VG_(clo_xml)) {
VG_(message)(Vg_DebugMsg,
- " <pair><count>%d</count><name>%s</name></pair>",
+ " <pair>\n"
+ " <count>%d</count>\n"
+ " <name>%s</name>\n"
+ " </pair>",
su->count, su->sname);
} else {
VG_(message)(Vg_DebugMsg, "supp: %4d %s", su->count, su->sname);
@@ -668,7 +671,7 @@
}
if (VG_(clo_xml))
- VG_(message)(Vg_DebugMsg, "<suppcounts>");
+ VG_(message)(Vg_DebugMsg, "</suppcounts>");
return any_supp;
}
@@ -772,8 +775,8 @@
if (err->count <= 0)
continue;
VG_(message)(
- Vg_UserMsg, " <pair><count>%d</count>"
- "<unique>0x%llx</unique></pair>",
+ Vg_UserMsg, " <pair> <count>%d</count> "
+ "<unique>0x%llx</unique> </pair>",
err->count, Ptr_to_ULong(err)
);
}
diff --git a/coregrind/m_main.c b/coregrind/m_main.c
index fc97303..f40df26 100644
--- a/coregrind/m_main.c
+++ b/coregrind/m_main.c
@@ -1924,6 +1924,8 @@
if (VG_(clo_xml)) {
VG_(message)(Vg_UserMsg, "");
+ VG_(message)(Vg_UserMsg, "<?xml version=\"1.0\"?>");
+ VG_(message)(Vg_UserMsg, "");
VG_(message)(Vg_UserMsg, "<valgrindoutput>");
VG_(message)(Vg_UserMsg, "");
VG_(message)(Vg_UserMsg, "<protocolversion>1</protocolversion>");
@@ -1977,8 +1979,11 @@
VG_(message)(Vg_UserMsg, "<tool>%s</tool>", toolname);
VG_(message)(Vg_UserMsg, "");
VG_(message)(Vg_UserMsg, "<argv>");
- for (i = 0; i < VG_(client_argc); i++)
- VG_(message)(Vg_UserMsg, " <arg>%s</arg>", VG_(client_argv)[i]);
+ for (i = 0; i < VG_(client_argc); i++) {
+ HChar* tag = i==0 ? "exe" : "arg";
+ VG_(message)(Vg_UserMsg, " <%s>%s</%s>",
+ tag, VG_(client_argv)[i], tag);
+ }
VG_(message)(Vg_UserMsg, "</argv>");
}