summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--elaborate.cxx23
-rw-r--r--stap.1.in2
-rw-r--r--stapprobes.5.in3
-rwxr-xr-xtestsuite/semok/twentytwo.stp11
5 files changed, 33 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 37dae951..f35abe25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-06-05 Frank Ch. Eigler <fche@elastic.org>
+
+ PR 2645 cont'd.
+ * elaborate.cxx (derive_probes): Pass down optional flag
+ from alias reference to expansion.
+ * testsuite/semok/twentytwo.stp: Test passing-down.
+ * stapprobes.5.in: Specify passing-down property of optional flag.
+
2006-06-02 Frank Ch. Eigler <fche@elastic.org>
PR 2645 cont'd.
diff --git a/elaborate.cxx b/elaborate.cxx
index e24d26ff..b6d0f226 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -480,28 +480,33 @@ derive_probes (systemtap_session& s,
for (unsigned i = 0; i < p->locations.size(); ++i)
{
probe_point *loc = p->locations[i];
-
+
+ // Pass down optional flag from e.g. alias reference to each
+ // probe_point instance. We do this by temporarily overriding
+ // the probe_point optional flag. We could instead deep-copy
+ // and set a flag on the copy permanently.
+
+ bool old_loc_opt = loc->optional;
+ loc->optional = loc->optional || optional;
+
try
{
unsigned num_atbegin = dps.size();
s.pattern_root->find_and_build (s, p, loc, 0, dps);
unsigned num_atend = dps.size();
- if (! optional && ! loc->optional && // something required, but
+ if (! loc->optional && // something required, but
num_atbegin == num_atend) // nothing new derived!
throw semantic_error ("no match for probe point");
-
- // XXX: perhaps "optional" should operate at the outside
- // loop (probe) level.
}
catch (const semantic_error& e)
{
// XXX: prefer not to print_error at every nest/unroll level
s.print_error (e);
cerr << "while: resolving probe point " << *loc << endl;
- // if (! exc_outermost)
- // throw;
}
+
+ loc->optional = old_loc_opt;
}
}
@@ -869,8 +874,8 @@ semantic_pass_symbols (systemtap_session& s)
probe* p = dome->probes [i];
vector<derived_probe*> dps;
- // much magic happens here: probe alias expansion,
- // provider identification
+ // much magic happens here: probe alias expansion, wildcard
+ // matching, low-level derived_probe construction.
derive_probes (s, p, dps);
for (unsigned j=0; j<dps.size(); j++)
diff --git a/stap.1.in b/stap.1.in
index 3149a4f0..c805f54d 100644
--- a/stap.1.in
+++ b/stap.1.in
@@ -410,7 +410,7 @@ at the given point, it just defines a new probe point name as an alias
to an existing one. There are two types of alias, i.e. the prologue
style and the epilogue style which are identified by "=" and "+="
respectively.
-
+.PP
For prologue style alias, the statement block that follows an alias
definition is implicitly added as a prologue to any probe that refers
to the alias. While for the epilogue style alias, the statement block
diff --git a/stapprobes.5.in b/stapprobes.5.in
index f1744d2f..0685ba2d 100644
--- a/stapprobes.5.in
+++ b/stapprobes.5.in
@@ -28,7 +28,8 @@ identifier may be parametrized by a string or number literal, with a
syntax like a function call. A component may include a "*"
character, to expand to other matching probe points. A probe point
may be followed by a "?" character, to indicate that it is optional,
-and that no error should result if it fails to expand.
+and that no error should result if it fails to expand. Optionalness
+passes down through all levels of alias/wildcard expansion.
These are all syntactically valid probe points:
.SAMPLE
diff --git a/testsuite/semok/twentytwo.stp b/testsuite/semok/twentytwo.stp
index f8f44ffb..b5fcb3a0 100755
--- a/testsuite/semok/twentytwo.stp
+++ b/testsuite/semok/twentytwo.stp
@@ -1,10 +1,15 @@
#! stap -p2
-probe foo.a = kernel.function("no_such_function")?, never { "alias a" }
+probe foo.a = kernel.function("no_such_function")?, never { }
probe foo.* { }
-probe baz.a = kernel.function("no_such_function") { "alias a" }
+probe baz.a = kernel.function("no_such_function") { }
probe baz.* ? { }
-probe bar = kernel.function("no_such_function") { "alias b" }
+probe bar = kernel.function("no_such_function") { }
probe bar ? { }
+
+probe bar3 = kernel.function("no_such_function") { }
+probe bar2 = bar3 { }
+probe bar2 ? { }
+