summaryrefslogtreecommitdiffstats
path: root/testsuite/semok/seven.stp
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/semok/seven.stp')
-rwxr-xr-xtestsuite/semok/seven.stp27
1 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/semok/seven.stp b/testsuite/semok/seven.stp
new file mode 100755
index 00000000..8351c1e2
--- /dev/null
+++ b/testsuite/semok/seven.stp
@@ -0,0 +1,27 @@
+#! stap -p2
+
+global ar1, ar2
+
+function string (v) { num=v+0; return "stringify me" } # to become a built-in
+function printk (s) { str=s.""; return 0 } # to become a built-in
+
+function search (key)
+{
+ if (1) # (key in ar1)
+ { ar1[key] ++; return ar2[ar1[key]] }
+ else
+ return "no can do" # implies ar2[]: string
+}
+
+probe syscall("zamboni")
+{
+ thread->ar2 = string ($tgid);
+ search ($pid)
+}
+
+probe end
+{
+ # for (key in ar2)
+ if (1) # (key in ar2)
+ printk ("this: " . string (key) . " was " . ar2[key])
+}