Debian Codegraph @

doc/SystemTap_Beginners_Guide/testsuite/systemtap.base/process_by_pid_no_plt.stp

raw
1 global probed
2
3 probe begin {
4 probed["function"] = 0;
5 probed["statement"] = 0;
6 probed["provider"] = 0;
7 probed["mark"] = 0;
8 printf("systemtap starting probe\n");
9 }
10
11 probe process($1).function("*") {
12 assert($1 == pid(), "failed in process(PID).function(\"*\")")
13 probed["function"] ++;
14 }
15
16 probe process($1).function("main").label("marker_here") ? {
17 assert($1 == pid(), "failed in process(PID).function(main).label(marker_here)")
18 // gcc may not provide enough information to for stap to see this point, hence
19 // why it's optional. since it's optional, don't keep track of whether it's
20 // been seen.
21 }
22
23 probe process($1).statement("*") {
24 assert($1 == pid(), "failed in process(PID).statement\"*\")")
25 probed["statement"]++;
26 }
27
28 probe process($1).provider("*").mark("*") {
29 assert($1 == pid(), "failed in process(PID).provider(\"*\").mark(\"*\")")
30 probed["provider"] ++;
31 }
32
33 probe process($1).mark("*") {
34 assert($1 == pid(), "failed in process(PID).mark(\"*\")")
35 probed["mark"] ++;
36 }
37
38 probe end {
39 printf("systemtap ending probe\n");
40 if (probed["function"] > 0 && probed["mark"] > 0
41 && probed["statement"] > 0 && probed["provider"] > 0)
42 printf("pass\n");
43 else
44 {
45 printf("fail: did not hit all probe points successfully.\n");
46 // print out some information to find out as to where the test failed
47 printf("Hit: function:%d, mark:%d, statement:%d, provider:%d",
48 probed["function"], probed["mark"], probed["statement"],
49 probed["provider"]);
50 }
51 }