From ddfc759e7aac0c23571916e5e2ed6ec6778c5ab1 Mon Sep 17 00:00:00 2001 From: dsmith Date: Tue, 27 Nov 2007 21:07:46 +0000 Subject: 2007-11-27 David Smith PR 5377. * elaborate.cxx (match_node::find_and_build): Handle wildcards in probe points correctly. --- elaborate.cxx | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'elaborate.cxx') diff --git a/elaborate.cxx b/elaborate.cxx index c277d8d5..0ac0f4da 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -357,16 +357,35 @@ match_node::find_and_build (systemtap_session& s, if (match.globmatch(subkey)) { - // recurse + if (s.verbose > 2) + clog << "wildcard '" << loc->components[pos]->functor + << "' matched '" << subkey.name << "'" << endl; + + // When we have a wildcard, we need to create a copy of + // the probe point. Then we'll create a copy of the + // wildcard component, and substitute the non-wildcard + // functor. + probe_point *non_wildcard_pp = new probe_point(*loc); + probe_point::component *non_wildcard_component + = new probe_point::component(*loc->components[pos]); + non_wildcard_component->functor = subkey.name; + non_wildcard_pp->components[pos] = non_wildcard_component; + + // recurse (with the non-wildcard probe point) try { - subnode->find_and_build (s, p, loc, pos+1, results); + subnode->find_and_build (s, p, non_wildcard_pp, pos+1, + results); } catch (const semantic_error& e) { // Ignore semantic_errors while expanding wildcards. // If we get done and nothing was expanded, the code // following the loop will complain. + + // If this wildcard didn't match, cleanup. + delete non_wildcard_pp; + delete non_wildcard_component; } } } -- cgit