From: Julian Seward Date: Tue, 19 Jul 2005 14:18:56 +0000 (+0000) Subject: New command line option: --xml-user-comment=XMLTEXT, which allows X-Git-Tag: svn/VALGRIND_3_0_0~132 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59bfcbf43cbea91453477cc5a5338c21ec1fbf10;p=thirdparty%2Fvalgrind.git New command line option: --xml-user-comment=XMLTEXT, which allows copying of arbitrary bits of XML text to the XML output. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4186 --- diff --git a/coregrind/m_main.c b/coregrind/m_main.c index acf024a666..f9162d9af3 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -1270,6 +1270,7 @@ static void usage ( Bool debug_help ) " --show-emwarns=no|yes show warnings about emulation limits? [no]\n" " --smc-support=none|stack|all support for self-modifying code:\n" " none, for code found in stacks, or all [stack]\n" +" --xml-user-comment=STR copy STR verbatim to XML output\n" "\n" " user options for Valgrind tools that report errors:\n" " --log-fd= log messages to file descriptor [2=stderr]\n" @@ -1554,6 +1555,10 @@ static void process_cmd_line_options( UInt* client_auxv, const char* toolname ) VG_(clo_log_name) = &arg[13]; } + else if (VG_CLO_STREQN(19, arg, "--xml-user-comment=")) { + VG_(clo_xml_user_comment) = &arg[19]; + } + else if (VG_CLO_STREQN(15, arg, "--suppressions=")) { if (VG_(clo_n_suppressions) >= VG_CLO_MAX_SFILES) { VG_(message)(Vg_UserMsg, "Too many suppression files specified."); @@ -1905,12 +1910,19 @@ static void process_cmd_line_options( UInt* client_auxv, const char* toolname ) VG_(clo_log_file_qualifier), val ? val : ""); } + 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, "%s", + VG_(clo_xml_user_comment)); + } VG_(message)(Vg_UserMsg, ""); VG_(message)(Vg_UserMsg, ""); VG_(message)(Vg_UserMsg, " "); for (i = 0; i < vg_argc; i++) { HChar* tag = i==0 ? "exe" : "arg"; - VG_(message)(Vg_UserMsg, " <%s>%s", + VG_(message)(Vg_UserMsg, " <%s>%t", tag, vg_argv[i], tag); } VG_(message)(Vg_UserMsg, " "); diff --git a/coregrind/m_options.c b/coregrind/m_options.c index cf989245ef..caed24422c 100644 --- a/coregrind/m_options.c +++ b/coregrind/m_options.c @@ -44,6 +44,7 @@ Int VG_(clo_gen_suppressions) = 0; Int VG_(clo_sanity_level) = 1; Int VG_(clo_verbosity) = 1; Bool VG_(clo_xml) = False; +HChar* VG_(clo_xml_user_comment) = NULL; Bool VG_(clo_demangle) = True; Bool VG_(clo_trace_children) = False; Int VG_(clo_log_fd) = 2; diff --git a/include/pub_tool_options.h b/include/pub_tool_options.h index e27e158a95..8266a3a57c 100644 --- a/include/pub_tool_options.h +++ b/include/pub_tool_options.h @@ -71,6 +71,10 @@ extern Bool VG_(clo_profile); way. See vg_main.c and mc_main.c. */ extern Bool VG_(clo_xml); +/* An arbitrary user-supplied string which is copied into the + XML output, in between tags. */ +extern HChar* VG_(clo_xml_user_comment); + /* Call this if a recognised option was bad for some reason. Note: don't use it just because an option was unrecognised -- return 'False' from VG_(tdict).tool_process_cmd_line_option) to indicate that. */