Debian Codegraph @

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

raw
1 /*
2 * var_scope.stp
3 *
4 * Check variables scope
5 */
6 global var_global=2015;
7
8 probe begin {
9 println("systemtap starting probe")
10 var_probe=2015
11 }
12
13 function changevar()
14 {
15 var_local=2014
16 }
17
18 probe end
19 {
20 println("systemtap ending probe")
21
22 ret=0
23 if (var_global != 2015) {
24 ret=1
25 printf("systemtap test failure - var_global:%d != 2015\n", var_global)
26 }
27
28 var_local=2015
29 changevar()
30 if (var_local != 2015) {
31 ret=1
32 printf("systemtap test failure - var_local:%d != 2015\n", var_local)
33 }
34
35 if (var_probe == 2015) {
36 ret=1
37 printf("systemtap test failure - var_probe:%d == 2015\n", var_probe)
38 }
39
40 if (ret == 0)
41 println("systemtap test success")
42 }