summaryrefslogtreecommitdiffstats
path: root/tapsets.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'tapsets.cxx')
-rw-r--r--tapsets.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/tapsets.cxx b/tapsets.cxx
index d08e8633..5869a318 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -3012,6 +3012,8 @@ dwarf_var_expanding_copy_visitor::visit_target_symbol (target_symbol *e)
// _dwarf_tvar_{name}_{num}_ctr[_dwarf_tvar_tid]]
// delete _dwarf_tvar_{name}_{num}[_dwarf_tvar_tid,
// _dwarf_tvar_{name}_{num}_ctr[_dwarf_tvar_tid]--]
+ // if (! _dwarf_tvar_{name}_{num}_ctr[_dwarf_tvar_tid])
+ // delete _dwarf_tvar_{name}_{num}_ctr[_dwarf_tvar_tid]
// (2a) Synthesize the tid temporary expression, which will look
// like this:
@@ -3117,6 +3119,28 @@ dwarf_var_expanding_copy_visitor::visit_target_symbol (target_symbol *e)
add_block->statements.push_back (ds);
+ // (2d) Delete the counter value if it is 0. It will look like
+ // this:
+ // if (! _dwarf_tvar_{name}_{num}_ctr[_dwarf_tvar_tid])
+ // delete _dwarf_tvar_{name}_{num}_ctr[_dwarf_tvar_tid]
+
+ ds = new delete_statement;
+ ds->tok = e->tok;
+ ds->value = ai_ctr;
+
+ unary_expression *ue = new unary_expression;
+ ue->tok = e->tok;
+ ue->op = "!";
+ ue->operand = ai_ctr;
+
+ if_statement *ifs = new if_statement;
+ ifs->tok = e->tok;
+ ifs->condition = ue;
+ ifs->thenblock = ds;
+ ifs->elseblock = NULL;
+
+ add_block->statements.push_back (ifs);
+
// (3) We need an entry probe that saves the value for us in the
// global array we created. Create the entry probe, which will
// look like this: