summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfche <fche>2006-06-02 23:13:38 +0000
committerfche <fche>2006-06-02 23:13:38 +0000
commitcedd10f4eeda74861f6ee61a50241e05eb27b500 (patch)
tree6f77a80d855ea6a36c55ce5fadd7a5fa7bf37fc2
parentb6b2628a5b1c35e54c71fe200cc03d57cb72668e (diff)
downloadsystemtap-steved-cedd10f4eeda74861f6ee61a50241e05eb27b500.tar.gz
systemtap-steved-cedd10f4eeda74861f6ee61a50241e05eb27b500.tar.xz
systemtap-steved-cedd10f4eeda74861f6ee61a50241e05eb27b500.zip
2006-06-02 Frank Ch. Eigler <fche@elastic.org>
PR 2645 cont'd. * elaborate.cxx (find_and_build): Support optional wildcards too. (derive_probes): Change last argument to indicate optionalness of parent probe point (alias reference). (alias_expansion_builder): Shrink epilogue-mode alias body copying. Pass along alias reference optionality. * elaborate.h: Corresponding changes. * testsuite/semko/thirtyfive.stp, semok/twentytwo.stp: New tests.
-rw-r--r--ChangeLog11
-rw-r--r--elaborate.cxx59
-rw-r--r--elaborate.h2
-rwxr-xr-xtestsuite/semko/thirtyfive.stp4
-rwxr-xr-xtestsuite/semok/twentytwo.stp10
5 files changed, 54 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index 9bbb705a..37dae951 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2006-06-02 Frank Ch. Eigler <fche@elastic.org>
+
+ PR 2645 cont'd.
+ * elaborate.cxx (find_and_build): Support optional wildcards too.
+ (derive_probes): Change last argument to indicate optionalness of
+ parent probe point (alias reference).
+ (alias_expansion_builder): Shrink epilogue-mode alias body copying.
+ Pass along alias reference optionality.
+ * elaborate.h: Corresponding changes.
+ * testsuite/semko/thirtyfive.stp, semok/twentytwo.stp: New tests.
+
2006-06-02 Josh Stone <joshua.i.stone@intel.com>
* testsuite/buildok/process_test.stp: add signal_handle test
diff --git a/elaborate.cxx b/elaborate.cxx
index 73ac6591..e24d26ff 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -287,7 +287,7 @@ match_node::find_and_build (systemtap_session& s,
}
}
}
- if (num_results == results.size())
+ if (! loc->optional && num_results == results.size())
{
// We didn't find any wildcard matches (since the size of
// the result vector didn't change). Throw an error.
@@ -376,35 +376,28 @@ alias_expansion_builder
// there's concatenated code here and we only want one vardecl per
// resulting variable.
- if(alias->epilogue_style == true) {
- for (unsigned i = 0; i < use->body->statements.size(); ++i)
- {
- statement *s = deep_copy_visitor::deep_copy(use->body->statements[i]);
- n->body->statements.push_back(s);
- }
-
- for (unsigned i = 0; i < alias->body->statements.size(); ++i)
- {
- statement *s = deep_copy_visitor::deep_copy(alias->body->statements[i]);
- n->body->statements.push_back(s);
- }
-
- } else {
-
- for (unsigned i = 0; i < alias->body->statements.size(); ++i)
- {
- statement *s = deep_copy_visitor::deep_copy(alias->body->statements[i]);
- n->body->statements.push_back(s);
- }
-
- for (unsigned i = 0; i < use->body->statements.size(); ++i)
- {
- statement *s = deep_copy_visitor::deep_copy(use->body->statements[i]);
- n->body->statements.push_back(s);
- }
- }
+ if (alias->epilogue_style)
+ {
+ for (unsigned i = 0; i < use->body->statements.size(); ++i)
+ n->body->statements.push_back
+ (deep_copy_visitor::deep_copy(use->body->statements[i]));
- derive_probes (sess, n, finished_results, false);
+ for (unsigned i = 0; i < alias->body->statements.size(); ++i)
+ n->body->statements.push_back
+ (deep_copy_visitor::deep_copy(alias->body->statements[i]));
+ }
+ else
+ {
+ for (unsigned i = 0; i < alias->body->statements.size(); ++i)
+ n->body->statements.push_back
+ (deep_copy_visitor::deep_copy(alias->body->statements[i]));
+
+ for (unsigned i = 0; i < use->body->statements.size(); ++i)
+ n->body->statements.push_back
+ (deep_copy_visitor::deep_copy(use->body->statements[i]));
+ }
+
+ derive_probes (sess, n, finished_results, location->optional);
}
};
@@ -482,7 +475,7 @@ recursion_guard
void
derive_probes (systemtap_session& s,
probe *p, vector<derived_probe*>& dps,
- bool exc_outermost)
+ bool optional)
{
for (unsigned i = 0; i < p->locations.size(); ++i)
{
@@ -494,8 +487,12 @@ derive_probes (systemtap_session& s,
s.pattern_root->find_and_build (s, p, loc, 0, dps);
unsigned num_atend = dps.size();
- if (! loc->optional && num_atbegin == num_atend) // nothing new derived!
+ if (! optional && ! 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)
{
diff --git a/elaborate.h b/elaborate.h
index 689c35af..9a10283c 100644
--- a/elaborate.h
+++ b/elaborate.h
@@ -211,7 +211,7 @@ match_node
int semantic_pass (systemtap_session& s);
void derive_probes (systemtap_session& s,
probe *p, std::vector<derived_probe*>& dps,
- bool exc_outermost = true);
+ bool optional = false);
// A helper we use here and in translate, for pulling symbols out of lvalue
// expressions.
diff --git a/testsuite/semko/thirtyfive.stp b/testsuite/semko/thirtyfive.stp
new file mode 100755
index 00000000..e54898af
--- /dev/null
+++ b/testsuite/semko/thirtyfive.stp
@@ -0,0 +1,4 @@
+#! stap -p2
+
+probe foo.a = kernel.function("no_such_function")? { "alias a" }
+probe foo.* { }
diff --git a/testsuite/semok/twentytwo.stp b/testsuite/semok/twentytwo.stp
new file mode 100755
index 00000000..f8f44ffb
--- /dev/null
+++ b/testsuite/semok/twentytwo.stp
@@ -0,0 +1,10 @@
+#! stap -p2
+
+probe foo.a = kernel.function("no_such_function")?, never { "alias a" }
+probe foo.* { }
+
+probe baz.a = kernel.function("no_such_function") { "alias a" }
+probe baz.* ? { }
+
+probe bar = kernel.function("no_such_function") { "alias b" }
+probe bar ? { }