]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Don't wrap the "Command:" line, as doing so makes cutting-and-pasting the
authorNicholas Nethercote <njn@valgrind.org>
Tue, 4 Aug 2009 00:27:56 +0000 (00:27 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Tue, 4 Aug 2009 00:27:56 +0000 (00:27 +0000)
command difficult.  Also, when wrapping I was failing to factor in the
escape chars needed for chars like ' ';  now I don't need to.  And this
means the 'long-command' test is no longer necessary.  In other words,
favour utility and simplicity over aesthetics.

Also, the "Command:" line wasn't being wrapped in <line></line> in XML
output.  It now is.

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

coregrind/m_main.c
exp-ptrcheck/tests/hsg.stderr.exp
helgrind/tests/tc06_two_races_xml.stderr.exp
memcheck/tests/long_namespace_xml.stderr.exp
memcheck/tests/xml1.stderr.exp
none/tests/Makefile.am
none/tests/long-command.stderr.exp [deleted file]
none/tests/long-command.vgtest [deleted file]

index 8e3fb468e42d36ae8f83c5255660c16c669c2979..b2bea18c660168dc561d41258df7039b44cc4a63 100644 (file)
@@ -982,7 +982,6 @@ static void print_preamble ( Bool logging_to_fd,
                              const HChar* toolname )
 {
    Int    i;
-   SizeT  n;
    HChar* xpre  = VG_(clo_xml) ? "  <line>" : "";
    HChar* xpost = VG_(clo_xml) ? "</line>" : "";
    UInt (*umsg_or_xml)( const HChar*, ... )
@@ -1024,8 +1023,7 @@ static void print_preamble ( Bool logging_to_fd,
          );
       }
 
-      umsg_or_xml("%s%s%s\n", 
-                               xpre, VG_(details).copyright_author, xpost);
+      umsg_or_xml("%s%s%s\n", xpre, VG_(details).copyright_author, xpost);
 
       /* Core details */
       umsg_or_xml(
@@ -1033,35 +1031,19 @@ static void print_preamble ( Bool logging_to_fd,
          xpre, VERSION, xpost
       );
 
-      /* Print the command line, wrapping near 80-chars wide.  An example of a
-         command line with many args, some of them very long:
-        
-==9717== Command: date 11 23 4a \
-==9717==          aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \
-==9717==          aaa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 \
-==9717==          22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 \
-==9717==          fffffffffffffffffffffffffffff 1 2 3 \
-==9717==          bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
-      */
-      umsg_or_xml("Command: ");
+      // Print the command line.  At one point we wrapped at 80 chars and
+      // printed a '\' as a line joiner, but that makes it hard to cut and
+      // paste the command line (because of the "==pid==" prefixes), so we now
+      // favour utility and simplicity over aesthetics.
+      umsg_or_xml("%sCommand: ", xpre);
       if (VG_(args_the_exename))
          umsg_or_xml_arg(VG_(args_the_exename), umsg_or_xml);
-      n = 0;
       for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++) {
          HChar* s = *(HChar**)VG_(indexXA)( VG_(args_for_client), i );
-         SizeT slen = VG_(strlen)(s);
-         n += slen + 1;   // +1 for the space char between each argument
-         // With a PID of up to 5 digits, 58 puts the line-ending '\' in
-         // column 79 at the most, always leaving column 80 empty.
-         if (n > 58) {
-            VG_(umsg)(" \\");
-            VG_(umsg)("\n        ");
-            n = slen;
-         }
          umsg_or_xml(" ");
          umsg_or_xml_arg(s, umsg_or_xml);
       }
-      umsg_or_xml("\n");
+      umsg_or_xml("%s\n", xpost);
 
       if (VG_(clo_xml))
          VG_(printf_xml)("</preamble>\n");
@@ -1144,10 +1126,10 @@ static void print_preamble ( Bool logging_to_fd,
       } else {
 #        define BUF_LEN    256
          Char version_buf[BUF_LEN];
-         Int nn = VG_(read) ( sr_Res(fd), version_buf, BUF_LEN );
-         vg_assert(nn <= BUF_LEN);
-         if (nn > 0) {
-            version_buf[nn-1] = '\0';
+         Int n = VG_(read) ( sr_Res(fd), version_buf, BUF_LEN );
+         vg_assert(n <= BUF_LEN);
+         if (n > 0) {
+            version_buf[n-1] = '\0';
             VG_(message)(Vg_DebugMsg, "  %s\n", version_buf);
          } else {
             VG_(message)(Vg_DebugMsg, "  (empty?)\n");
index 738e9d88c4dd63766a4200ff796b2ed228ef19ed..9a2818ce2981d561ad45d57a3646c5e6552e5b2f 100644 (file)
@@ -10,6 +10,7 @@
   <line>...</line>
   <line>...</line>
   <line>...</line>
+  <line>...</line>
 </preamble>
 
 <pid>...</pid>
index 758821f43cea1fb0b32d9ca20a9d98857a2021a4..19993751ca74f2559926405820e15301683f3c34 100644 (file)
@@ -9,6 +9,7 @@
   <line>...</line>
   <line>...</line>
   <line>...</line>
+  <line>...</line>
 </preamble>
 
 <pid>...</pid>
index a8cd95a39f57ffde3a10960bafeb2aa1cc42aab6..dba89daa0cd01ec01d64cf0240acc233fbfb8b08 100644 (file)
@@ -9,6 +9,7 @@
   <line>...</line>
   <line>...</line>
   <line>...</line>
+  <line>...</line>
 </preamble>
 
 <pid>...</pid>
index 6358b624e7df84a215f2fe68a64d0c380e98b651..7de6e0abddce76affee74561ede1f889bbe98f36 100644 (file)
@@ -9,6 +9,7 @@
   <line>...</line>
   <line>...</line>
   <line>...</line>
+  <line>...</line>
 </preamble>
 
 <pid>...</pid>
index f7c989fd21bd4d9dea24628cf71b04224c71be08..b5e0a66ed3a9fe15c36d2490bf5654adf9e249d9 100644 (file)
@@ -81,7 +81,6 @@ EXTRA_DIST = \
        fork.stderr.exp fork.stdout.exp fork.vgtest \
        fucomip.stderr.exp fucomip.vgtest \
        gxx304.stderr.exp gxx304.vgtest \
-       long-command.stderr.exp long-command.vgtest \
        manythreads.stdout.exp manythreads.stderr.exp manythreads.vgtest \
        map_unaligned.stderr.exp map_unaligned.vgtest \
        map_unmap.stderr.exp map_unmap.stdout.exp map_unmap.vgtest \
diff --git a/none/tests/long-command.stderr.exp b/none/tests/long-command.stderr.exp
deleted file mode 100644 (file)
index 53c32e9..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-COMMAND: ./../../tests/true 11 23 4a \
-         aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \
-         aaa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 \
-         22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 \
-         fffffffffffffffffffffffffffff 1 2 3 \
-         bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 1 2 3 4 1 \
-         2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 \
-         xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-
-
diff --git a/none/tests/long-command.vgtest b/none/tests/long-command.vgtest
deleted file mode 100644 (file)
index acce130..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-prog: ../../tests/true 11 23 4a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 fffffffffffffffffffffffffffff 1 2 3 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-stderr_filter: filter_long_command