On Sat, 2008-03-01 at 21:15 +0100, Julian Seward wrote:
> On Friday 29 February 2008 16:54, Ashley Pittman wrote:
> > I've been looking at my output aggregation tool again this week and have
> > spotted a problem with the new output qualifier, in the old system with
> > the --log-file-qualifier option the name and value of the variable are
>
> You're absolutely right. Sorry for the breakage.
It's as much my fault as yours, I didn't spot it either.
> You can find some code used to deal with ${FOO} in VG_(expand_file_name).
> Perhaps that could be factored into a function used by both the
> current log-file-name handling, and the logfilequalifier stuff.
I've simply copied the function to m_main.c and stripped out the bits I
don't need.
Ashley,
Index: docs/internals/xml-output.txt
===================================================================
--- docs/internals/xml-output.txt (revision 7546)
+++ docs/internals/xml-output.txt (working copy)
@@ -114,8 +114,7 @@
----------------------
Changes in 3.3.X (tentative): (jrs, 1 March 2008)
-* There may be more than one <logfilequalifier> clause, depending on
- how this pans out. (AshleyP perhaps to investigate)
+* There may be more than one <logfilequalifier> clause.
* Some errors may have two <auxwhat> blocks, rather than just one
(resulting from merge of the DATASYMS branch)
Index: coregrind/m_main.c
===================================================================
--- coregrind/m_main.c (revision 7546)
+++ coregrind/m_main.c (working copy)
@@ -719,7 +719,48 @@
return (log_to == VgLogTo_Fd);
}
+// Write the name and value of log file qualifiers to the xml file.
+static void print_file_vars(Char* format)
+{
+ Int i = 0;
+
+ while (format[i]) {
+ if (format[i] == '%') {
+ // We saw a '%'. What's next...
+ i++;
+ if ('q' == format[i]) {
+ i++;
+ if ('{' == format[i]) {
+ // Get the env var name, print its contents.
+ Char* qualname;
+ Char* qual;
+ i++;
+ qualname = &format[i];
+ while (True) {
+ if ('}' == format[i]) {
+ // Temporarily replace the '}' with NUL to extract var
+ // name.
+ format[i] = 0;
+ qual = VG_(getenv)(qualname);
+ break;
+ }
+ i++;
+ }
+ VG_(message)(Vg_UserMsg, "<logfilequalifier> <var>%t</var> "
+ "<value>%t</value> </logfilequalifier>",
+ qualname,qual);
+ format[i] = '}';
+ i++;
+ }
+ }
+ } else {
+ i++;
+ }
+ }
+}
+
+
/*====================================================================*/
/*=== Printing the preamble ===*/
/*====================================================================*/
@@ -743,7 +784,7 @@
VG_(message)(Vg_UserMsg, "");
VG_(message)(Vg_UserMsg, "<valgrindoutput>");
VG_(message)(Vg_UserMsg, "");
- VG_(message)(Vg_UserMsg, "<protocolversion>2</protocolversion>");
+ VG_(message)(Vg_UserMsg, "<protocolversion>3</protocolversion>");
VG_(message)(Vg_UserMsg, "");
}
@@ -813,16 +854,7 @@
VG_(message)(Vg_UserMsg, "<pid>%d</pid>", VG_(getpid)());
VG_(message)(Vg_UserMsg, "<ppid>%d</ppid>", VG_(getppid)());
VG_(message)(Vg_UserMsg, "<tool>%t</tool>", toolname);
-// [This was made obsolete by the --log-file change in 3.3.0. But
-// I'm leaving it here (commented out) in case it needs to be reinstated in
-// some way --njn]
-// if (VG_(clo_log_file_qualifier)) {
-// HChar* val = VG_(getenv)(VG_(clo_log_file_qualifier));
-// VG_(message)(Vg_UserMsg, "<logfilequalifier> <var>%t</var> "
-// "<value>%t</value> </logfilequalifier>",
-// VG_(clo_log_file_qualifier),
-// val ? val : "");
-// }
+ print_file_vars(VG_(clo_log_name));
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
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Valgrind-developers mailing list
Valgrind-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-developers