summaryrefslogtreecommitdiffstats
path: root/tapsets.cxx
diff options
context:
space:
mode:
authorhiramatu <hiramatu>2007-11-20 21:03:16 +0000
committerhiramatu <hiramatu>2007-11-20 21:03:16 +0000
commitcbbe8080060563441ba79ed4645e9b533a870409 (patch)
treec40367e5311e9e80f0ad30a2edbc3362946193d8 /tapsets.cxx
parent57b1f4642f87f69b58705f2a7c2f92de1348b0cc (diff)
downloadsystemtap-steved-cbbe8080060563441ba79ed4645e9b533a870409.tar.gz
systemtap-steved-cbbe8080060563441ba79ed4645e9b533a870409.tar.xz
systemtap-steved-cbbe8080060563441ba79ed4645e9b533a870409.zip
2007-11-20 Masami Hiramatsu <mhiramat@redhat.com>
PR 4935. * parse.cxx (parser::parse_probe_point): Parse "if" condition following probe point. * staptree.h (probe_point): Add "condition" field. (probe): Add "condition" field and "add_condition" method. (deep_copy_visitor): Add "deep_copy" method for the expression. * staptree.cxx (probe_point::probe_point): Initalize it. (probe::add_condition): Implement it. (probe::print): Output "condition" field. (probe::str): Ditto. (deep_copy_visitor::deep_copy): Implement it. * elaborate.h (derived_probe): Add "insert_condition_statement" method. * elaborate.cxx (derived_probe::derived_probe): Initialize "condition" field, and insert a condition check routine on the top of body. (derived_probe::insert_condition_statement): Implement it. (alias_expansion_builder::build): Pass the condition from the alias referer to new alias. * tapsets.cxx (be_derived_probe): Remove unused constructor. (dwarf_derived_probe::dwarf_derived_probe): Insert a condition check routine on the top of body. (mark_derived_probe::mark_derived_probe): Ditto. (mark_builder::build): Pass the base location to mark_derived_probe.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r--tapsets.cxx17
1 files changed, 11 insertions, 6 deletions
diff --git a/tapsets.cxx b/tapsets.cxx
index 6a145715..3b992d4d 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -81,8 +81,6 @@ struct be_derived_probe: public derived_probe
be_t type;
int64_t priority;
- be_derived_probe (probe* p, be_t t, int64_t pr):
- derived_probe (p), type (t), priority (pr) {}
be_derived_probe (probe* p, probe_point* l, be_t t, int64_t pr):
derived_probe (p, l), type (t), priority (pr) {}
@@ -3720,6 +3718,9 @@ dwarf_derived_probe::dwarf_derived_probe(const string& funcname,
(TOK_MAXACTIVE, new literal_number(maxactive_val)));
locations.push_back(new probe_point(comps, q.base_loc->tok));
+ if (q.base_loc->condition)
+ add_condition (q.base_loc->condition);
+ insert_condition_statement ();
}
@@ -4943,7 +4944,7 @@ struct mark_derived_probe: public derived_probe
{
mark_derived_probe (systemtap_session &s,
const string& probe_name, const string& probe_sig,
- probe* base_probe);
+ probe* base_probe, expression* cond);
systemtap_session& sess;
string probe_name, probe_sig;
@@ -5076,7 +5077,7 @@ mark_var_expanding_copy_visitor::visit_target_symbol (target_symbol* e)
mark_derived_probe::mark_derived_probe (systemtap_session &s,
const string& p_n,
const string& p_s,
- probe* base):
+ probe* base, expression* cond):
derived_probe (base, 0), sess (s), probe_name (p_n), probe_sig (p_s),
target_symbol_seen (false)
{
@@ -5091,6 +5092,10 @@ mark_derived_probe::mark_derived_probe (systemtap_session &s,
pp->components.push_back (c);
this->locations.push_back (pp);
+ if (cond)
+ add_condition (cond);
+ insert_condition_statement ();
+
// expand the signature string
parse_probe_sig();
@@ -5436,7 +5441,7 @@ public:
void
mark_builder::build(systemtap_session & sess,
probe * base,
- probe_point *,
+ probe_point *loc,
std::map<std::string, literal *> const & parameters,
vector<derived_probe *> & finished_results)
{
@@ -5491,7 +5496,7 @@ mark_builder::build(systemtap_session & sess,
derived_probe *dp
= new mark_derived_probe (sess,
it->first, it->second,
- base);
+ base, loc->condition);
finished_results.push_back (dp);
}
}