Question

Well I am trying to probe my own application on the SDT markers. I wrote a systemtap script to probe on it but systemtap shows no errors till pass 5 and then after pass 5 (starting run), it just goes on doing nothing. Here is my C program with SDT marker :

foo.c :

#include <sys/sdt.h>
#include <stdio.h>

    int main(void)
    {
      printf("Before Marker\n");
      DTRACE_PROBE(user_app, foo_start);
      printf("After Marker\n");
      return 0;
    }

And my systemtap script is :

probe_foo.stp

probe process("./user_app").mark("foo_start")
 {
  exit();
 }

And the command I run is :

stap -v probe_foo.stp

This is what I get :

Pass 1: parsed user script and 98 library script(s) using 217528virt/36580res/2976shr/34316data kb, in 190usr/30sys/222real ms.

Pass 2: analyzed script: 1 probe(s), 1 function(s), 0 embed(s), 0 global(s) using 218596virt/38164res/3424shr/35372data kb, in 10usr/0sys/13real ms.

Pass 3: using cached /root/.systemtap/cache/a6/stap_a6e78dea575657695c4456347007229d_990.c

Pass 4: using cached /root/.systemtap/cache/a6/stap_a6e78dea575657695c4456347007229d_990.ko

Pass 5: starting run.

After that it waits infinitely. My kernel version is 3.8.0 and I am using fedora 18.

Was it helpful?

Solution

This looks normal. There is no indication that you ever started the ./user_app binary, so the systemtap probe never hit, so it never had any reason to exit().

Try instead

stap -t probe_foo.stp -c ./user_app

where the '-c ./user_app' will run the given app (and limit probing to it, rather than systemwide), and '-t' will give an overall probe hit-counts/times at script shutdown. (Since you only have one probe that does exit(), this report will be trivial.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top