summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.context
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/systemtap.context')
-rw-r--r--testsuite/systemtap.context/backtrace.tcl34
-rw-r--r--testsuite/systemtap.context/context.exp2
-rw-r--r--testsuite/systemtap.context/num_args.stp53
-rw-r--r--testsuite/systemtap.context/num_args.tcl62
4 files changed, 133 insertions, 18 deletions
diff --git a/testsuite/systemtap.context/backtrace.tcl b/testsuite/systemtap.context/backtrace.tcl
index 6c8aee40..aaec4cb8 100644
--- a/testsuite/systemtap.context/backtrace.tcl
+++ b/testsuite/systemtap.context/backtrace.tcl
@@ -20,11 +20,11 @@ expect {
incr m1
expect {
-timeout 5
- -re {^ 0x[a-f0-9]+ : yyy_func2[^\[]+\[systemtap_test_module2\]\r\n} {
+ -re {^ 0x[a-f0-9]+ : yyy_func2[^\[]+\[systemtap_test_module2\]( \(inexact\))?\r\n} {
if {$m1 == 1} {incr m1}
exp_continue
}
- -re {^ 0x[a-f0-9]+ : yyy_func1[^\[]+\[systemtap_test_module2\]\r\n} {
+ -re {^ 0x[a-f0-9]+ : yyy_func1[^\[]+\[systemtap_test_module2\]( \(inexact\))?\r\n} {
if {$m1 == 2} {incr m1}
}
}
@@ -34,11 +34,11 @@ expect {
incr m2
expect {
-timeout 5
- -re {^ 0x[a-f0-9]+ : yyy_func2[^\[]+\[systemtap_test_module2\]\r\n} {
+ -re {^ 0x[a-f0-9]+ : yyy_func2[^\[]+\[systemtap_test_module2\]( \(inexact\))?\r\n} {
if {$m2 == 1} {incr m2}
exp_continue
}
- -re {^ 0x[a-f0-9]+ : yyy_func1[^\[]+\[systemtap_test_module2\]\r\n} {
+ -re {^ 0x[a-f0-9]+ : yyy_func1[^\[]+\[systemtap_test_module2\]( \(inexact\))?\r\n} {
if {$m2 == 2} {incr m2}
}
}
@@ -50,15 +50,15 @@ expect {
incr m3
expect {
-timeout 5
- -re {^ 0x[a-f0-9]+ : yyy_func3[^\[]+\[systemtap_test_module2\]\r\n} {
+ -re {^ 0x[a-f0-9]+ : yyy_func3[^\[]+\[systemtap_test_module2\]( \(inexact\))?\r\n} {
if {$m3 == 1} {incr m3}
exp_continue
}
- -re {^ 0x[a-f0-9]+ : yyy_func2[^\[]+\[systemtap_test_module2\]\r\n} {
+ -re {^ 0x[a-f0-9]+ : yyy_func2[^\[]+\[systemtap_test_module2\]( \(inexact\))?\r\n} {
if {$m3 == 2} {incr m3}
exp_continue
}
- -re {^ 0x[a-f0-9]+ : yyy_func1[^\[]+\[systemtap_test_module2\]\r\n} {
+ -re {^ 0x[a-f0-9]+ : yyy_func1[^\[]+\[systemtap_test_module2\]( \(inexact\))?\r\n} {
if {$m3 == 3} {incr m3}
}
}
@@ -68,11 +68,11 @@ expect {
incr m4
expect {
-timeout 5
- -re {^ 0x[a-f0-9]+ : yyy_func3[^\[]+\[systemtap_test_module2\]\r\n} {
+ -re {^ 0x[a-f0-9]+ : yyy_func3[^\[]+\[systemtap_test_module2\]( \(inexact\))?\r\n} {
if {$m4 == 1} {incr m4}
exp_continue
}
- -re {^ 0x[a-f0-9]+ : yyy_func2[^\[]+\[systemtap_test_module2\]\r\n} {
+ -re {^ 0x[a-f0-9]+ : yyy_func2[^\[]+\[systemtap_test_module2\]( \(inexact\))?\r\n} {
if {$m4 == 2} {incr m4}
exp_continue
}
@@ -88,19 +88,19 @@ expect {
incr m5
expect {
-timeout 5
- -re {^ 0x[a-f0-9]+ : yyy_func4[^\[]+\[systemtap_test_module2\]\r\n} {
+ -re {^ 0x[a-f0-9]+ : yyy_func4[^\[]+\[systemtap_test_module2\]( \(inexact\))?\r\n} {
if {$m5 == 1} {incr m5}
exp_continue
}
- -re {^ 0x[a-f0-9]+ : yyy_func3[^\[]+\[systemtap_test_module2\]\r\n} {
+ -re {^ 0x[a-f0-9]+ : yyy_func3[^\[]+\[systemtap_test_module2\]( \(inexact\))?\r\n} {
if {$m5 == 2} {incr m5}
exp_continue
}
- -re {^ 0x[a-f0-9]+ : yyy_func2[^\[]+\[systemtap_test_module2\]\r\n} {
+ -re {^ 0x[a-f0-9]+ : yyy_func2[^\[]+\[systemtap_test_module2\]( \(inexact\))?\r\n} {
if {$m5 == 3} {incr m5}
exp_continue
}
- -re {^ 0x[a-f0-9]+ : yyy_func1[^\[]+\[systemtap_test_module2\]\r\n} {
+ -re {^ 0x[a-f0-9]+ : yyy_func1[^\[]+\[systemtap_test_module2\]( \(inexact\))?\r\n} {
if {$m5 == 4} {incr m5}
}
}
@@ -110,19 +110,19 @@ expect {
incr m6
expect {
-timeout 5
- -re {^ 0x[a-f0-9]+ : yyy_func4[^\[]+\[systemtap_test_module2\]\r\n} {
+ -re {^ 0x[a-f0-9]+ : yyy_func4[^\[]+\[systemtap_test_module2\]( \(inexact\))?\r\n} {
if {$m6 == 1} {incr m6}
exp_continue
}
- -re {^ 0x[a-f0-9]+ : yyy_func3[^\[]+\[systemtap_test_module2\]\r\n} {
+ -re {^ 0x[a-f0-9]+ : yyy_func3[^\[]+\[systemtap_test_module2\]( \(inexact\))?\r\n} {
if {$m6 == 2} {incr m6}
exp_continue
}
- -re {^ 0x[a-f0-9]+ : yyy_func2[^\[]+\[systemtap_test_module2\]\r\n} {
+ -re {^ 0x[a-f0-9]+ : yyy_func2[^\[]+\[systemtap_test_module2\]( \(inexact\))?\r\n} {
if {$m6 == 3} {incr m6}
exp_continue
}
- -re {^ 0x[a-f0-9]+ : yyy_func1[^\[]+\[systemtap_test_module2\]\r\n} {
+ -re {^ 0x[a-f0-9]+ : yyy_func1[^\[]+\[systemtap_test_module2\]( \(inexact\))?\r\n} {
if {$m6 == 4} {incr m6}
}
}
diff --git a/testsuite/systemtap.context/context.exp b/testsuite/systemtap.context/context.exp
index 71201a58..010db445 100644
--- a/testsuite/systemtap.context/context.exp
+++ b/testsuite/systemtap.context/context.exp
@@ -1,4 +1,4 @@
-set testlist {backtrace args pid}
+set testlist {backtrace args pid num_args}
if {![installtest_p]} {
foreach test $testlist {
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..48e83f4d
--- /dev/null
+++ b/testsuite/systemtap.context/num_args.tcl
@@ -0,0 +1,62 @@
+set arglists {{} {--kelf --ignore-dwarf}}
+foreach arglist $arglists {
+set tag [concat numeric $arglist]
+eval spawn stap $arglist $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 -- $tag"
+ }
+ timeout {fail "integer function arguments -- $tag"}
+ }
+ 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 -- $tag"
+ }
+ timeout {fail "unsigned function arguments -- $tag"}
+ }
+ 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 -- $tag"
+ }
+ timeout {fail "long function arguments -- $tag"}
+ }
+ 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 -- $tag"
+ }
+ timeout {fail "int64 function arguments -- $tag"}
+ }
+ 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 -- $tag"
+ }
+ timeout {fail "char function arguments -- $tag"}
+ }
+ 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 -- $tag"
+ }
+ timeout {fail "string function arguments -- $tag"}
+ }
+ }
+ eof {fail "function arguments -- $tag: unexpected timeout"}
+}
+exec kill -INT -[exp_pid]
+close
+wait
+}