From a971b891bbdd51e2f1111a41ffff9dfd5e171ab4 Mon Sep 17 00:00:00 2001 From: fche Date: Mon, 5 Jun 2006 19:45:56 +0000 Subject: 2006-06-05 Frank Ch. Eigler 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. --- ChangeLog | 8 ++++++++ elaborate.cxx | 23 ++++++++++++++--------- stap.1.in | 2 +- stapprobes.5.in | 3 ++- testsuite/semok/twentytwo.stp | 11 ++++++++--- 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 + + 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 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 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