summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.exelib/libmarkunamestack.stp
blob: 0efbae0ec0e00ba029ff639d842987328d1c816b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Jumbo stp script
// Arguments: @1 uprobes_exe, @2 libuprobes_lib.so

# lib
probe process(@1).function("main") {
  printf("main\n");
}

probe process(@1).function("main_func") {
  printf("main_func\n");
}

probe process(@2).function("lib_main") {
  printf("lib_main\n");
}

probe process(@2).function("lib_func") {
  printf("lib_func\n");
}

#mark
probe process(@1).mark("main_count") {
  printf("main_count: %d\n", $arg1);
}

probe process(@2).mark("func_count") {
  printf("func_count: %d\n", $arg1);
}

#uname
probe process(@1).function("*") {
  printf("exe: %s=%s\n",probefunc(), usymname(uaddr()));
}

probe process(@2).function("*") {
  printf("lib: %s=%s\n",probefunc(), usymname(uaddr()));
}

# ustack
global hits = 0;

probe process(@1).function("main_func")
{
  if (hits == 0)
    {
      log("print_ubacktrace exe 0");
      print_ubacktrace();
      hits++;
    }
  else if (hits == 1)
    {
      log("print_ustack exe 1");
      print_ustack(ubacktrace());
      hits++;
    }
}

probe process(@2).function("lib_func")
{
  if (hits == 2)
    {
      log("print_ubacktrace lib 2");
      print_ubacktrace();
      hits++;
    }
  else if (hits == 3)
    {
      log("print_ustack lib 3");
      print_ustack(ubacktrace());
      hits++;
    }
}