summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS6
-rw-r--r--doc/langref.tex4
-rw-r--r--elaborate.cxx23
-rw-r--r--elaborate.h2
-rwxr-xr-xtestsuite/semok/thirtyfour.stp9
5 files changed, 32 insertions, 12 deletions
diff --git a/NEWS b/NEWS
index 2ce02736..f07acd9f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,11 @@
* What's new
+- It is now possible to define multiple probe aliases with the same name.
+ A probe will expand to all matching aliases.
+ probe foo = bar { }
+ probe foo = baz { }
+ probe foo { } # expands twice, once to bar and once to baz
+
- Support for unprivileged users:
*****************************************************************************
* WARNING!!!!!!!!!!
diff --git a/doc/langref.tex b/doc/langref.tex
index 35ff3312..3d08234d 100644
--- a/doc/langref.tex
+++ b/doc/langref.tex
@@ -379,8 +379,8 @@ probe <alias> += <probepoint> { <epilogue_stmts> }
New probe points may be defined using \emph{aliases}. A probe point alias
looks similar to probe definitions, but instead of activating a probe at
the given point, it defines a new probe point name as an alias to an existing
-one. New probe aliases may refer to one or more existing probe aliases. The
-following is an example.
+one. New probe aliases may refer to one or more existing probe aliases.
+Multiple aliases may share the same name. The following is an example.
\begin{vindent}
\begin{verbatim}
diff --git a/elaborate.cxx b/elaborate.cxx
index 1d7f7930..bf57f88f 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -261,7 +261,7 @@ match_key::globmatch(match_key const & other) const
// ------------------------------------------------------------------------
match_node::match_node()
- : end(NULL), unprivileged_ok (false)
+ : unprivileged_ok (false)
{
}
@@ -282,9 +282,7 @@ match_node::bind(match_key const & k)
void
match_node::bind(derived_probe_builder * e)
{
- if (end)
- throw semantic_error("duplicate probe point pattern");
- end = e;
+ ends.push_back (e);
}
match_node *
@@ -326,9 +324,7 @@ match_node::find_and_build (systemtap_session& s,
assert (pos <= loc->components.size());
if (pos == loc->components.size()) // matched all probe point components so far
{
- derived_probe_builder *b = end; // may be 0 if only nested names are bound
-
- if (! b)
+ if (ends.empty())
{
string alternatives;
for (sub_map_iterator_t i = sub.begin(); i != sub.end(); i++)
@@ -352,7 +348,12 @@ match_node::find_and_build (systemtap_session& s,
throw semantic_error (string("probe point is not allowed for unprivileged users"));
}
- b->build (s, p, loc, param_map, results);
+ // Iterate over all bound builders
+ for (unsigned k=0; k<ends.size(); k++)
+ {
+ derived_probe_builder *b = ends[k];
+ b->build (s, p, loc, param_map, results);
+ }
}
else if (isglob(loc->components[pos]->functor)) // wildcard?
{
@@ -449,7 +450,11 @@ match_node::build_no_more (systemtap_session& s)
{
for (sub_map_iterator_t i = sub.begin(); i != sub.end(); i++)
i->second->build_no_more (s);
- if (end) end->build_no_more (s);
+ for (unsigned k=0; k<ends.size(); k++)
+ {
+ derived_probe_builder *b = ends[k];
+ b->build_no_more (s);
+ }
}
diff --git a/elaborate.h b/elaborate.h
index 36439c4f..cd60b8bb 100644
--- a/elaborate.h
+++ b/elaborate.h
@@ -235,7 +235,7 @@ match_node
typedef std::map<match_key, match_node*> sub_map_t;
typedef std::map<match_key, match_node*>::iterator sub_map_iterator_t;
sub_map_t sub;
- derived_probe_builder* end;
+ std::vector<derived_probe_builder*> ends;
bool unprivileged_ok;
public:
diff --git a/testsuite/semok/thirtyfour.stp b/testsuite/semok/thirtyfour.stp
new file mode 100755
index 00000000..f6147529
--- /dev/null
+++ b/testsuite/semok/thirtyfour.stp
@@ -0,0 +1,9 @@
+#! stap -p2
+# PR10495
+
+probe foo = kernel.function("sys_open") { name = "a" }
+probe foo = kernel.function("sys_close") { name = "c" }
+probe foo.bar = kernel.function("sys_exit") { name = "nothing" }
+
+probe foo { log(name) }
+probe foo.* { log(name) }