summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWenji Huang <wenji.huang@oracle.com>2010-01-28 14:16:43 +0800
committerWenji Huang <wenji.huang@oracle.com>2010-01-28 14:16:43 +0800
commit982b88bd950381434a8325e550eff9df59f59dcd (patch)
tree5aed232c2d90c962fa64b35830901e332ea31f2b
parent2addc662c2d3d29f6a6cd1fa6ef224b67fce21b8 (diff)
downloadsystemtap-steved-982b88bd950381434a8325e550eff9df59f59dcd.tar.gz
systemtap-steved-982b88bd950381434a8325e550eff9df59f59dcd.tar.xz
systemtap-steved-982b88bd950381434a8325e550eff9df59f59dcd.zip
PR6954: make ++/-- operation trigger automatic global printing
* staptree.cxx (varuse_collecting_visitor::visit_arrayindex): Regard operations as pure writes. * testsuite/systemtap.base/global_end.exp: Add test case. * testsuite/systemtap.base/global_end.stp: Ditto.
-rw-r--r--staptree.cxx14
-rw-r--r--testsuite/systemtap.base/global_end.exp3
-rw-r--r--testsuite/systemtap.base/global_end.stp4
3 files changed, 13 insertions, 8 deletions
diff --git a/staptree.cxx b/staptree.cxx
index 4c3b3090..7a335fc3 100644
--- a/staptree.cxx
+++ b/staptree.cxx
@@ -1897,19 +1897,21 @@ varuse_collecting_visitor::visit_arrayindex (arrayindex *e)
void
varuse_collecting_visitor::visit_pre_crement (pre_crement *e)
{
- expression* last_lrvalue = current_lrvalue;
- current_lrvalue = e->operand; // leave a mark for ::visit_symbol
+ // PR6954: regard as pure writes
+ expression* last_lvalue = current_lvalue;
+ current_lvalue = e->operand; // leave a mark for ::visit_symbol
functioncall_traversing_visitor::visit_pre_crement (e);
- current_lrvalue = last_lrvalue;
+ current_lvalue = last_lvalue;
}
void
varuse_collecting_visitor::visit_post_crement (post_crement *e)
{
- expression* last_lrvalue = current_lrvalue;
- current_lrvalue = e->operand; // leave a mark for ::visit_symbol
+ // PR6954: regard as pure writes
+ expression* last_lvalue = current_lvalue;
+ current_lvalue = e->operand; // leave a mark for ::visit_symbol
functioncall_traversing_visitor::visit_post_crement (e);
- current_lrvalue = last_lrvalue;
+ current_lvalue = last_lvalue;
}
void
diff --git a/testsuite/systemtap.base/global_end.exp b/testsuite/systemtap.base/global_end.exp
index d245212f..9d9c8d9b 100644
--- a/testsuite/systemtap.base/global_end.exp
+++ b/testsuite/systemtap.base/global_end.exp
@@ -19,6 +19,7 @@ expect {
-re {epsilon."one",1. @count=0x4 @min=0x1 @max=0x4 @sum=0xa @avg=0x2} { incr ok; exp_continue }
-re {epsilon."two",2. @count=0x4 @min=0xa @max=0x28 @sum=0x64 @avg=0x19} { incr ok; exp_continue }
-re {phi @count=0x4 @min=0x1 @max=0x4 @sum=0xa @avg=0x2} { incr ok; exp_continue }
+ -re {var=0x1} { incr ok; exp_continue }
timeout { fail "$test (timeout)" }
eof { }
}
@@ -32,4 +33,4 @@ expect {
-re {Avg time = [1-9]} { incr ok; exp_continue }
}
-if {$ok == 12} { pass "$test ($ok)" } { fail "$test ($ok)" }
+if {$ok == 13} { pass "$test ($ok)" } { fail "$test ($ok)" }
diff --git a/testsuite/systemtap.base/global_end.stp b/testsuite/systemtap.base/global_end.stp
index 4a5baff7..1f707d54 100644
--- a/testsuite/systemtap.base/global_end.stp
+++ b/testsuite/systemtap.base/global_end.stp
@@ -1,4 +1,4 @@
-global alpha, beta, gamma, iota, epsilon, phi
+global alpha, beta, gamma, iota, epsilon, phi, var
probe begin {
gamma = "abcdefghijklmnopqrstuvwxyz"
@@ -29,6 +29,8 @@ probe begin {
epsilon["two",2] <<< 20
epsilon["two",2] <<< 30
epsilon["two",2] <<< 40
+
+ var++
}
probe timer.ms(100) {