From: Julian Seward Date: Wed, 4 Jun 2008 06:51:58 +0000 (+0000) Subject: Reinstate printing of log-file-qualifiers in XML output (Ashley Pittman). X-Git-Tag: svn/VALGRIND_3_4_0~522 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9551b14c189075265cc6b5dc9e7e87334159e76c;p=thirdparty%2Fvalgrind.git Reinstate printing of log-file-qualifiers in XML output (Ashley Pittman). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8178 --- diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 551349f415..7717470965 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -719,6 +719,47 @@ static Bool main_process_cmd_line_options( UInt* client_auxv, 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, " %t " + "%t ", + qualname,qual); + format[i] = '}'; + i++; + } + } + } else { + i++; + } + } +} + /*====================================================================*/ /*=== Printing the preamble ===*/ @@ -813,16 +854,7 @@ static void print_preamble(Bool logging_to_fd, const char* toolname) VG_(message)(Vg_UserMsg, "%d", VG_(getpid)()); VG_(message)(Vg_UserMsg, "%d", VG_(getppid)()); VG_(message)(Vg_UserMsg, "%t", 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, " %t " -// "%t ", -// 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 diff --git a/docs/internals/xml-output.txt b/docs/internals/xml-output.txt index 2ad21c3237..c232aacda7 100644 --- a/docs/internals/xml-output.txt +++ b/docs/internals/xml-output.txt @@ -115,8 +115,7 @@ PROTOCOL for version 3 ---------------------- Changes in 3.4.X (tentative): (jrs, 1 March 2008) -* There may be more than one clause, depending on - how this pans out. (AshleyP perhaps to investigate) +* There may be more than one clause. * Some errors may have two blocks, rather than just one (resulting from merge of the DATASYMS branch)