File: set_user.stp

package info (click to toggle)
systemtap 3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 32,860 kB
  • ctags: 12,513
  • sloc: cpp: 58,610; ansic: 58,189; exp: 37,322; sh: 10,633; xml: 7,771; perl: 2,252; python: 2,066; tcl: 1,305; makefile: 969; lisp: 105; java: 100; awk: 94; asm: 91; sed: 16
file content (75 lines) | stat: -rw-r--r-- 1,490 bytes parent folder | download | duplicates (6)
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
73
74
75
global errors = 0

probe begin {  println("systemtap starting probe")  }
probe end 
{ 
   println("systemtap ending probe")    
   if (!errors)
       println("systemtap test success")
}

probe process("set_user.exe").mark("point") 
{     
  addr = $cbuf	
  try {
     set_user_string(addr,"hello")
     if (user_string(addr) != "hello") 
         printf("Unsuccessful (string)\n")
  } 
  catch {
     printf("Error (string)")
     errors++
  }
  try {
     set_user_string_n(addr,4,"test")
     if (user_string_n(addr,4) != "test")
         printf("Unsuccessful (string_n)\n")
  }
  catch {
     printf("Error (string_n)")
     errors++
  }
  try {
     set_user_long(addr,825253290)
     if (user_long(addr) != 825253290)
         printf("Unsuccessful (long)\n")
  }
  catch {
      printf("Error (long)\n")
      errors++
   }
   try {
      set_user_int(addr,333)
      if (user_int(addr) != 333)
          printf("Unsuccessful (int)\n")
   }
   catch {
      printf("Error (int)\n")
      errors++
   }
   try {
      set_user_short(addr,8)
      if (user_short(addr) != 8)
          printf("Unsuccessful (short)\n")
   }   
   catch {
      printf("Error (short)\n")
      errors++
   }
   try {
      set_user_char(addr,15)
      if (user_char(addr) != 15)
          printf("Unsuccessful (char)\n")
   }
   catch {
      printf("Error (char)\n")
      errors++
   }
   try {
      set_user_pointer(addr,0x05)
   }
   catch {
      printf("Error (pointer)\n\n")
      errors++
   }
}