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 documentation/11224] New: setting module arguments needs to be tested/documented


Systemtap can set module arguments on the command line, in certain situations. 
This is not documented (well) in a man page or tested by the testsuite.  Here's
what I've discovered about this after some investigation.

Here's an example script (called mod_opt1.stp):

  global name
  probe begin { printf("name=%s\n", name); exit() }

Global variables get converted into module options. To set 'name' from the
command line, you have to do this:

  # stap -p4 -m mod_opt1 mod_opt1.stp
  # staprun mod_opt1.ko name=foo
  name=foo

Note that you can't do the following, since there doesn't seem to be a way to
set module options from the 'stap' command line:

  # stap -m mod_opt1 mod_opt1.stp name=foo

Things get a bit more confusing when you add in script arguments (which can only
be specified on the 'stap' command line).

Here's an example script using script arguments (called mod_opt2.stp):

  global name=@1
  probe begin { printf("name=%s\n", name); exit() }

To use script arguments, you'd do this:

  # stap -m mod_opt2 mod_opt2.stp foo
  name=foo

If you re-run the module, you'll get the same output.

  # staprun mod_opt2.ko
  name=foo

Using that same module, you can override the script argument setting using
module arguments.

  # staprun mod_opt2.ko name=bar
  name=bar

(It is possible that this last behavior has changed at some point.  Systemtap
used to synthesize begin probes to set global variables, and the global variable
setting might have overridden the module argument.)

Note that this bug is related to, but not the same thing as, bug #3849 and bug
#5642.

-- 
           Summary: setting module arguments needs to be tested/documented
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: documentation
        AssignedTo: systemtap at sources dot redhat dot com
        ReportedBy: dsmith at redhat dot com


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

------- 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]