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: Better handling of arguments/literals from the command-line?


Frank Ch. Eigler wrote:
> "Stone, Joshua I" <joshua.i.stone@intel.com> writes:
> > For parameters that are only used as literals in function/probe bodies,
> > we could probably synthesize this global-as-parameter method implicitly.
> > We could internally translate this:
> >
> >     probe begin { println(@1, $2) }
> >
> > into this:
> >
> >     global __string_arg1 = ""
> >     global __long_arg2 = 0
> >     probe begin { println(__string_arg1, __long_arg2) }
> 
> Not quite - the $num parameter series constitute pasted token
> sequences, not simple numbers any more.

Ah -- I didn't realize it was that flexible.  It's unfortunate that it
then limits ability to reuse.  You could still follow this idea for
strings though, and even convert the strings to numbers in a begin
probe for use elsewhere in the script.

Even just this would be an advantage -- for instance, someone using the
argv tapset wouldn't need any recompilation when the arguments change,
as long as the number of arguments stayed the same.

Josh


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