help: can "staprun" support command-line arguments?

Frank Ch. Eigler fche@redhat.com
Thu Jul 1 14:21:00 GMT 2010


=?GB2312?B?s8K+ss/g?= <chenjx8@gmail.com> writes:

> [...]
> systemtap script can use command-line arguments, but when I use
> cross-instrumentation build module, I have a problem. I hope I can input
> command-line arguments to=A0 the module which I build out of script in my
> own computer [...]
> e.g.

> #cat commandlineargs.stp
> probe kernel.function("vfs_read")  # fche: I think you meant  function(@1) here
>  {
>     fn = @1
>     printf("do function %s\n", fn)
> }
> [...]

There is a facility for passing some staprun-time parameters.
However, these are limited to overriding values of scalar global
variables, not arbitrary places in the script.  That means that such
arguments *cannot* vary probe point specifications (but see PR11550
for some forthcoming relaxation of this), but can do things like this:

% stap -p4 -mfoo -e '
global var="world"
probe begin
    log (var)
}'

# staprun foo.ko var=hello
hello
# staprun foo.ko
world

- FChE



More information about the Systemtap mailing list