drd, XML tracing: move newline generation into DRD_(trace_msg)() / change tracing output format slightly.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12146 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/drd/drd_error.c b/drd/drd_error.c
index eeea484..1a8c9d3 100644
--- a/drd/drd_error.c
+++ b/drd/drd_error.c
@@ -62,15 +62,34 @@
    va_list vargs;
    va_start(vargs, format);
    if (VG_(clo_xml)) {
-      VG_(printf_xml)("<traceline>\n  ");
+      VG_(printf_xml)("  <trace><text>");
       VG_(vprintf_xml)(format, vargs);
-      VG_(printf_xml)("</traceline>\n");
+      VG_(printf_xml)("</text></trace>\n");
    } else {
       VG_(vmessage)(Vg_UserMsg, format, vargs);
+      VG_(message)(Vg_UserMsg, "\n");
    }
    va_end(vargs);
 }
 
+void DRD_(trace_msg_w_bt)(const char* format, ...)
+{
+   va_list vargs;
+   va_start(vargs, format);
+   if (VG_(clo_xml)) {
+      VG_(printf_xml)("  <trace><text>");
+      VG_(vprintf_xml)(format, vargs);
+      VG_(printf_xml)("</text>\n");
+   } else {
+      VG_(vmessage)(Vg_UserMsg, format, vargs);
+      VG_(message)(Vg_UserMsg, "\n");
+   }
+   VG_(get_and_pp_StackTrace)(VG_(get_running_tid)(), VG_(clo_backtrace_size));
+   va_end(vargs);
+   if (VG_(clo_xml))
+      VG_(printf_xml)("  </trace>\n");
+}
+
 /**
  * Emit error message detail in the format requested by the user.
  */