mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 18:13:01 +00:00
Print the command being run at startup. It wraps to avoid going over 80
chars wide whenever possible. Finishes off bug 197933. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10657
This commit is contained in:
parent
bba592e3fc
commit
a3fe17b34b
10
NEWS
10
NEWS
@ -31,6 +31,16 @@ Release 3.5.0 (???)
|
||||
|
||||
* 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
|
||||
|
||||
@ -967,6 +967,7 @@ 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*, ... )
|
||||
@ -1017,6 +1018,35 @@ 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
|
||||
*/
|
||||
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");
|
||||
}
|
||||
@ -1091,15 +1121,7 @@ static void print_preamble ( Bool logging_to_fd,
|
||||
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",
|
||||
@ -1113,10 +1135,10 @@ static void print_preamble ( Bool logging_to_fd,
|
||||
} 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");
|
||||
|
||||
@ -153,13 +153,10 @@ top-level directory <computeroutput>valgrind/</computeroutput>.</para>
|
||||
<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>
|
||||
|
||||
@ -34,8 +34,9 @@ DIST_SUBDIRS = x86 amd64 ppc32 ppc64 linux darwin x86-linux .
|
||||
|
||||
dist_noinst_SCRIPTS = \
|
||||
filter_cmdline0 \
|
||||
filter_linenos \
|
||||
filter_fdleak \
|
||||
filter_linenos \
|
||||
filter_long_command \
|
||||
filter_none_discards \
|
||||
filter_stderr \
|
||||
filter_timestamp
|
||||
@ -79,6 +80,7 @@ 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 \
|
||||
|
||||
9
none/tests/filter_long_command
Executable file
9
none/tests/filter_long_command
Executable file
@ -0,0 +1,9 @@
|
||||
#! /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
|
||||
@ -11,6 +11,7 @@ perl -p -e "s/ [0-9]{1,7}==//" |
|
||||
sed "/ Nulgrind.*$/ d" |
|
||||
sed "/ Copyright.*$/ d" |
|
||||
sed "/ Using Valgrind.*$/ d" |
|
||||
sed "/ Command:.*$/ d" |
|
||||
|
||||
$dir/filter_stderr |
|
||||
|
||||
|
||||
10
none/tests/long-command.stderr.exp
Normal file
10
none/tests/long-command.stderr.exp
Normal file
@ -0,0 +1,10 @@
|
||||
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
|
||||
|
||||
|
||||
2
none/tests/long-command.vgtest
Normal file
2
none/tests/long-command.vgtest
Normal file
@ -0,0 +1,2 @@
|
||||
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
|
||||
@ -15,6 +15,10 @@ perl -p -e 's/(==|--|\+\+|\*\*)[0-9]{1,7}\1 //' |
|
||||
# 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" |
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user