Debian Codegraph @

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

raw
1 /*
2 * global_init.stp
3 *
4 * Check that global variables are initialized before all begin probes
5 */
6
7 probe begin { println("systemtap starting probe") }
8 probe end { println("systemtap ending probe") }
9
10 global gnum = 42
11 global gstr = "foobar"
12
13 global gnum_saved
14 global gstr_saved
15 probe begin(-9223372036854775808) {
16 gnum_saved = gnum
17 gstr_saved = gstr
18 }
19
20 probe end {
21 rc = 0
22 if (gnum_saved == 42)
23 rc += 1
24 else
25 printf("systemtap test failure - gnum_saved:%d != 42\n", gnum_saved)
26
27 if (gstr_saved == "foobar")
28 rc += 1
29 else
30 printf("systemtap test failure - gstr_saved:%s != foobar\n", gstr_saved)
31
32 if (rc == 2)
33 println("systemtap test success")
34 else
35 printf("systemtap test failure (%d passes)\n", rc)
36 }
37