]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
New command line option: --xml-user-comment=XMLTEXT, which allows
authorJulian Seward <jseward@acm.org>
Tue, 19 Jul 2005 14:18:56 +0000 (14:18 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 19 Jul 2005 14:18:56 +0000 (14:18 +0000)
copying of arbitrary bits of XML text to the XML output.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4186

coregrind/m_main.c
coregrind/m_options.c
include/pub_tool_options.h

index acf024a66629e26a1f5f05bda5d198e3d711496a..f9162d9af326e3a2eec7561e307ce87c23934f3f 100644 (file)
@@ -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=<number>         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, "<usercomment>%s</usercomment>",
+                                  VG_(clo_xml_user_comment));
+      }
       VG_(message)(Vg_UserMsg, "");
       VG_(message)(Vg_UserMsg, "<args>");
       VG_(message)(Vg_UserMsg, "  <vargv>");
       for (i = 0; i < vg_argc; i++) {
          HChar* tag = i==0 ? "exe" : "arg";
-         VG_(message)(Vg_UserMsg, "    <%s>%s</%s>", 
+         VG_(message)(Vg_UserMsg, "    <%s>%t</%s>", 
                                   tag, vg_argv[i], tag);
       }
       VG_(message)(Vg_UserMsg, "  </vargv>");
index cf989245efafe2991a630b75722d7aa87c52378b..caed24422c4a9266d047532395b3a60266a681a9 100644 (file)
@@ -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;
index e27e158a950b3ee78041ff07d9a10dda79570a0b..8266a3a57c4b05607d5cd9862c839ab122d5b00c 100644 (file)
@@ -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 <usercomment> 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. */