This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [Patch]Fix the args' output of syscall execve
On Thu, 2007-08-16 at 10:00 -0400, Frank Ch. Eigler wrote:
> Martin Hunt <hunt@redhat.com> writes:
>
> > [...] argv[0] was being skipped because it is typically just the
> > filename again. But you are correct that it should be in args.
>
> Indeed.
>
> > However for argstr, I think it makes things less readable to include
> > it. So I changed __get_argv and __compat_get_argv to optionally
> > skip argv[0].
>
> Let's not improvise unnecessarily. strace shows execve* this way:
>
> strace -f sh -c ls |& grep exec
> execve("/bin/sh", ["sh", "-c", "ls"], [/* 53 vars */]) = 0
> execve("/bin/ls", ["ls"...], [/* 52 vars */]) = 0
Looks OK for trivial cases, but compare
strace way:
[pid 11943] execve("/usr/bin/g++", ["g++"..., "-DHAVE_CONFIG_H"...,
"-I."..., "-I."..., "-I."..., "-DBINDIR=\"/usr/local/bin\""...,
"-DPKGDATADIR=\"/usr/local/share/s"..., "-DPKGLIBDIR=
\"/usr/local/libexec/"..., "-Wall"..., "-Wextra"..., "-Werror"...,
"-g"..., "-O2"..., "-MT"..., "stap-staptree.o"..., "-MD"..., ...], [/*
43 vars */]) = 0
[pid 11944] execve("/usr/libexec/gcc/i386-redhat-linux/4.1.2/cc1plus",
["/usr/libexec/gcc/i386-redhat-lin"..., "-quiet"..., "-I."..., "-I."...,
"-I."..., "-MD"..., "stap-staptree.d"..., "-MF"...,
".deps/stap-staptree.Tpo"..., "-MP"..., "-MT"..., "stap-staptree.o"...,
"-MQ"..., "stap-staptree.o"..., "-D_GNU_SOURCE"...,
"-DHAVE_CONFIG_H"..., ...], [/* 45 vars */]) = 0
systemtap script:
[pid 12965] /usr/bin/g++ -DHAVE_CONFIG_H -I. -I. -I.
-DBINDIR="/usr/local/bin" -DPKGDATADIR="/usr/local/share/systemtap"
-DPKGLIBDIR="/usr/local/libexec/systemtap" -Wall -Wextra -Werror -g -O2
-MT stap-parse.o -MD -MP -MF .deps/stap-parse.Tpo -c -o stap-parse.o
parse.cxx
[pid 12966] /usr/libexec/gcc/i386-redhat-linux/4.1.2/cc1plus -quiet -I.
-I. -I. -MD stap-parse.d -MF .deps/stap-parse.Tpo -MP -MT stap-parse.o
-MQ stap-parse.o -D_GNU_SOURCE -DHAVE_CONFIG_H -DBINDIR="/usr/local/bin"
-DPKGDATADIR="/usr/local/share/systemtap"
-DPKGLIBDIR="/usr/local/libexec/systemtap" parse.cxx -quiet -dumpbase
parse.cxx -mtune=generic -auxbase-strip stap-parse.o -g -O2 -Wall
-Wextra -Werror -o /tmp/ccUmZrhr.s