summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2007-12-14 11:08:51 -0500
committerFrank Ch. Eigler <fche@elastic.org>2007-12-14 11:08:51 -0500
commit06e0853b32f53f33d791a99d21e630800642a442 (patch)
treed94038318e93302e360e2f855f77dc6b8eec1f3f
parente9369426e1146a2373ac47c11647bdd70d41f7be (diff)
parent149eaccd1d42882b20471c4fdae07c32024cc654 (diff)
downloadsystemtap-steved-06e0853b32f53f33d791a99d21e630800642a442.tar.gz
systemtap-steved-06e0853b32f53f33d791a99d21e630800642a442.tar.xz
systemtap-steved-06e0853b32f53f33d791a99d21e630800642a442.zip
Merge branch 'master' of git://sources.redhat.com/git/systemtap
-rw-r--r--ChangeLog27
-rw-r--r--NEWS29
-rw-r--r--parse.cxx4
-rw-r--r--runtime/staprun/ChangeLog6
-rw-r--r--runtime/staprun/relay.c19
-rw-r--r--runtime/staprun/relay_old.c19
-rw-r--r--stap.1.in15
-rw-r--r--stapprobes.5.in8
-rw-r--r--staptree.cxx1
-rw-r--r--staptree.h4
-rw-r--r--systemtap.spec.in7
-rw-r--r--tapset/ChangeLog16
-rw-r--r--tapset/aux_syscalls.stp8
-rw-r--r--tapset/syscalls2.stp32
-rw-r--r--tapsets.cxx10
-rw-r--r--testsuite/ChangeLog24
-rw-r--r--testsuite/lib/systemtap.exp10
-rw-r--r--testsuite/parseko/probepoint04.stp4
-rw-r--r--testsuite/parseko/probepoint05.stp4
-rw-r--r--testsuite/parseko/probepoint06.stp4
-rw-r--r--testsuite/parseko/probepoint07.stp4
-rw-r--r--testsuite/parseko/probepoint08.stp4
-rw-r--r--testsuite/parseko/probepoint09.stp4
-rwxr-xr-xtestsuite/parseok/five.stp1
-rwxr-xr-xtestsuite/semko/thirtynine.stp3
-rw-r--r--testsuite/semok/twentynine.stp20
-rw-r--r--testsuite/systemtap.base/onoffprobe.exp57
-rw-r--r--testsuite/systemtap.base/onoffprobe.stp35
-rw-r--r--testsuite/systemtap.pass1-4/buildko.exp9
-rw-r--r--testsuite/systemtap.pass1-4/parseko.exp9
-rw-r--r--testsuite/systemtap.pass1-4/semko.exp9
-rw-r--r--testsuite/systemtap.pass1-4/transko.exp9
32 files changed, 364 insertions, 51 deletions
diff --git a/ChangeLog b/ChangeLog
index 6bf0ad72..b4f41825 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2007-12-13 Masami Hiramatsu <mhiramat@redhat.com>
+
+ * stap.1.in: Document about relay buffer sharing.
+ * NEWS: Document about relay buffer sharing and staplog crash extension.
+
+2007-12-12 Wenji Huang <wenji.huang@oracle.com>
+
+ PR 5470
+ * parse.cxx (parser::parse_probe_point): Add checking pointer t.
+
+2007-12-11 Frank Ch. Eigler <fche@elastic.org>
+
+ * staptree.cxx, staptree.h: More GCC 4.3 build fixes from
+ Eugeniy Meshcheryakov <eugen@debian.org>.
+
+2007-12-05 William Cohen <wcohen@redhat.com>
+
+ * systemtap.spec.in: Correct Source to point to location contain code.
+
+2007-12-05 Masami Hiramatsu <mhiramat@redhat.com>
+
+ PR 4935
+ * tapsets.cxx (dwarf_derived_probe::dwarf_derived_probe): Allow user
+ to access kernel variables in the condition of probe points.
+ * stapprobes.5.in : Document the conditional probe point.
+ * NEWS : Ditto.
+
2007-12-03 Masami Hiramatsu <mhiramat@redhat.com>
PR 5376
diff --git a/NEWS b/NEWS
index c5f3937c..7b3e3265 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,34 @@
* What's new in version 0.6 / since version 0.5.15?
+- Crash utility can retrieve systemtap's relay buffer from a kernel dump
+ image by using staplog which is a crash extension module. To use this
+ feature, type commands as below from crash(8)'s command line:
+
+ crash> extend staplog.so
+ crash> help systemtaplog
+
+ Then, you can see more precise help message.
+
+- You can share a relay buffer amoung several scripts and merge outputs from
+ several scripts by using "-DRELAY_HOST" and "-DRELAY_GUEST" options.
+ For example:
+
+ # run a host script
+ % stap -ve 'probe begin{}' -o merged.out -DRELAY_HOST &
+ # wait until starting the host.
+ % stap -ve 'probe begin{print("hello ");exit()}' -DRELAY_GUEST
+ % stap -ve 'probe begin{print("world\n");exit()}' -DRELAY_GUEST
+
+ Then, you'll see "hello world" in merged.out.
+
+- You can add a conditional statement for each probe point or aliase, which
+ is evaluated when the probe point is hit. If the condition is false, the
+ whole probe body(including aliases) is skipped. For example:
+
+ global switch = 0;
+ probe syscall.* if (switch) { ... }
+ probe procfs.write {switch = strtol($value,10)} /* enable/disable ctrl */
+
- Systemtap will warn you if your script contains unused variables or
functions. This is helpful in case of misspelled variables. If it
doth protest too much, turn it off with "stap -w ...".
diff --git a/parse.cxx b/parse.cxx
index 2aca32fb..a829fa10 100644
--- a/parse.cxx
+++ b/parse.cxx
@@ -1343,14 +1343,14 @@ parser::parse_probe_point ()
{
next ();
t = peek ();
- if (! (t->type == tok_operator && t->content == "("))
+ if (t && ! (t->type == tok_operator && t->content == "("))
throw parse_error ("expected '('");
next ();
pl->condition = parse_expression ();
t = peek ();
- if (! (t->type == tok_operator && t->content == ")"))
+ if (t && ! (t->type == tok_operator && t->content == ")"))
throw parse_error ("expected ')'");
next ();
t = peek ();
diff --git a/runtime/staprun/ChangeLog b/runtime/staprun/ChangeLog
index 540153d7..5cd036fd 100644
--- a/runtime/staprun/ChangeLog
+++ b/runtime/staprun/ChangeLog
@@ -1,3 +1,9 @@
+2007-12-11 Martin Hunt <hunt@redhat.com>
+ PR5368
+ * relay_old.c (init_oldrelayfs): Don't start threads
+ if load_only.
+ * relay.c (init_relayfs): Ditto.
+
2007-11-09 Martin Hunt <hunt@redhat.com>
* mainloop.c (stp_main_loop): Bump recvbuf to 8196 for
diff --git a/runtime/staprun/relay.c b/runtime/staprun/relay.c
index 538d027c..19621933 100644
--- a/runtime/staprun/relay.c
+++ b/runtime/staprun/relay.c
@@ -97,7 +97,6 @@ static void *reader_thread(void *data)
_perr("poll error");
return(NULL);
}
- stop_threads = 1;
}
while ((rc = read(relay_fd[cpu], buf, sizeof(buf))) > 0) {
if (write(out_fd[cpu], buf, rc) != rc) {
@@ -201,15 +200,17 @@ int init_relayfs(void)
out_fd[0] = STDOUT_FILENO;
}
- dbug(2, "starting threads\n");
- for (i = 0; i < ncpus; i++) {
- if (pthread_create(&reader[i], NULL, reader_thread,
- (void *)(long)i) < 0) {
- _perr("failed to create thread");
- return -1;
+ if (!load_only) {
+ dbug(2, "starting threads\n");
+ for (i = 0; i < ncpus; i++) {
+ if (pthread_create(&reader[i], NULL, reader_thread,
+ (void *)(long)i) < 0) {
+ _perr("failed to create thread");
+ return -1;
+ }
}
- }
-
+ }
+
return 0;
}
diff --git a/runtime/staprun/relay_old.c b/runtime/staprun/relay_old.c
index f138aee5..bd746f19 100644
--- a/runtime/staprun/relay_old.c
+++ b/runtime/staprun/relay_old.c
@@ -303,14 +303,17 @@ int init_oldrelayfs(void)
return -1;
}
- for (i = 0; i < ncpus; i++) {
- /* create a thread for each per-cpu buffer */
- if (pthread_create(&reader[i], NULL, reader_thread, (void *)(long)i) < 0) {
- int saved_errno = errno;
- close_relayfs_files(i);
- err("ERROR: Couldn't create reader thread, cpu = %d: %s\n",
- i, strerror(saved_errno));
- goto err;
+ if (!load_only) {
+ dbug(2, "starting threads\n");
+ for (i = 0; i < ncpus; i++) {
+ /* create a thread for each per-cpu buffer */
+ if (pthread_create(&reader[i], NULL, reader_thread, (void *)(long)i) < 0) {
+ int saved_errno = errno;
+ close_relayfs_files(i);
+ err("ERROR: Couldn't create reader thread, cpu = %d: %s\n",
+ i, strerror(saved_errno));
+ goto err;
+ }
}
}
return 0;
diff --git a/stap.1.in b/stap.1.in
index 135e92f5..16a799cf 100644
--- a/stap.1.in
+++ b/stap.1.in
@@ -869,6 +869,21 @@ run a probe handler, default 1024. This number should be large enough
for the probe handler's own needs, plus a safety margin.
.PP
+Multipule scripts can write data into a relay buffer concurrently. A host
+script provides an interface for accessing its relay buffer to guest scripts.
+Then, the output of the guests are merged into the output of the host.
+To run a script as a host, execute stap with
+.BR \-DRELAYHOST[=name]
+option. The
+.BR name
+identifies your host script among several hosts.
+While running the host, execute stap with
+.BR \-DRELAYGUEST[=name]
+to add a guest script to the host.
+Note that you must unload guests before unloading a host. If there are some
+guests connected to the host, unloading the host will be failed.
+
+.PP
In case something goes wrong with
.IR stap " or " staprun
after a probe has already started running, one may safely kill both
diff --git a/stapprobes.5.in b/stapprobes.5.in
index 6d1df5a4..276358a0 100644
--- a/stapprobes.5.in
+++ b/stapprobes.5.in
@@ -41,6 +41,13 @@ sufficient. (Think vaguely of the prolog cut operator.) If it does
resolve, then no further probe points in the same comma-separated list
will be resolved. Therefore, the "!" sufficiency mark only makes
sense in a list of probe point alternatives.
+.PP
+Additionally, a probe point may be followed by a "if (expr)" statement, in
+order to enable/disable the probe point on-the-fly. With the "if" statement,
+if the "expr" is false when the probe point is hit, the whole probe body
+including alias's body is skipped. The condition is stacked up through
+all levels of alias/wildcard expansion. So the final condition becomes
+the logical-and of conditions of all expanded alias/wildcard.
These are all syntactically valid probe points:
@@ -52,6 +59,7 @@ end
syscall.*
kernel.function("no_such_function") ?
module("awol").function("no_such_function") !
+signal.*? if (switch)
.ESAMPLE
Probes may be broadly classified into "synchronous" and
diff --git a/staptree.cxx b/staptree.cxx
index d0b4a0ed..8cd9ca83 100644
--- a/staptree.cxx
+++ b/staptree.cxx
@@ -15,6 +15,7 @@
#include <typeinfo>
#include <sstream>
#include <cassert>
+#include <cstring>
#include <vector>
#include <algorithm>
diff --git a/staptree.h b/staptree.h
index 9e32d16b..a1a5ebd2 100644
--- a/staptree.h
+++ b/staptree.h
@@ -835,7 +835,7 @@ struct deep_copy_visitor: public visitor
virtual void visit_hist_op (hist_op* e);
};
-template <typename T> static void
+template <typename T> void
require (deep_copy_visitor* v, T* dst, T src)
{
*dst = NULL;
@@ -874,7 +874,7 @@ require <indexable *> (deep_copy_visitor* v, indexable** dst, indexable* src)
}
}
-template <typename T> static void
+template <typename T> void
provide (deep_copy_visitor* v, T src)
{
assert(!v->targets.empty());
diff --git a/systemtap.spec.in b/systemtap.spec.in
index 3fc6dfdc..576626d7 100644
--- a/systemtap.spec.in
+++ b/systemtap.spec.in
@@ -1,5 +1,5 @@
# Release number for rpm build. Stays at 1 for new PACKAGE_VERSION increases.
-%define release 1
+%define release 2
# Version number of oldest elfutils release that works with systemtap.
%define elfutils_version 0.127
@@ -41,7 +41,7 @@ Summary: Instrumentation System
Group: Development/System
License: GPLv2+
URL: http://sourceware.org/systemtap/
-Source: ftp://sourceware.org/pub/%{name}/%{name}-%{version}.tar.gz
+Source: ftp://sourceware.org/pub/%{name}/releases/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -199,6 +199,9 @@ exit 0
%changelog
+* Wed Dec 5 2007 Will Cohen <wcohen@redhat.com> - 0.6-2
+- Correct Source to point to location contain code.
+
* Thu Aug 9 2007 David Smith <dsmith@redhat.com> - 0.6-1
- Bumped version, added libcap-devel BuildRequires.
diff --git a/tapset/ChangeLog b/tapset/ChangeLog
index 49ccfbfa..936d9847 100644
--- a/tapset/ChangeLog
+++ b/tapset/ChangeLog
@@ -1,3 +1,19 @@
+2007-12-12 Martin Hunt <hunt@redhat.com>
+
+ * syscalls2.stp (compat_sys_ptrace): Remove for now.
+ Utrace-patched kernels have a different compat_sys_ptrace().
+
+2007-12-7 Zhaolei <zhaolei@cn.fujitsu.com>
+
+ From Yang Zhiguo <yzgcsu@cn.fujitsu.com>
+ * syscalls2.stp: Add missed compat* probes in syscalls2.stp.
+
+2007-12-7 Zhaolei <zhaolei@cn.fujitsu.com>
+
+ From Bai Weidong <baiwd@cn.fujitsu.com>
+ * aux_syscalls.stp (__sem_flags): Add the missed mode display,
+ Fix calculation error when string is empty.
+
2007-11-21 Zhaolei <zhaolei@cn.fujitsu.com>
From Bai Weidong <baiwd@cn.fujitsu.com>
diff --git a/tapset/aux_syscalls.stp b/tapset/aux_syscalls.stp
index e8823190..135ea98f 100644
--- a/tapset/aux_syscalls.stp
+++ b/tapset/aux_syscalls.stp
@@ -382,13 +382,19 @@ function __sem_flags:string(semflg:long)
%{ /* pure */
long semflg = THIS->semflg;
char *str = THIS->__retvalue;
+ int mode = semflg & S_IRWXUGO;
+ int len;
+ if (mode)
+ snprintf(str, MAXSTRINGLEN, "%#o|", mode);
if (semflg & IPC_CREAT)
strlcat(str, "IPC_CREAT|", MAXSTRINGLEN);
if (semflg & IPC_EXCL)
strlcat(str, "IPC_EXCL|", MAXSTRINGLEN);
- str[strlen(str)-1] = 0;
+ len = strlen(str);
+ if (len)
+ str[len-1] = 0;
%}
diff --git a/tapset/syscalls2.stp b/tapset/syscalls2.stp
index 7029e09c..e49a9224 100644
--- a/tapset/syscalls2.stp
+++ b/tapset/syscalls2.stp
@@ -455,22 +455,20 @@ probe syscall.compat_pselect7.return = kernel.function("compat_sys_pselect7").re
# ptrace _____________________________________________________
#
-# asmlinkage int
-# sys_ptrace(long request,
+# int sys_ptrace(long request,
# long pid,
# long addr,
# long data)
#
-probe syscall.ptrace = kernel.function("sys_ptrace") {
- name = "ptrace"
+probe syscall.ptrace = kernel.function("sys_ptrace") ? {
+ name = "ptrace"
request = $request
pid = $pid
addr = $addr
data = $data
- argstr = sprintf("%p, %p, %p, %p", request, pid,
- addr, data)
+ argstr = sprintf("%d, %d, %p, %p", request, pid, addr, data)
}
-probe syscall.ptrace.return = kernel.function("sys_ptrace").return {
+probe syscall.ptrace.return = kernel.function("sys_ptrace").return ? {
name = "ptrace"
retstr = returnstr(1)
}
@@ -1645,14 +1643,20 @@ probe syscall.compat_setitimer.return = kernel.function("compat_sys_setitimer").
# unsigned long __user *nmask,
# unsigned long maxnode)
#
-probe syscall.set_mempolicy = kernel.function("sys_set_mempolicy") ? {
+probe syscall.set_mempolicy =
+ kernel.function("sys_set_mempolicy") ?,
+ kernel.function("compat_sys_set_mempolicy") ?
+{
name = "set_mempolicy"
mode = $mode
nmask_uaddr = $nmask
maxnode = $maxnode
argstr = sprintf("%d, %p, %d", $mode, $nmask, $maxnode)
}
-probe syscall.set_mempolicy.return = kernel.function("sys_set_mempolicy").return ? {
+probe syscall.set_mempolicy.return =
+ kernel.function("sys_set_mempolicy").return ?,
+ kernel.function("compat_sys_set_mempolicy").return ?
+{
name = "set_mempolicy"
retstr = returnstr(1)
}
@@ -2467,11 +2471,17 @@ probe syscall.sync.return = kernel.function("sys_sync").return {
#
# long sys_sysctl(struct __sysctl_args __user *args)
#
-probe syscall.sysctl = kernel.function("sys_sysctl") ? {
+probe syscall.sysctl =
+ kernel.function("sys_sysctl") ?,
+ kernel.function("compat_sys_sysctl") ?
+{
name = "sysctl"
argstr = sprintf("%p", $args)
}
-probe syscall.sysctl.return = kernel.function("sys_sysctl").return ? {
+probe syscall.sysctl.return =
+ kernel.function("sys_sysctl").return ?,
+ kernel.function("compat_sys_sysctl").return ?
+{
name = "sysctl"
retstr = returnstr(1)
}
diff --git a/tapsets.cxx b/tapsets.cxx
index 35fe1e4b..d2cd3bcd 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -3642,11 +3642,16 @@ dwarf_derived_probe::dwarf_derived_probe(const string& funcname,
this->tok = q.base_probe->tok;
+ // add condition from base location
+ if (q.base_loc->condition)
+ add_condition (q.base_loc->condition);
+ insert_condition_statement ();
+
// Make a target-variable-expanded copy of the probe body
if (scope_die)
{
dwarf_var_expanding_copy_visitor v (q, scope_die, dwfl_addr);
- require <block*> (&v, &(this->body), q.base_probe->body);
+ require <block*> (&v, &(this->body), this->body);
// If during target-variable-expanding the probe, we added a new block
// of code, add it to the start of the probe.
@@ -3718,9 +3723,6 @@ dwarf_derived_probe::dwarf_derived_probe(const string& funcname,
(TOK_MAXACTIVE, new literal_number(maxactive_val)));
locations.push_back(new probe_point(comps, q.base_loc->tok));
- if (q.base_loc->condition)
- add_condition (q.base_loc->condition);
- insert_condition_statement ();
}
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index 843dd90e..b60527ee 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,27 @@
+2007-12-12 Martin Hunt <hunt@redhat.com>
+ Detect crashing stap and report as a test failure.
+ * lib/systemtap.exp (stap_run_batch): Return -1 if stap
+ crashed.
+ * systemtap.pass1-4/buildko.exp: If stap_run_batch returned
+ -1 then mark test as failed.
+ * systemtap.pass1-4/parseko.exp: Ditto.
+ * systemtap.pass1-4/semko.exp: Ditto.
+ * systemtap.pass1-4/transko.exp: Ditto.
+
+2007-12-05 Masami Hiramatsu <mhiramat@redhat.com>
+
+ PR 4935
+ * parseok/five.stp: Add an example of conditional probe point.
+ * parseko/probepoint04.stp: New test for conditional probe point.
+ * parseko/probepoint05.stp: Ditto.
+ * parseko/probepoint06.stp: Ditto.
+ * parseko/probepoint07.stp: Ditto.
+ * parseko/probepoint08.stp: Ditto.
+ * parseko/probepoint09.stp: Ditto.
+ * semok/twentynine.stp: Ditto.
+ * semko/thirtynine.stp: Ditto.
+ * systemtap.base/onoffprobe.*: Ditto.
+
2007-12-03 Masami Hiramatsu <mhiramat@redhat.com>
PR 5376
diff --git a/testsuite/lib/systemtap.exp b/testsuite/lib/systemtap.exp
index 5b08c233..7fb1e317 100644
--- a/testsuite/lib/systemtap.exp
+++ b/testsuite/lib/systemtap.exp
@@ -104,8 +104,10 @@ proc stap_run_batch {args} {
}
set results [wait]
verbose -log "wait results: $results"
- # Crashed?
- if {[llength $results] >= 5} {return 1}
- # Not?
- return [lindex $results 3]
+ if {[llength $results] >= 5} {
+ # Unexpected output. stap must have crashed
+ return -1
+ } else {
+ return [lindex $results 3]
+ }
}
diff --git a/testsuite/parseko/probepoint04.stp b/testsuite/parseko/probepoint04.stp
new file mode 100644
index 00000000..754c9e63
--- /dev/null
+++ b/testsuite/parseko/probepoint04.stp
@@ -0,0 +1,4 @@
+#! stap -p1
+
+# bad probe point
+probe foo(5) if (1)?
diff --git a/testsuite/parseko/probepoint05.stp b/testsuite/parseko/probepoint05.stp
new file mode 100644
index 00000000..11464ae2
--- /dev/null
+++ b/testsuite/parseko/probepoint05.stp
@@ -0,0 +1,4 @@
+#! stap -p1
+
+# bad probe point
+probe foo(5) if (1)(10)
diff --git a/testsuite/parseko/probepoint06.stp b/testsuite/parseko/probepoint06.stp
new file mode 100644
index 00000000..ebe23514
--- /dev/null
+++ b/testsuite/parseko/probepoint06.stp
@@ -0,0 +1,4 @@
+#! stap -p1
+
+# bad probe point
+probe if (1) foo(5)
diff --git a/testsuite/parseko/probepoint07.stp b/testsuite/parseko/probepoint07.stp
new file mode 100644
index 00000000..1f240a02
--- /dev/null
+++ b/testsuite/parseko/probepoint07.stp
@@ -0,0 +1,4 @@
+#! stap -p1
+
+# bad probe point
+probe foo(5) if (1(
diff --git a/testsuite/parseko/probepoint08.stp b/testsuite/parseko/probepoint08.stp
new file mode 100644
index 00000000..a0ec712f
--- /dev/null
+++ b/testsuite/parseko/probepoint08.stp
@@ -0,0 +1,4 @@
+#! stap -p1
+
+# bad probe point
+probe foo(5) if
diff --git a/testsuite/parseko/probepoint09.stp b/testsuite/parseko/probepoint09.stp
new file mode 100644
index 00000000..a7bf15d8
--- /dev/null
+++ b/testsuite/parseko/probepoint09.stp
@@ -0,0 +1,4 @@
+#! stap -p1
+
+# bad probe point
+probe foo(5) if(1) bar(2)
diff --git a/testsuite/parseok/five.stp b/testsuite/parseok/five.stp
index e1b5d94a..a226dfe2 100755
--- a/testsuite/parseok/five.stp
+++ b/testsuite/parseok/five.stp
@@ -19,3 +19,4 @@ probe resource.freemembelow(50) {} # pages?
probe begin {}
probe something?, or?, nothing? {}
probe something!, or, nothing!, and?, zoo {}
+probe something? if (ture), or, nothing! if (false), then* if (0) {}
diff --git a/testsuite/semko/thirtynine.stp b/testsuite/semko/thirtynine.stp
new file mode 100755
index 00000000..6d0e6982
--- /dev/null
+++ b/testsuite/semko/thirtynine.stp
@@ -0,0 +1,3 @@
+#! stap -p2
+
+probe kernel.function("sys_open").if(1) {} /* if statement doesn't need '.'*/
diff --git a/testsuite/semok/twentynine.stp b/testsuite/semok/twentynine.stp
new file mode 100644
index 00000000..6fe308f2
--- /dev/null
+++ b/testsuite/semok/twentynine.stp
@@ -0,0 +1,20 @@
+#! stap -p2
+global p
+function dummy:long () {return p;}
+
+# alias with a condition
+probe alias0 = begin if (3) {p=1}
+# alias with a kernel-variable condition
+probe alias1 = kernel.function("sys_read").return if ($return) {p=0}
+# alias with a function-call condition
+probe blias0 = timer.s(1) if (dummy()) {p=10}
+
+# multiple probe point with conditions
+probe alias2 = alias0 if (1), alias1 if (-1) {p=2}
+
+# wildcard with a global-variable condition
+probe *lias0 if (p) {print(p)}
+
+# multi level alias with a condition
+probe alias2 if(4) {print(p)}
+
diff --git a/testsuite/systemtap.base/onoffprobe.exp b/testsuite/systemtap.base/onoffprobe.exp
new file mode 100644
index 00000000..41e107d7
--- /dev/null
+++ b/testsuite/systemtap.base/onoffprobe.exp
@@ -0,0 +1,57 @@
+set test "onoffprobe"
+if {![installtest_p]} { untested $test; return }
+
+spawn stap $srcdir/$subdir/$test.stp -m $test
+set pid $spawn_id
+set ok 0
+expect {
+ -timeout 240
+ "begin probed\r\n" {
+ if {$ok == 0} {
+ incr ok
+ pass "conditional begin probe"
+ exec echo 1 > /proc/systemtap/$test/switch
+ exec echo "dummy" > /dev/null
+ exp_continue;
+ }
+ }
+ "function return probed\r\n" {
+ if {$ok == 1} {
+ incr ok
+ pass "conditional dwarf probe (return)"
+ exec echo 2 > /proc/systemtap/$test/switch
+ exec echo "dummy" > /dev/null
+ exp_continue;
+ }
+ }
+ "function entry probed\r\n" {
+ if {$ok == 2} {
+ incr ok
+ pass "conditional dwarf probe (entry)"
+ exec echo 3 > /proc/systemtap/$test/switch
+ exp_continue;
+ }
+ }
+ "timer probed\r\n" {
+ if {$ok == 3} {
+ incr ok
+ pass "conditional timer probe"
+ exec echo 4 > /proc/systemtap/$test/switch
+ exp_continue;
+ }
+ }
+ "profile probed\r\n" {
+ if {$ok == 4} {
+ incr ok
+ pass "conditional profile probe"
+ }
+ }
+ timeout { fail "$test (timeout)" }
+ eof { }
+}
+send "\003"
+#FIXME does not handle case of hanging pfaults.stp correctly
+wait
+exec rm -f $test.ko
+if {$ok != 5} {fail "conditional probes ($ok)"}
+
diff --git a/testsuite/systemtap.base/onoffprobe.stp b/testsuite/systemtap.base/onoffprobe.stp
new file mode 100644
index 00000000..11968540
--- /dev/null
+++ b/testsuite/systemtap.base/onoffprobe.stp
@@ -0,0 +1,35 @@
+global switch=0
+
+#begin probe
+probe begin if (switch==0) {
+ log("begin probed\n");
+}
+
+#dwarf probe (return)
+probe kernel.function("sys_write").return if (switch == 1) {
+ log("function return probed\n")
+ switch = 0
+}
+
+#dwarf probe (entry)
+probe kernel.function("sys_write") if (switch == 2) {
+ log("function entry probed\n")
+ switch = 0
+}
+
+#timer probe
+probe timer.s(1) if (switch == 3) {
+ log("timer probed\n")
+ switch = 0
+}
+
+#profile probe
+probe timer.profile if (switch == 4) {
+ log("profile probed\n")
+ switch = 0
+}
+
+probe procfs("switch").write {
+ switch = strtol($value, 10)
+}
+
diff --git a/testsuite/systemtap.pass1-4/buildko.exp b/testsuite/systemtap.pass1-4/buildko.exp
index d82a18c3..a5560511 100644
--- a/testsuite/systemtap.pass1-4/buildko.exp
+++ b/testsuite/systemtap.pass1-4/buildko.exp
@@ -3,6 +3,11 @@ foreach file [lsort [glob -nocomplain $srcdir/$self/*.stp]] {
set test $self/[file tail $file]
verbose -log "Running $file"
set rc [stap_run_batch $file]
- setup_xfail *-*-*
- if {$rc == 0} { pass $test } else { fail $test }
+ if {$rc < 0} {
+ # crashed
+ fail $test
+ } else {
+ setup_xfail *-*-*
+ if {$rc == 0} { pass $test } else { fail $test }
+ }
}
diff --git a/testsuite/systemtap.pass1-4/parseko.exp b/testsuite/systemtap.pass1-4/parseko.exp
index e383a12e..658a2957 100644
--- a/testsuite/systemtap.pass1-4/parseko.exp
+++ b/testsuite/systemtap.pass1-4/parseko.exp
@@ -3,6 +3,11 @@ foreach file [lsort [glob -nocomplain $srcdir/$self/*.stp]] {
set test $self/[file tail $file]
verbose -log "Running $file"
set rc [stap_run_batch $file]
- setup_xfail *-*-*
- if {$rc == 0} { pass $test } else { fail $test }
+ if {$rc < 0} {
+ # crashed
+ fail $test
+ } else {
+ setup_xfail *-*-*
+ if {$rc == 0} { pass $test } else { fail $test }
+ }
}
diff --git a/testsuite/systemtap.pass1-4/semko.exp b/testsuite/systemtap.pass1-4/semko.exp
index aa53f324..dc9e261d 100644
--- a/testsuite/systemtap.pass1-4/semko.exp
+++ b/testsuite/systemtap.pass1-4/semko.exp
@@ -3,6 +3,11 @@ foreach file [lsort [glob -nocomplain $srcdir/$self/*.stp]] {
set test $self/[file tail $file]
verbose -log "Running $file"
set rc [stap_run_batch $file]
- setup_xfail *-*-*
- if {$rc == 0} { pass $test } else { fail $test }
+ if {$rc < 0} {
+ # crashed
+ fail $test
+ } else {
+ setup_xfail *-*-*
+ if {$rc == 0} { pass $test } else { fail $test }
+ }
}
diff --git a/testsuite/systemtap.pass1-4/transko.exp b/testsuite/systemtap.pass1-4/transko.exp
index e4b9b138..abda0286 100644
--- a/testsuite/systemtap.pass1-4/transko.exp
+++ b/testsuite/systemtap.pass1-4/transko.exp
@@ -3,6 +3,11 @@ foreach file [lsort [glob -nocomplain $srcdir/$self/*.stp]] {
set test $self/[file tail $file]
verbose -log "Running $file"
set rc [stap_run_batch $file]
- setup_xfail *-*-*
- if {$rc == 0} { pass $test } else { fail $test }
+ if {$rc < 0} {
+ # crashed
+ fail $test
+ } else {
+ setup_xfail *-*-*
+ if {$rc == 0} { pass $test } else { fail $test }
+ }
}