How to use the stap -L option?
-
09-06-2021 - |
Question
I am following the SystemTap tutorial and I am trying to do exercise 1 from section 2.3 - "Tracing. Exercises". The -L
option seems to never work. I got this script:
probe kernel.function("*nit*"){}
I type in a terminal:
$ stap -L PROBE t.stp
and nothing happens.
Solution
$ stap -L 'kernel.function("blahblah")'
Systemtap is great, but poor documentation.
OTHER TIPS
From man stap
(with systemtap*-1.7-2.fc15.x86_64
RPMs installed)
stap [ OPTIONS ] -l PROBE [ ARGUMENTS ]
stap [ OPTIONS ] -L PROBE [ ARGUMENTS ]
-l PROBE
Instead of running a probe script, just list all available probe
points matching the given single probe point. The pattern may
include wildcards and aliases, but not comma-separated multiple
probe points. The process result code will indicate failure if
there are no matches.
-L PROBE
Similar to "-l", but list probe points and script-level local
variables.
"probe points" refer to 'kernel.function("blahblah")', etc. There is no keyword "probe" before and no probe handler afterwards.
You can try the following examples.
To get a list of all Kernel functions.
$ stap -l 'kernel.function("*")' | sort
kernel.function("vfs_read@/build/linux-lts-xenial-Hu9lgy/linux-lts-xenial-4.4.0/fs/read_write.c:440") [....]
To get a Kernel function & arguments (local variables)
$ stap -L 'kernel.function("*")' | grep vfs_read
kernel.function("vfs_read@/build/linux-lts-xenial-Hu9lgy/linux-lts-xenial-4.4.0/fs/read_write.c:440") $file:struct file* $buf:char* $count:size_t $pos:loff_t*
[....]
stap -L kernel.function("*nit*") | sort
Just to add on to what more learned people than me have said:
stap -L 'module("module-name-here").function("*")'
For regular kernel probes:
stap -L 'kernel.function("*")'
Hope this helps someone else in the future!