2

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.

Cristian Ciupitu
  • 20,270
  • 7
  • 50
  • 76
user1391821
  • 51
  • 1
  • 5

5 Answers5

5
$ stap -L 'kernel.function("blahblah")'

Systemtap is great, but poor documentation.

pythoniku
  • 3,532
  • 6
  • 23
  • 30
4

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.

Cristian Ciupitu
  • 20,270
  • 7
  • 50
  • 76
1

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*

[....]

1
stap -L kernel.function("*nit*") | sort
David Buck
  • 3,752
  • 35
  • 31
  • 35
NoAsh
  • 11
  • 1
0

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!

Farhan Yusufzai
  • 297
  • 6
  • 23