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: command line arguments


Hi -

hunt wrote:

> Ah, I see. I was confused because this doesn't work:
> > stap -e 'probe begin {printf("%d (%s)\n", $1,@1);exit()}' hello
> [...]
> > stap -e 'probe begin {printf("%d (%s)\n", $1,@1,$2,@2);exit()}' 42

Yes, both these intentionally emit errors.

> [...]  Still, I don't see how you can do anything like getopt to
> process args.

One can't, with what there is now.  It would not take much to add
another way of accessing the entire argument array, for some
adventurous person to implement getopt on top of.

Then again, I wonder how great a loss not bothering would be.  Few
shell scripts use getopt.  Large ones, sure, but little ones almost
never.  I imagine systemtap scripts to be more like the small ones,
using plain positional arguments.


> I see in a later message you are thinking of having some special
> syntax to allow variables to be set on the command line?  [...]

Code is now there in stpd and in the probe modules to initialize
number and string globals, by simply giving them as additional named
module options ("insmod foo.ko foo=1 bar=beef").  There is no stap
interface to that yet.  I figured I'd hold off on that part until the
cross-instrumentation (=.ko-precompilation) problem is solved.


> I'd like to see this kind of parsing be possible. How would it work?
> > topsys.stp -- -d 5 -n 20
> > topsys.stp -- -n 20 -pid 5160,5161
> > topsys.stp -- -d 5 -name "metacity"

For something that elaborate, in the absence of other facilities, you
can use a shell/perl/tcl wrapper.


- FChE


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