Debian Codegraph @

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

raw
1 global errors = 0
2
3 probe begin { println("systemtap starting probe") }
4 probe end
5 {
6 println("systemtap ending probe")
7 if (!errors)
8 println("systemtap test success")
9 }
10
11 probe process("set_user.exe").mark("point")
12 {
13 addr = $cbuf
14 try {
15 set_user_string(addr,"hello")
16 if (user_string(addr) != "hello")
17 printf("Unsuccessful (string)\n")
18 }
19 catch {
20 printf("Error (string)")
21 errors++
22 }
23 try {
24 set_user_string_n(addr,4,"test")
25 if (user_string_n(addr,4) != "test")
26 printf("Unsuccessful (string_n)\n")
27 }
28 catch {
29 printf("Error (string_n)")
30 errors++
31 }
32 try {
33 set_user_long(addr,825253290)
34 if (user_long(addr) != 825253290)
35 printf("Unsuccessful (long)\n")
36 }
37 catch {
38 printf("Error (long)\n")
39 errors++
40 }
41 try {
42 set_user_int(addr,333)
43 if (user_int(addr) != 333)
44 printf("Unsuccessful (int)\n")
45 }
46 catch {
47 printf("Error (int)\n")
48 errors++
49 }
50 try {
51 set_user_short(addr,8)
52 if (user_short(addr) != 8)
53 printf("Unsuccessful (short)\n")
54 }
55 catch {
56 printf("Error (short)\n")
57 errors++
58 }
59 try {
60 set_user_char(addr,15)
61 if (user_char(addr) != 15)
62 printf("Unsuccessful (char)\n")
63 }
64 catch {
65 printf("Error (char)\n")
66 errors++
67 }
68 try {
69 set_user_pointer(addr,0x05)
70 }
71 catch {
72 printf("Error (pointer)\n\n")
73 errors++
74 }
75 }