diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | testsuite/systemtap.context/num_args.stp | 53 | ||||
-rw-r--r-- | testsuite/systemtap.context/num_args.tcl | 58 |
3 files changed, 116 insertions, 0 deletions
@@ -1,5 +1,10 @@ 2008-06-04 Jim Keniston <jkenisto@us.ibm.com> + * testsuite/systemtap.context/num_args.{stp,tcl}: Added. + Same as args.{stp,tcl}, but refs args using *_arg(). + +2008-06-04 Jim Keniston <jkenisto@us.ibm.com> + PR 6588 * tapset/syscalls.stp: Remove return aliases for exit and exit_group. * testsuite/semok/syscalls_return.stp: Regression test diff --git a/testsuite/systemtap.context/num_args.stp b/testsuite/systemtap.context/num_args.stp new file mode 100644 index 00000000..9f15bb01 --- /dev/null +++ b/testsuite/systemtap.context/num_args.stp @@ -0,0 +1,53 @@ +%( arch == "i386" %? global ir = "eax", lr = "eax" %) +%( arch == "i686" %? global ir = "eax", lr = "eax" %) +%( arch == "x86_64" %? global ir = "eax", lr = "rax" %) +%( arch == "ppc64" %? global ir = "r3", lr = "r3" %) + +probe module("systemtap_test_module2").function("yyy_int") { + printf("yyy_int %d %d %d\n", int_arg(1), int_arg(2), int_arg(3)) +} +probe module("systemtap_test_module2").function("yyy_int").return { + printf("yyy_int returns %d\n", register(ir)) +} +probe module("systemtap_test_module2").function("yyy_uint") { + printf("yyy_uint %d %d %d\n", uint_arg(1), uint_arg(2), uint_arg(3)) +} +probe module("systemtap_test_module2").function("yyy_uint").return { + printf("yyy_uint returns %d\n", u_register(ir)) +} +probe module("systemtap_test_module2").function("yyy_long") { + printf("yyy_long %d %d %d\n", long_arg(1), long_arg(2), long_arg(3)) +} +probe module("systemtap_test_module2").function("yyy_long").return { + printf("yyy_long returns %d\n", register(lr)) +} +probe module("systemtap_test_module2").function("yyy_int64") { +# On i386, kernel is built with -mregparm=3. The first arg occupies the +# first two registers. The 2nd arg is not split between the 3rd register +# and the stack, but rather passed entirely on the stack. + printf("yyy_int64 %d %d %d\n", +%( arch == "i386" %? s64_arg(1), s64_arg(4), s64_arg(6) +%: %( arch == "i686" %? s64_arg(1), s64_arg(4), s64_arg(6) + %: s64_arg(1), s64_arg(2), s64_arg(3) + %) +%) + ) +} +probe module("systemtap_test_module2").function("yyy_int64").return { + printf("yyy_int64 returns %d\n", register(ir)) +} +probe module("systemtap_test_module2").function("yyy_char") { + printf("yyy_char %1b %1b %1b\n", int_arg(1), int_arg(2), int_arg(3)) +} +probe module("systemtap_test_module2").function("yyy_char").return { + printf("yyy_char returns %1b\n", register(ir)) +} +probe module("systemtap_test_module2").function("yyy_str") { + printf("yyy_str %s-%s-%s\n", kernel_string(pointer_arg(1)), kernel_string(pointer_arg(2)), kernel_string(pointer_arg(3))) +} +probe module("systemtap_test_module2").function("yyy_str").return { + printf("yyy_str returns %s\n", kernel_string(register(lr))) +} +probe begin { + printf("READY\n") +} diff --git a/testsuite/systemtap.context/num_args.tcl b/testsuite/systemtap.context/num_args.tcl new file mode 100644 index 00000000..a564b584 --- /dev/null +++ b/testsuite/systemtap.context/num_args.tcl @@ -0,0 +1,58 @@ +spawn stap $srcdir/$subdir/num_args.stp +expect { + -timeout 240 + "READY" { + exec echo 1 > /proc/stap_test_cmd + expect { + -timeout 5 + "yyy_int -1 200 300\r\nyyy_int returns 499\r\n" { + pass "integer function arguments (numeric)" + } + timeout {fail "integer function arguments (numeric)"} + } + exec echo 2 > /proc/stap_test_cmd + expect { + -timeout 5 + "yyy_uint 4294967295 200 300\r\nyyy_uint returns 499\r\n" { + pass "unsigned function arguments (numeric)" + } + timeout {fail "unsigned function arguments (numeric)"} + } + exec echo 3 > /proc/stap_test_cmd + expect { + -timeout 5 + "yyy_long -1 200 300\r\nyyy_long returns 499\r\n" { + pass "long function arguments (numeric)" + } + timeout {fail "long function arguments (numeric)"} + } + exec echo 4 > /proc/stap_test_cmd + expect { + -timeout 5 + "yyy_int64 -1 200 300\r\nyyy_int64 returns 499\r\n" { + pass "int64 function arguments (numeric)" + } + timeout {fail "int64 function arguments (numeric)"} + } + exec echo 5 > /proc/stap_test_cmd + expect { + -timeout 5 + "yyy_char a b c\r\nyyy_char returns Q\r\n" { + pass "char function arguments (numeric)" + } + timeout {fail "char function arguments (numeric)"} + } + exec echo 6 > /proc/stap_test_cmd + expect { + -timeout 5 + "yyy_str Hello-System-Tap\r\nyyy_str returns XYZZY\r\n" { + pass "string function arguments (numeric)" + } + timeout {fail "string function arguments (numeric)"} + } + } + eof {fail "function arguments (numeric): unexpected timeout"} +} +exec kill -INT -[exp_pid] +close +wait |