|
From: <sv...@va...> - 2009-05-10 20:17:39
|
Author: sewardj
Date: 2009-05-10 21:17:27 +0100 (Sun, 10 May 2009)
New Revision: 9827
Log:
Cause XML output generated by the core, to go through to the XML
output channel rather than the normal one.
Modified:
branches/MESSAGING_TIDYUP/coregrind/m_errormgr.c
branches/MESSAGING_TIDYUP/coregrind/m_libcprint.c
branches/MESSAGING_TIDYUP/coregrind/m_main.c
branches/MESSAGING_TIDYUP/coregrind/m_stacktrace.c
Modified: branches/MESSAGING_TIDYUP/coregrind/m_errormgr.c
===================================================================
--- branches/MESSAGING_TIDYUP/coregrind/m_errormgr.c 2009-05-10 19:48:20 UTC (rev 9826)
+++ branches/MESSAGING_TIDYUP/coregrind/m_errormgr.c 2009-05-10 20:17:27 UTC (rev 9827)
@@ -289,9 +289,9 @@
static void pp_Error ( Error* err )
{
if (VG_(clo_xml)) {
- VG_(UMSG)("<error>\n");
- VG_(UMSG)(" <unique>0x%x</unique>\n", err->unique);
- VG_(UMSG)(" <tid>%d</tid>\n", err->tid);
+ VG_(printf_xml)("<error>\n");
+ VG_(printf_xml)(" <unique>0x%x</unique>\n", err->unique);
+ VG_(printf_xml)(" <tid>%d</tid>\n", err->tid);
}
if (!VG_(clo_xml)) {
@@ -320,7 +320,7 @@
}
if (VG_(clo_xml))
- VG_(UMSG)("</error>\n");
+ VG_(printf_xml)("</error>\n");
}
/* Figure out if we want to perform a given action for this error, possibly
@@ -696,7 +696,7 @@
Bool any_supp;
if (VG_(clo_xml))
- VG_(UMSG)("<suppcounts>\n");
+ VG_(printf_xml)("<suppcounts>\n");
any_supp = False;
for (su = suppressions; su != NULL; su = su->next) {
@@ -704,19 +704,18 @@
continue;
any_supp = True;
if (VG_(clo_xml)) {
- VG_(message_no_f_c)(Vg_DebugMsg,
- " <pair>\n"
- " <count>%d</count>\n"
- " <name>%t</name>\n"
- " </pair>\n",
- su->count, su->sname);
+ VG_(printf_xml_no_f_c)( " <pair>\n"
+ " <count>%d</count>\n"
+ " <name>%t</name>\n"
+ " </pair>\n",
+ su->count, su->sname );
} else {
VG_(DMSG)("supp: %6d %s\n", su->count, su->sname);
}
}
if (VG_(clo_xml))
- VG_(UMSG)("</suppcounts>\n");
+ VG_(printf_xml)("</suppcounts>\n");
return any_supp;
}
@@ -812,18 +811,18 @@
void VG_(show_error_counts_as_XML) ( void )
{
Error* err;
- VG_(UMSG)("<errorcounts>\n");
+ VG_(printf_xml)("<errorcounts>\n");
for (err = errors; err != NULL; err = err->next) {
if (err->supp != NULL)
continue;
if (err->count <= 0)
continue;
- VG_(UMSG)(" <pair>\n");
- VG_(UMSG)(" <count>%d</count>\n", err->count);
- VG_(UMSG)(" <unique>0x%x</unique>\n", err->unique);
- VG_(UMSG)(" </pair>\n");
+ VG_(printf_xml)(" <pair>\n");
+ VG_(printf_xml)(" <count>%d</count>\n", err->count);
+ VG_(printf_xml)(" <unique>0x%x</unique>\n", err->unique);
+ VG_(printf_xml)(" </pair>\n");
}
- VG_(UMSG)("</errorcounts>\n");
+ VG_(printf_xml)("</errorcounts>\n");
}
Modified: branches/MESSAGING_TIDYUP/coregrind/m_libcprint.c
===================================================================
--- branches/MESSAGING_TIDYUP/coregrind/m_libcprint.c 2009-05-10 19:48:20 UTC (rev 9826)
+++ branches/MESSAGING_TIDYUP/coregrind/m_libcprint.c 2009-05-10 20:17:27 UTC (rev 9827)
@@ -166,7 +166,7 @@
UInt ret;
va_list vargs;
va_start(vargs, format);
- ret = VG_(vprintf)(format, vargs);
+ ret = VG_(vprintf_xml)(format, vargs);
va_end(vargs);
return ret;
}
Modified: branches/MESSAGING_TIDYUP/coregrind/m_main.c
===================================================================
--- branches/MESSAGING_TIDYUP/coregrind/m_main.c 2009-05-10 19:48:20 UTC (rev 9826)
+++ branches/MESSAGING_TIDYUP/coregrind/m_main.c 2009-05-10 20:17:27 UTC (rev 9827)
@@ -911,131 +911,128 @@
Char* xml_fname_unexpanded,
const HChar* toolname )
{
+ Int i;
HChar* xpre = VG_(clo_xml) ? " <line>" : "";
HChar* xpost = VG_(clo_xml) ? "</line>" : "";
- Int i;
+ UInt (*umsg_or_xml)( const HChar*, ... )
+ = VG_(clo_xml) ? VG_(printf_xml) : VG_(UMSG);
vg_assert( VG_(args_for_client) );
vg_assert( VG_(args_for_valgrind) );
vg_assert( toolname );
if (VG_(clo_xml)) {
- VG_(message)(Vg_UserMsg, "<?xml version=\"1.0\"?>\n");
- VG_(message)(Vg_UserMsg, "\n");
- VG_(message)(Vg_UserMsg, "<valgrindoutput>\n");
- VG_(message)(Vg_UserMsg, "\n");
- VG_(message)(Vg_UserMsg, "<protocolversion>3</protocolversion>\n");
- VG_(message)(Vg_UserMsg, "\n");
+ VG_(printf_xml)("<?xml version=\"1.0\"?>\n");
+ VG_(printf_xml)("\n");
+ VG_(printf_xml)("<valgrindoutput>\n");
+ VG_(printf_xml)("\n");
+ VG_(printf_xml)("<protocolversion>3</protocolversion>\n");
+ VG_(printf_xml)("\n");
}
- if (VG_(clo_verbosity > 0)) {
+ if (VG_(clo_xml) || VG_(clo_verbosity > 0)) {
if (VG_(clo_xml))
- VG_(message)(Vg_UserMsg, "<preamble>\n");
+ VG_(printf_xml)("<preamble>\n");
/* Tool details */
- VG_(message)(Vg_UserMsg, "%s%s%s%s, %s.%s\n",
+ umsg_or_xml( "%s%s%s%s, %s.%s\n",
xpre,
VG_(details).name,
NULL == VG_(details).version ? "" : "-",
NULL == VG_(details).version
? (Char*)"" : VG_(details).version,
VG_(details).description,
- xpost);
+ xpost );
if (VG_(strlen)(toolname) >= 4
&& 0 == VG_(strncmp)(toolname, "exp-", 4)) {
- VG_(message)(
- Vg_UserMsg,
+ umsg_or_xml(
"%sNOTE: This is an Experimental-Class Valgrind Tool.%s\n",
xpre, xpost
);
}
- VG_(message)(Vg_UserMsg, "%s%s%s\n",
+ umsg_or_xml("%s%s%s\n",
xpre, VG_(details).copyright_author, xpost);
/* Core details */
- VG_(message)(Vg_UserMsg,
+ umsg_or_xml(
"%sUsing LibVEX rev %s, a library for dynamic binary translation.%s\n",
xpre, LibVEX_Version(), xpost );
- VG_(message)(Vg_UserMsg,
- "%sCopyright (C) 2004-2009, and GNU GPL'd, by OpenWorks LLP.%s\n",
+ umsg_or_xml(
+ "%sCopyright (C) 2004-2009, and GNU GPL'd, by OpenWorks Ltd.%s\n",
xpre, xpost );
- VG_(message)(Vg_UserMsg,
+ umsg_or_xml(
"%sUsing valgrind-%s, a dynamic binary instrumentation framework.%s\n",
xpre, VERSION, xpost);
- VG_(message)(Vg_UserMsg,
+ umsg_or_xml(
"%sCopyright (C) 2000-2009, and GNU GPL'd, by Julian Seward et al.%s\n",
xpre, xpost );
if (VG_(clo_verbosity) == 1 && !VG_(clo_xml))
- VG_(message)(Vg_UserMsg, "For more details, rerun with: -v\n");
+ VG_(UMSG)("For more details, rerun with: -v\n");
if (VG_(clo_xml))
- VG_(message)(Vg_UserMsg, "</preamble>\n");
+ VG_(printf_xml)("</preamble>\n");
}
if (!VG_(clo_xml) && VG_(clo_verbosity) > 0 && !logging_to_fd) {
- VG_(message)(Vg_UserMsg, "\n");
- VG_(message)(Vg_UserMsg,
- "My PID = %d, parent PID = %d. Prog and args are:\n",
- VG_(getpid)(), VG_(getppid)() );
+ VG_(UMSG)("\n");
+ VG_(UMSG)("My PID = %d, parent PID = %d. Prog and args are:\n",
+ VG_(getpid)(), VG_(getppid)() );
if (VG_(args_the_exename))
- VG_(message)(Vg_UserMsg, " %s\n", VG_(args_the_exename));
+ VG_(UMSG)(" %s\n", VG_(args_the_exename));
for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++)
- VG_(message)(Vg_UserMsg,
- " %s\n",
- * (HChar**) VG_(indexXA)( VG_(args_for_client), i ));
+ VG_(UMSG)(" %s\n",
+ * (HChar**) VG_(indexXA)( VG_(args_for_client), i ));
}
else
if (VG_(clo_xml)) {
- VG_(message)(Vg_UserMsg, "\n");
- VG_(message)(Vg_UserMsg, "<pid>%d</pid>\n", VG_(getpid)());
- VG_(message)(Vg_UserMsg, "<ppid>%d</ppid>\n", VG_(getppid)());
- VG_(message_no_f_c)(Vg_UserMsg, "<tool>%t</tool>\n", toolname);
+ VG_(printf_xml)("\n");
+ VG_(printf_xml)("<pid>%d</pid>\n", VG_(getpid)());
+ VG_(printf_xml)("<ppid>%d</ppid>\n", VG_(getppid)());
+ VG_(printf_xml_no_f_c)("<tool>%t</tool>\n", toolname);
if (xml_fname_unexpanded)
print_file_vars(xml_fname_unexpanded);
if (VG_(clo_xml_user_comment)) {
/* Note: the user comment itself is XML and is therefore to
be passed through verbatim (%s) rather than escaped
(%t). */
- VG_(message)(Vg_UserMsg, "<usercomment>%s</usercomment>\n",
- VG_(clo_xml_user_comment));
+ VG_(printf_xml)("<usercomment>%s</usercomment>\n",
+ VG_(clo_xml_user_comment));
}
- VG_(message)(Vg_UserMsg, "\n");
- VG_(message)(Vg_UserMsg, "<args>\n");
+ VG_(printf_xml)("\n");
+ VG_(printf_xml)("<args>\n");
- VG_(message)(Vg_UserMsg, " <vargv>\n");
+ VG_(printf_xml)(" <vargv>\n");
if (VG_(name_of_launcher))
- VG_(message_no_f_c)(Vg_UserMsg, " <exe>%t</exe>\n",
- VG_(name_of_launcher));
+ VG_(printf_xml_no_f_c)(" <exe>%t</exe>\n",
+ VG_(name_of_launcher));
else
- VG_(message_no_f_c)(Vg_UserMsg, " <exe>%t</exe>\n",
- "(launcher name unknown)");
+ VG_(printf_xml_no_f_c)(Vg_UserMsg, " <exe>%t</exe>\n",
+ "(launcher name unknown)");
for (i = 0; i < VG_(sizeXA)( VG_(args_for_valgrind) ); i++) {
- VG_(message_no_f_c)(
- Vg_UserMsg,
+ VG_(printf_xml_no_f_c)(
" <arg>%t</arg>\n",
* (HChar**) VG_(indexXA)( VG_(args_for_valgrind), i )
);
}
- VG_(message)(Vg_UserMsg, " </vargv>\n");
+ VG_(printf_xml)(" </vargv>\n");
- VG_(message)(Vg_UserMsg, " <argv>\n");
+ VG_(printf_xml)(" <argv>\n");
if (VG_(args_the_exename))
- VG_(message_no_f_c)(Vg_UserMsg, " <exe>%t</exe>\n",
- VG_(args_the_exename));
+ VG_(printf_xml_no_f_c)(" <exe>%t</exe>\n",
+ VG_(args_the_exename));
for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
- VG_(message_no_f_c)(
- Vg_UserMsg,
+ VG_(printf_xml_no_f_c)(
" <arg>%t</arg>\n",
* (HChar**) VG_(indexXA)( VG_(args_for_client), i )
);
}
- VG_(message)(Vg_UserMsg, " </argv>\n");
+ VG_(printf_xml)(" </argv>\n");
- VG_(message)(Vg_UserMsg, "</args>\n");
+ VG_(printf_xml)("</args>\n");
}
// Empty line after the preamble
@@ -2141,13 +2138,12 @@
if (VG_(clo_xml)) {
HChar buf[50];
VG_(elapsed_wallclock_time)(buf);
- VG_(message_no_f_c)(Vg_UserMsg,
- "<status>\n"
- " <state>RUNNING</state>\n"
- " <time>%t</time>\n"
- "</status>\n",
- buf);
- VG_(message)(Vg_UserMsg, "\n");
+ VG_(printf_xml_no_f_c)( "<status>\n"
+ " <state>RUNNING</state>\n"
+ " <time>%t</time>\n"
+ "</status>\n",
+ buf );
+ VG_(printf_xml_no_f_c)( "\n" );
}
VG_(debugLog)(1, "main", "Running thread 1\n");
@@ -2250,16 +2246,15 @@
HChar buf[50];
if (VG_(needs).core_errors || VG_(needs).tool_errors) {
VG_(show_error_counts_as_XML)();
- VG_(message)(Vg_UserMsg, "\n");
+ VG_(printf_xml)( "\n" );
}
VG_(elapsed_wallclock_time)(buf);
- VG_(message_no_f_c)(Vg_UserMsg,
- "<status>\n"
- " <state>FINISHED</state>\n"
- " <time>%t</time>\n"
- "</status>\n",
- buf);
- VG_(message)(Vg_UserMsg, "\n");
+ VG_(printf_xml_no_f_c)( "<status>\n"
+ " <state>FINISHED</state>\n"
+ " <time>%t</time>\n"
+ "</status>\n",
+ buf);
+ VG_(printf_xml)( "\n" );
}
/* Print out file descriptor summary and stats. */
Modified: branches/MESSAGING_TIDYUP/coregrind/m_stacktrace.c
===================================================================
--- branches/MESSAGING_TIDYUP/coregrind/m_stacktrace.c 2009-05-10 19:48:20 UTC (rev 9826)
+++ branches/MESSAGING_TIDYUP/coregrind/m_stacktrace.c 2009-05-10 20:17:27 UTC (rev 9827)
@@ -519,7 +519,7 @@
VG_(describe_IP)(ip, buf, BUF_LEN);
if (VG_(clo_xml)) {
- VG_(message)(Vg_UserMsg, " %s\n", buf);
+ VG_(printf_xml)(" %s\n", buf);
} else {
VG_(message)(Vg_UserMsg, " %s %s\n", ( n == 0 ? "at" : "by" ), buf);
}
@@ -531,12 +531,12 @@
vg_assert( n_ips > 0 );
if (VG_(clo_xml))
- VG_(message)(Vg_UserMsg, " <stack>\n");
+ VG_(printf_xml)(" <stack>\n");
VG_(apply_StackTrace)( printIpDesc, ips, n_ips );
if (VG_(clo_xml))
- VG_(message)(Vg_UserMsg, " </stack>\n");
+ VG_(printf_xml)(" </stack>\n");
}
/* Get and immediately print a StackTrace. */
|