From 9c4252c6a1ff9dabfd6d6c5d565ce150bd6434de Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 4 Aug 2009 00:27:56 +0000 Subject: [PATCH] Don't wrap the "Command:" line, as doing so makes cutting-and-pasting the 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 in XML output. It now is. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10699 --- coregrind/m_main.c | 40 ++++++-------------- exp-ptrcheck/tests/hsg.stderr.exp | 1 + helgrind/tests/tc06_two_races_xml.stderr.exp | 1 + memcheck/tests/long_namespace_xml.stderr.exp | 1 + memcheck/tests/xml1.stderr.exp | 1 + none/tests/Makefile.am | 1 - none/tests/long-command.stderr.exp | 10 ----- none/tests/long-command.vgtest | 2 - 8 files changed, 15 insertions(+), 42 deletions(-) delete mode 100644 none/tests/long-command.stderr.exp delete mode 100644 none/tests/long-command.vgtest diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 8e3fb468e4..b2bea18c66 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -982,7 +982,6 @@ static void print_preamble ( Bool logging_to_fd, const HChar* toolname ) { Int i; - SizeT n; HChar* xpre = VG_(clo_xml) ? " " : ""; HChar* xpost = VG_(clo_xml) ? "" : ""; 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)("\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"); diff --git a/exp-ptrcheck/tests/hsg.stderr.exp b/exp-ptrcheck/tests/hsg.stderr.exp index 738e9d88c4..9a2818ce29 100644 --- a/exp-ptrcheck/tests/hsg.stderr.exp +++ b/exp-ptrcheck/tests/hsg.stderr.exp @@ -10,6 +10,7 @@ ... ... ... + ... ... diff --git a/helgrind/tests/tc06_two_races_xml.stderr.exp b/helgrind/tests/tc06_two_races_xml.stderr.exp index 758821f43c..19993751ca 100644 --- a/helgrind/tests/tc06_two_races_xml.stderr.exp +++ b/helgrind/tests/tc06_two_races_xml.stderr.exp @@ -9,6 +9,7 @@ ... ... ... + ... ... diff --git a/memcheck/tests/long_namespace_xml.stderr.exp b/memcheck/tests/long_namespace_xml.stderr.exp index a8cd95a39f..dba89daa0c 100644 --- a/memcheck/tests/long_namespace_xml.stderr.exp +++ b/memcheck/tests/long_namespace_xml.stderr.exp @@ -9,6 +9,7 @@ ... ... ... + ... ... diff --git a/memcheck/tests/xml1.stderr.exp b/memcheck/tests/xml1.stderr.exp index 6358b624e7..7de6e0abdd 100644 --- a/memcheck/tests/xml1.stderr.exp +++ b/memcheck/tests/xml1.stderr.exp @@ -9,6 +9,7 @@ ... ... ... + ... ... diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index f7c989fd21..b5e0a66ed3 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -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 index 53c32e98fd..0000000000 --- a/none/tests/long-command.stderr.exp +++ /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 index acce130c0a..0000000000 --- a/none/tests/long-command.vgtest +++ /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 -- 2.47.3