]> sourceware.org Git - systemtap.git/commitdiff
Cast negative values to smaller type.
authorStan Cox <scox@redhat.com>
Tue, 4 May 2010 20:14:25 +0000 (16:14 -0400)
committerStan Cox <scox@redhat.com>
Tue, 4 May 2010 20:14:25 +0000 (16:14 -0400)
sdt_types.stp (short,int): New.
(const_short_int_var,volatile_short_int_var,const_int_var,volatile_int_var): Use it.

testsuite/systemtap.base/sdt_misc.exp
testsuite/systemtap.base/sdt_types.stp

index cf61416781d96b6d65de5d0e72b406baf9f11936..8314a6c06a1ac1d650ab9ac72ebd404c97581f2f 100644 (file)
@@ -329,8 +329,8 @@ if { $res != "" } {
 
 set ok 0
 set fail "types"
-verbose -log "spawn $stap_path -c ./sdt_types.x $srcdir/$subdir/sdt_types.stp ./sdt_types.x"
-spawn $stap_path -c ./sdt_types.x $srcdir/$subdir/sdt_types.stp ./sdt_types.x
+verbose -log "spawn $stap_path -g -c ./sdt_types.x $srcdir/$subdir/sdt_types.stp ./sdt_types.x"
+spawn $stap_path -g -c ./sdt_types.x $srcdir/$subdir/sdt_types.stp ./sdt_types.x
 
 expect {
     -timeout 180
index 1742b8b86e4159e5934732e610be1546d9bd70d2..8096a81933c76fdd58914f73b67cd30208189725 100644 (file)
@@ -1,3 +1,11 @@
+function short:long (val) %{
+  THIS->__retvalue = (short) THIS->val;
+%}
+
+function int:long (val) %{
+  THIS->__retvalue = (int) THIS->val;
+%}
+
 probe process(@1).mark("char_var") {
   if ($arg1 != 126)
     printf("FAIL: char_var\n")
@@ -68,7 +76,7 @@ probe process(@1).mark("short_int_var")
 
 probe process(@1).mark("const_short_int_var")
 {
- if ($arg1 != -32767)
+ if (short($arg1) != -32767)
     printf("FAIL: const_short_int_var\n")
  else
     printf("PASS: const_short_int_var\n")
@@ -76,7 +84,7 @@ probe process(@1).mark("const_short_int_var")
 
 probe process(@1).mark("volatile_short_int_var")
 {
-  if ($arg1 != -32767)
+  if (short($arg1) != -32767)
     printf("FAIL: volatile_short_int_var\n")
   else
     printf("PASS: volatile_short_int_var\n")
@@ -132,7 +140,7 @@ probe process(@1).mark("int_var")
 
 probe process(@1).mark("const_int_var")
 {
-  if ($arg1 != -65536)
+  if (int($arg1) != int(-65536))
     printf("FAIL: const_int_var\n")
   else
     printf("PASS: const_int_var\n")
@@ -140,7 +148,7 @@ probe process(@1).mark("const_int_var")
 
 probe process(@1).mark("volatile_int_var")
 {
-  if ($arg1 != -65536)
+  if (int($arg1) != int(-65536))
     printf("FAIL: volatile_int_var\n")
   else
     printf("PASS: volatile_int_var\n")
@@ -196,7 +204,7 @@ probe process(@1).mark("long_int_var")
 
 probe process(@1).mark("const_long_int_var")
 {
-  if ($arg1 != -65536)
+  if (int($arg1) != int(-65536))
     printf("FAIL: const_long_int_var\n")
   else
     printf("PASS: const_long_int_var\n")
@@ -204,7 +212,7 @@ probe process(@1).mark("const_long_int_var")
 
 probe process(@1).mark("volatile_long_int_var")
 {
-  if ($arg1 != -65536)
+  if (int($arg1) != int(-65536))
     printf("FAIL: volatile_long_int_var\n")
   else
     printf("PASS: volatile_long_int_var\n")
@@ -260,7 +268,7 @@ probe process(@1).mark("long_long_int_var")
 
 probe process(@1).mark("const_long_long_int_var")
 {
-  if ($arg1 != -65536)
+  if (int($arg1) != int(-65536))
     printf("FAIL: const_long_long_int_var\n")
   else
     printf("PASS: const_long_long_int_var\n")
@@ -268,7 +276,7 @@ probe process(@1).mark("const_long_long_int_var")
 
 probe process(@1).mark("volatile_long_long_int_var")
 {
-  if ($arg1 != -65536)
+  if (int($arg1) != int(-65536))
     printf("FAIL: volatile_long_long_int_var\n")
   else
     printf("PASS: volatile_long_long_int_var\n")
@@ -342,7 +350,7 @@ probe process(@1).mark("bitfields_small_var")
 
 probe process(@1).mark("bitfields_bit_var")
 {
-  if ($arg1 != 65 || $arg2 != -1 || $arg3 != 1 || $arg4 != 1
+  if ($arg1 != 65 || ((int($arg2)) != (int(-1))) || $arg3 != 1 || $arg4 != 1
       || $arg5 != 3 || $arg6 != 3 || $arg7 != 7 || $arg8 != 255
       || $arg9 != 511 || $arg10 != 90)
     printf("FAIL: bitfields_bit_var\n")
@@ -358,14 +366,3 @@ probe process(@1).mark("primary_colors_var")
   else
     printf("PASS: primary_colors_var\n")
 }
-
-
-  
-
-
-
-
-
-
-
-
This page took 0.034611 seconds and 5 git commands to generate.