public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* $foo in probe predicates
@ 2009-01-07 22:09 Roland McGrath
  2009-01-07 22:19 ` Stone, Joshua I
  2009-01-07 23:54 ` Frank Ch. Eigler
  0 siblings, 2 replies; 3+ messages in thread
From: Roland McGrath @ 2009-01-07 22:09 UTC (permalink / raw)
  To: systemtap


-bash-3.2$ ./run-stap -c 'cat < /dev/null' -e 'probe kernel.function("sys_read") { if ($fd == 0) printf("%d %d\n", $fd, $count) }'
0 4096
-bash-3.2$ ./run-stap -c 'cat < /dev/null' -e 'probe kernel.function("sys_read") if ($fd == 0) { printf("%d %d\n", $fd, $count) }'
semantic error: unresolved target-symbol expression: identifier '$fd' at <input>:1:39
        source: probe kernel.function("sys_read") if ($fd == 0) { printf("%d %d\n", $fd, $count) }
                                                      ^
Pass 2: analysis failed.  Try again with another '--vp 01' option.
-bash-3.2$ 


AFAICT this makes it impossible to do:

probe foo.bar = kernel.function("blah") if ($arg == 1) { argstr=... }
probe foo.baz = kernel.function("blah") if ($arg == 2) { argstr=... }

and I don't know how else I could get the same effect.  That is, so:

probe foo.bar { print... }

does not print on $arg!=1 cases, with the knowedlge about $arg and its
values being hidden in the tapset.


Thanks,
Roland

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

* RE: $foo in probe predicates
  2009-01-07 22:09 $foo in probe predicates Roland McGrath
@ 2009-01-07 22:19 ` Stone, Joshua I
  2009-01-07 23:54 ` Frank Ch. Eigler
  1 sibling, 0 replies; 3+ messages in thread
From: Stone, Joshua I @ 2009-01-07 22:19 UTC (permalink / raw)
  To: Roland McGrath, systemtap

Roland McGrath wrote:
> [...]
> AFAICT this makes it impossible to do:
>
> probe foo.bar = kernel.function("blah") if ($arg == 1) { argstr=... }
> probe foo.baz = kernel.function("blah") if ($arg == 2) { argstr=... }
>
> and I don't know how else I could get the same effect.  That is, so:
>
> probe foo.bar { print... }
>
> does not print on $arg!=1 cases, with the knowedlge about $arg and its
> values being hidden in the tapset.

You can achieve this with "next", which is like a return statement for probes.

probe foo.bar = kernel.function("blah") { if ($arg != 1) next; argstr=... }
probe foo.baz = kernel.function("blah") { if ($arg != 2) next; argstr=... }


Josh

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

* Re: $foo in probe predicates
  2009-01-07 22:09 $foo in probe predicates Roland McGrath
  2009-01-07 22:19 ` Stone, Joshua I
@ 2009-01-07 23:54 ` Frank Ch. Eigler
  1 sibling, 0 replies; 3+ messages in thread
From: Frank Ch. Eigler @ 2009-01-07 23:54 UTC (permalink / raw)
  To: Roland McGrath; +Cc: systemtap

Roland McGrath <roland@redhat.com> writes:

> [...]
> AFAICT this makes it impossible to do:
> probe foo.bar = kernel.function("blah") if ($arg == 1) { argstr=... }
> probe foo.baz = kernel.function("blah") if ($arg == 2) { argstr=... }

Note that this syntax is for conditional probes (ones that arm and
disarm on the fly), which are prevented from being conditional on
local context variables that would require them to be armed anyway.

- FChE

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

end of thread, other threads:[~2009-01-07 23:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-07 22:09 $foo in probe predicates Roland McGrath
2009-01-07 22:19 ` Stone, Joshua I
2009-01-07 23:54 ` Frank Ch. Eigler

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).