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_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>");   
    }