From 57b73400d06052b179335059c2f440350fd28c99 Mon Sep 17 00:00:00 2001 From: graydon Date: Thu, 20 Oct 2005 22:11:33 +0000 Subject: 2005-10-20 Graydon Hoare PR 917 (incomplete) * staptree.h (struct statistic_decl): New struct. (stapfile::stat_decls): New member. * parse.h, parse.cxx (parser::expect_known): Fix typo. (parser::expect_number): New method. (parser::parse_global): Parse global statistic_decls. * elaborate.h (systemtap_session::stat_decls): New member. * elaborate.cxx (semantic_pass_symbols): Copy per-file stat_decls to session-wide. (typeresolution_info::visit_assignment): Detect some semantic stats errors in type resolution pass. * translate.cxx (var::sd): New private member. (var::var): Initialize it. (var::sdecl): New accessor. (var::init): Handle stats values. (mapvar::mapvar): Pass through statistic_decl to var ctor. (mapvar::get): Test for long explicitly. (mapvar::set): Likewise. (mapvar::init): Handle stats values. (c_unparser::emit_common_header): Remove typedef of stats_t, include stat.c when necessary. (mapvar::key_typename): Typo. (c_unparser::emit_map_type_instantiations): Thinko: value_typename not key_typename. (c_unparser::c_typename): Implementation typename is "Stat", not "stats_t". (c_unparser::c_assign): Fix bad error message. (c_unparser_assignment::c_assignop): Handle operator <<<. (c_unparser::getvar): Feed session statistic_decl into var. (c_unparser::getmap): Likewise. (c_unparser::visit_assignment): Handle operator <<<. (c_tmpcounter_assignment::visit_symbol): Derive type from rvalue when present. (c_unparser_assignment::visit_symbol) (c_tmpcounter_assignment::visit_arrayindex) (c_unparser_assignment::load_map_indices): Likewise. (c_unparser::visit_arrayindex): Likewise, and Prohibit statistic rvalues. (c_unparser_assignment::visit_arrayindex): Handle operator <<<. * testsuite/semko/twentyfour.stp: * testsuite/semko/twentyfive.stp: * testsuite/semko/twentysix.stp: * testsuite/semko/twentyseven.stp: * testsuite/semko/twentyeight.stp: * testsuite/semko/twentynine.stp: * testsuite/semko/thirty.stp: * testsuite/semko/thirtyone.stp: New tests for prohibited statistic contexts. * testsuite/buildok/twentytwo.stp: New test for legal statistic contexts. --- testsuite/semko/thirty.stp | 11 +++++++++++ testsuite/semko/thirtyone.stp | 11 +++++++++++ testsuite/semko/twentyeight.stp | 12 ++++++++++++ testsuite/semko/twentyfive.stp | 12 ++++++++++++ testsuite/semko/twentyfour.stp | 12 ++++++++++++ testsuite/semko/twentynine.stp | 11 +++++++++++ testsuite/semko/twentyseven.stp | 17 +++++++++++++++++ testsuite/semko/twentysix.stp | 12 ++++++++++++ 8 files changed, 98 insertions(+) create mode 100755 testsuite/semko/thirty.stp create mode 100755 testsuite/semko/thirtyone.stp create mode 100755 testsuite/semko/twentyeight.stp create mode 100755 testsuite/semko/twentyfive.stp create mode 100755 testsuite/semko/twentyfour.stp create mode 100755 testsuite/semko/twentynine.stp create mode 100755 testsuite/semko/twentyseven.stp create mode 100755 testsuite/semko/twentysix.stp (limited to 'testsuite/semko') diff --git a/testsuite/semko/thirty.stp b/testsuite/semko/thirty.stp new file mode 100755 index 00000000..b8f0ab4b --- /dev/null +++ b/testsuite/semko/thirty.stp @@ -0,0 +1,11 @@ +#! stap -p2 + +# need one of these for each prohibited statistic operation + +global log_hist(x, 10) + +probe end +{ + x = 10 +} + diff --git a/testsuite/semko/thirtyone.stp b/testsuite/semko/thirtyone.stp new file mode 100755 index 00000000..4b6e98d5 --- /dev/null +++ b/testsuite/semko/thirtyone.stp @@ -0,0 +1,11 @@ +#! stap -p2 + +# need one of these for each prohibited statistic operation + +global log_hist(x, 10) + +probe end +{ + x[10] = 10 +} + diff --git a/testsuite/semko/twentyeight.stp b/testsuite/semko/twentyeight.stp new file mode 100755 index 00000000..68590f86 --- /dev/null +++ b/testsuite/semko/twentyeight.stp @@ -0,0 +1,12 @@ +#! stap -p2 + +# need one of these for each prohibited statistic operation + +global log_hist(x, 10) + +probe end +{ + x <<< 10 + x++ +} + diff --git a/testsuite/semko/twentyfive.stp b/testsuite/semko/twentyfive.stp new file mode 100755 index 00000000..7ac7e099 --- /dev/null +++ b/testsuite/semko/twentyfive.stp @@ -0,0 +1,12 @@ +#! stap -p2 + +# need one of these for each prohibited statistic operation + +global log_hist(x, 10), log_hist(y, 10) + + +probe end +{ + x = y[10] +} + diff --git a/testsuite/semko/twentyfour.stp b/testsuite/semko/twentyfour.stp new file mode 100755 index 00000000..81a69902 --- /dev/null +++ b/testsuite/semko/twentyfour.stp @@ -0,0 +1,12 @@ +#! stap -p2 + +# need one of these for each prohibited statistic operation + +global log_hist(x, 10), log_hist(y, 10) + + +probe end +{ + y = x +} + diff --git a/testsuite/semko/twentynine.stp b/testsuite/semko/twentynine.stp new file mode 100755 index 00000000..8cc2e2d5 --- /dev/null +++ b/testsuite/semko/twentynine.stp @@ -0,0 +1,11 @@ +#! stap -p2 + +# need one of these for each prohibited statistic operation + +global log_hist(x, 10) + +probe end +{ + x <<< 10 <<< 11 +} + diff --git a/testsuite/semko/twentyseven.stp b/testsuite/semko/twentyseven.stp new file mode 100755 index 00000000..a678bcd2 --- /dev/null +++ b/testsuite/semko/twentyseven.stp @@ -0,0 +1,17 @@ +#! stap -p2 + +# need one of these for each prohibited statistic operation + +global log_hist(x, 10) + +function foo(bar) +{ + bar <<< x +} + +probe end +{ + x <<< 10 + foo(x) +} + diff --git a/testsuite/semko/twentysix.stp b/testsuite/semko/twentysix.stp new file mode 100755 index 00000000..34d6d1d3 --- /dev/null +++ b/testsuite/semko/twentysix.stp @@ -0,0 +1,12 @@ +#! stap -p2 + +# need one of these for each prohibited statistic operation + +global log_hist(x, 10) + + +probe end +{ + x[10] = 10 +} + -- cgit