This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


=?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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]