chars wide whenever possible. Finishes off bug 197933.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10657
* XXX: exp-bbv has been added...
+* Valgrind's start-up message has changed. It is shorter but also includes
+ the command being run, which makes it easier to use --trace-children=yes.
+ An example:
+
+==3050== Memcheck, a memory error detector.
+==3050== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
+==3050== Using Valgrind-3.5.0.SVN and LibVEX; rerun with -h for copyright info
+==3050== Command: ls -l
+==3050==
+
* A new Memcheck client request VALGRIND_COUNT_LEAK_BLOCKS has been added.
It is similar to VALGRIND_COUNT_LEAKS but counts blocks instead of bytes.
[XXX: consider adding VALGRIND_COUNT_LEAK_BYTES as a synonym and
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*, ... )
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
+ */
+ VG_(umsg)("Command: ");
+ if (VG_(args_the_exename))
+ VG_(umsg)("%s", VG_(args_the_exename));
+ 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;
+ }
+ VG_(umsg)(" %s", s);
+ }
+ VG_(umsg)("\n");
+
if (VG_(clo_xml))
VG_(printf_xml)("</preamble>\n");
}
VexArchInfo vex_archinfo;
if (!logging_to_fd)
VG_(message)(Vg_DebugMsg, "\n");
- VG_(message)(Vg_DebugMsg, "Command line\n");
- if (VG_(args_the_exename))
- VG_(message)(Vg_DebugMsg, " %s\n", VG_(args_the_exename));
- for (i = 0; i < VG_(sizeXA)( VG_(args_for_client) ); i++)
- VG_(message)(Vg_DebugMsg,
- " %s\n",
- * (HChar**) VG_(indexXA)( VG_(args_for_client), i ));
-
- VG_(message)(Vg_DebugMsg, "Startup, with flags:\n");
+ VG_(message)(Vg_DebugMsg, "Valgrind flags:\n");
for (i = 0; i < VG_(sizeXA)( VG_(args_for_valgrind) ); i++) {
VG_(message)(Vg_DebugMsg,
" %s\n",
} else {
# define BUF_LEN 256
Char version_buf[BUF_LEN];
- Int n = VG_(read) ( sr_Res(fd), version_buf, BUF_LEN );
- vg_assert(n <= BUF_LEN);
- if (n > 0) {
- version_buf[n-1] = '\0';
+ Int nn = VG_(read) ( sr_Res(fd), version_buf, BUF_LEN );
+ vg_assert(nn <= BUF_LEN);
+ if (nn > 0) {
+ version_buf[nn-1] = '\0';
VG_(message)(Vg_DebugMsg, " %s\n", version_buf);
} else {
VG_(message)(Vg_DebugMsg, " (empty?)\n");
<computeroutput>date</computeroutput> is just an example).
The output should be something like this:</para>
<programlisting><![CDATA[
- ==738== foobar-0.0.1, a foobarring tool for x86-linux.
- ==738== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
- ==738== Using LibVEX rev 1791, a library for dynamic binary translation.
- ==738== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
- ==738== Using valgrind-3.3.0, a dynamic binary instrumentation framework.
- ==738== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
- ==738== For more details, rerun with: -v
+ ==738== foobar-0.0.1, a foobarring tool.
+ ==738== Copyright (C) 2002-2009, and GNU GPL'd, by J. Programmer.
+ ==738== Using Valgrind-3.5.0.SVN and LibVEX; rerun with -h for copyright info
+ ==738== Command: date
==738==
Tue Nov 27 12:40:49 EST 2007
==738==]]></programlisting>
dist_noinst_SCRIPTS = \
filter_cmdline0 \
- filter_linenos \
filter_fdleak \
+ filter_linenos \
+ filter_long_command \
filter_none_discards \
filter_stderr \
filter_timestamp
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 \
--- /dev/null
+#! /bin/sh
+
+dir=`dirname $0`
+
+# We change the "Command:" so it doesn't get stripped out by the standard
+# filters.
+sed "s/Command:/COMMAND:/" |
+
+./filter_stderr
sed "/ Nulgrind.*$/ d" |
sed "/ Copyright.*$/ d" |
sed "/ Using Valgrind.*$/ d" |
+sed "/ Command:.*$/ d" |
$dir/filter_stderr |
--- /dev/null
+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
+
+
--- /dev/null
+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
# Remove any --pid:0: strings (debuglog level zero output)
sed "/^--[0-9]\{1,7\}:0:*/d" |
+# Remove "Command: line". (If wrapping occurs, it won't remove the
+# subsequent lines...)
+sed "/^Command: .*$/d" |
+
# Remove "WARNING: assuming toc 0x.." strings
sed "/^WARNING: assuming toc 0x*/d" |