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]

[Bug translator/3849] Delay assigning command-line parameters until runtime


------- Additional Comments From joshua dot i dot stone at intel dot com  2007-01-10 18:43 -------
(In reply to comment #1)
> There is good reason for expanding some arguments at parse time - this is
> necessary for example for parameters of probe points.

Right -- that's why I said "Some analysis may be needed".  For parameters that
are used in probe points we should expand them right away.  For parameters that
are only used as literals in the probe bodies, we can delay assignment until
runtime.

> We already support a run-time parametrization method to some extent:
> initializing global variables by name, which is implemented via module
> parameters.  Do you still believe a third method (positional arguments
> at run time) is necessary?

Well, there's no way to pass in module parameters through stap.  To do my simple
example in that way, you have to do something like this:

matchname.stp:
  global name
  probe process.exec_complete {
    if (execname() == name)
      printf("start %d\n", pid())
  }

$ stap matchname.stp -p4 -k
Keeping temporary directory "/tmp/stap5F1ijy"
$ mv /tmp/stap5F1ijy/*.ko matchname.ko
$ sudo staprun matchname.ko name=ls
$ sudo staprun matchname.ko name=bash
$ sudo staprun matchname.ko name=foobar

Thus, you have to manually cache the ko and invoke staprun directly.  What I'm
proposing is not a new method, just to let the above process happen behind the
scenes, so I can just do this:

matchname.stp:
  probe process.exec_complete {
    if (execname() == @1)
      printf("start %d\n", pid())
  }

$ stap matchname.stp ls
$ stap matchname.stp bash
$ stap matchname.stp foobar

With a delayed assignment through module parameters, it will used a cached ko. 
This happens transparently, so the same script will still work on older staps
that don't do this.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=3849

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


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