summaryrefslogtreecommitdiffstats
path: root/elaborate.cxx
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2007-11-20 22:06:20 -0500
committerFrank Ch. Eigler <fche@elastic.org>2007-11-20 22:06:20 -0500
commit8fe15c1c1fcad3cf69c99f6eed18fddce2ace3cd (patch)
treec40367e5311e9e80f0ad30a2edbc3362946193d8 /elaborate.cxx
parentefa777288a9297c3842a9fe1ad9fbdc7ffe69311 (diff)
parentcbbe8080060563441ba79ed4645e9b533a870409 (diff)
downloadsystemtap-steved-8fe15c1c1fcad3cf69c99f6eed18fddce2ace3cd.tar.gz
systemtap-steved-8fe15c1c1fcad3cf69c99f6eed18fddce2ace3cd.tar.xz
systemtap-steved-8fe15c1c1fcad3cf69c99f6eed18fddce2ace3cd.zip
Merge branch 'master' of git://sources.redhat.com/git/systemtap
Diffstat (limited to 'elaborate.cxx')
-rw-r--r--elaborate.cxx35
1 files changed, 31 insertions, 4 deletions
diff --git a/elaborate.cxx b/elaborate.cxx
index aa6529fa..d3bbe28d 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -39,7 +39,8 @@ derived_probe::derived_probe (probe *p):
{
if (p)
{
- this->locations = p->locations;
+ this->locations = p->locations;
+ this->condition = deep_copy_visitor::deep_copy(p->condition);
this->tok = p->tok;
this->privileged = p->privileged;
this->body = deep_copy_visitor::deep_copy(p->body);
@@ -50,17 +51,41 @@ derived_probe::derived_probe (probe *p):
derived_probe::derived_probe (probe *p, probe_point *l):
base (p)
{
- if (l)
- this->locations.push_back (l);
-
if (p)
{
+ this->condition = deep_copy_visitor::deep_copy(p->condition);
this->tok = p->tok;
this->privileged = p->privileged;
this->body = deep_copy_visitor::deep_copy(p->body);
}
+
+ if (l)
+ {
+ probe_point *pp = new probe_point (l->components, l->tok);
+ this->locations.push_back (pp);
+ this->add_condition (l->condition);
+ this->insert_condition_statement ();
+ }
}
+void
+derived_probe::insert_condition_statement (void)
+{
+ if (this->condition)
+ {
+ if_statement *ifs = new if_statement ();
+ ifs->tok = this->tok;
+ ifs->thenblock = new next_statement ();
+ ifs->thenblock->tok = this->tok;
+ ifs->elseblock = NULL;
+ unary_expression *notex = new unary_expression ();
+ notex->op = "!";
+ notex->tok = this->tok;
+ notex->operand = this->condition;
+ ifs->condition = notex;
+ body->statements.insert (body->statements.begin(), ifs);
+ }
+}
void
derived_probe::printsig (ostream& o) const
@@ -435,6 +460,8 @@ alias_expansion_builder
// the token location of the alias,
n->tok = location->tok;
n->body->tok = location->tok;
+ // The new probe takes over condition.
+ n->add_condition (location->condition);
// and statements representing the concatenation of the alias'
// body with the use's.