[Bug translator/13009] New: Allow @defined($foo) in probe predicates

jistone at redhat dot com sourceware-bugzilla@sourceware.org
Wed Jul 20 21:20:00 GMT 2011


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

           Summary: Allow @defined($foo) in probe predicates
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: translator
        AssignedTo: systemtap@sourceware.org
        ReportedBy: jistone@redhat.com


The @defined() test is statically resolved to either 0 or 1, depending on the
presence of the argument.  It would be nice if you could use this to statically
filter probes that have a particular variable.  For example, when some
functions don't have a return value:

probe module("jsm").function("*").return if (@defined($return)) {
  if ($return < 0)
    printf("%s returned %d\n", probefunc(), $return)
}

But this gives "semantic error: unexpected @defined".  You could move the
@defined check into the probe body for approximately the same effect, though
still incurring probe hits.

Once @defined is allowed in the predicate, we can further optimize that
predicate == 0 throws the whole body away, and probes with empty bodies are
discarded entirely.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Systemtap mailing list