diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rwxr-xr-x | testsuite/buildok/histogram_operator_in.stp | 32 | ||||
-rw-r--r-- | translate.cxx | 23 |
3 files changed, 58 insertions, 6 deletions
@@ -1,3 +1,12 @@ +2005-12-08 Graydon Hoare <graydon@redhat.com> + + * translate.cxx (delete_statement_operand_visitor::visit_arrayindex): + Prohibit deleting histogram buckets. + (c_tmpcounter::visit_array_in): Direct to visit_arrayindex. + (c_unparser::visit_array_in): Likewise. + + * testsuite/buildok/histogram_operator_in.stp: New test. + 2005-12-08 Frank Ch. Eigler <fche@elastic.org> PR 1937 diff --git a/testsuite/buildok/histogram_operator_in.stp b/testsuite/buildok/histogram_operator_in.stp new file mode 100755 index 00000000..2fd393a2 --- /dev/null +++ b/testsuite/buildok/histogram_operator_in.stp @@ -0,0 +1,32 @@ +#! stap -p4 + +global foo +global i + +probe begin +{ + print("starting up\n") + i = 0 +} + +probe timer.jiffies(100) +{ + printf("ping %d\n", i) + foo <<< i + if (i++ > 15) + exit() +} + +probe end +{ + print("shutting down\n") + printf("count %d, avg %d\n", @count(foo), @avg(foo)) + for (i = 0; i < 7; ++i) + { + if (i in @hist_log(foo)) + { + printf("entry in bucket %d\n", i); + } + } +} + diff --git a/translate.cxx b/translate.cxx index a4ca176d..f2a848f3 100644 --- a/translate.cxx +++ b/translate.cxx @@ -2082,8 +2082,7 @@ delete_statement_operand_visitor::visit_arrayindex (arrayindex* e) } else { - // FIXME: fill in some logic here! - assert(false); + throw semantic_error("cannot delete histogram bucket entries\n", e->tok); } } @@ -2282,8 +2281,14 @@ c_tmpcounter::visit_array_in (array_in* e) } else { - // FIXME: fill in some logic here! - assert(false); + // By definition: + // + // 'foo in @hist_op(...)' is true iff + // '@hist_op(...)[foo]' is nonzero + // + // so we just delegate to the latter call, since int64_t is also + // our boolean type. + e->operand->visit(this); } } @@ -2315,8 +2320,14 @@ c_unparser::visit_array_in (array_in* e) } else { - // FIXME: fill in some logic here! - assert(false); + // By definition: + // + // 'foo in @hist_op(...)' is true iff + // '@hist_op(...)[foo]' is nonzero + // + // so we just delegate to the latter call, since int64_t is also + // our boolean type. + e->operand->visit(this); } } |