public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/13009] New: Allow @defined($foo) in probe predicates
@ 2011-07-20 21:20 jistone at redhat dot com
  2011-07-20 22:31 ` [Bug translator/13009] " fche at redhat dot com
  2011-07-20 23:14 ` jistone at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: jistone at redhat dot com @ 2011-07-20 21:20 UTC (permalink / raw)
  To: systemtap

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug translator/13009] Allow @defined($foo) in probe predicates
  2011-07-20 21:20 [Bug translator/13009] New: Allow @defined($foo) in probe predicates jistone at redhat dot com
@ 2011-07-20 22:31 ` fche at redhat dot com
  2011-07-20 23:14 ` jistone at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: fche at redhat dot com @ 2011-07-20 22:31 UTC (permalink / raw)
  To: systemtap

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

Frank Ch. Eigler <fche at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fche at redhat dot com

--- Comment #1 from Frank Ch. Eigler <fche at redhat dot com> 2011-07-20 22:30:40 UTC ---
"But this gives "semantic error: unexpected @defined". "

That's odd - the code should accept pretty general expressions.

"Once @defined is allowed in the predicate, we can further optimize that
predicate == 0 throws the whole body away"

Sure, or delete the probe directly.

"and probes with empty bodies are discarded entirely."

That's bug #11353.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug translator/13009] Allow @defined($foo) in probe predicates
  2011-07-20 21:20 [Bug translator/13009] New: Allow @defined($foo) in probe predicates jistone at redhat dot com
  2011-07-20 22:31 ` [Bug translator/13009] " fche at redhat dot com
@ 2011-07-20 23:14 ` jistone at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: jistone at redhat dot com @ 2011-07-20 23:14 UTC (permalink / raw)
  To: systemtap

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

--- Comment #2 from Josh Stone <jistone at redhat dot com> 2011-07-20 23:13:42 UTC ---
(In reply to comment #1)
> "But this gives "semantic error: unexpected @defined". "
> 
> That's odd - the code should accept pretty general expressions.

That's coming from typeresolution_info::visit_defined_op, as it's not expecting
@defined expressions to survive this far.  We may just need to tweak all the
var_expanding_visitor invocations to visit the predicate too.

> "and probes with empty bodies are discarded entirely."
> 
> That's bug #11353.

Ah, yes, thanks for jogging my memory.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-07-20 23:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-20 21:20 [Bug translator/13009] New: Allow @defined($foo) in probe predicates jistone at redhat dot com
2011-07-20 22:31 ` [Bug translator/13009] " fche at redhat dot com
2011-07-20 23:14 ` jistone at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).