Probe point aliases allow creation of
new probe points from existing ones. This is useful if the new probe
points are named to provide a higher level of abstraction. For
example, the system-calls tapset defines probe point aliases of the
form syscall.open etc., in terms of lower level ones like
kernel.function("sys_open"). Even if some future kernel
renames sys_open, the aliased name can remain valid.
A probe point alias definition looks like a normal probe. Both start
with the keyword probe and have a probe handler statement block
at the end. But where a normal probe just lists its probe points, an
alias creates a new name using the assignment (=) operator.
Another probe that names the new probe point will create an actual
probe, with the handler of the alias prepended.
This prepending behavior serves several purposes. It allows the alias definition to ``preprocess'' the context of the probe before passing control to the user-specified handler. This has several possible uses:
if ($flag1 != $flag2) next |
skip probe unless given condition is met |
name = "foo" |
supply probe-describing values |
var = $var |
extract target variable to plain local variable |
Figure 9 demonstrates a probe point alias definition as well as its use. It demonstrates how a single probe point alias can expand to multiple probe points, even to other aliases. It also includes probe point wildcarding. These functions are designed to compose sensibly.