summaryrefslogtreecommitdiffstats
path: root/tapsets.cxx
diff options
context:
space:
mode:
authordsmith <dsmith>2008-01-17 20:44:34 +0000
committerdsmith <dsmith>2008-01-17 20:44:34 +0000
commitaf3047833424103c4e17728e849670da865d37c3 (patch)
treec39e234447fed3ca04c6467784fae5ddc85ce7d6 /tapsets.cxx
parentc326a713647c9d356b9cf9a4a3a8da8370fa7a87 (diff)
downloadsystemtap-steved-af3047833424103c4e17728e849670da865d37c3.tar.gz
systemtap-steved-af3047833424103c4e17728e849670da865d37c3.tar.xz
systemtap-steved-af3047833424103c4e17728e849670da865d37c3.zip
2008-01-17 David Smith <dsmith@redhat.com>
* tapsets.cxx (perfmon_var_expanding_copy_visitor::visit_target_symbol): Print an error when trying to use the perfmon target variable '$counter as an array or structure.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r--tapsets.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/tapsets.cxx b/tapsets.cxx
index 89819d6e..84187960 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -5882,6 +5882,25 @@ perfmon_var_expanding_copy_visitor::visit_target_symbol (target_symbol *e)
if (e->base_name != "$counter")
throw semantic_error ("target variables not available to perfmon probes");
+ if (e->components.size() > 0)
+ {
+ switch (e->components[0].first)
+ {
+ case target_symbol::comp_literal_array_index:
+ throw semantic_error("perfmon probe '$counter' variable may not be used as array",
+ e->tok);
+ break;
+ case target_symbol::comp_struct_member:
+ throw semantic_error("perfmon probe '$counter' variable may not be used as a structure",
+ e->tok);
+ break;
+ default:
+ throw semantic_error ("invalid use of perfmon probe '$counter' variable",
+ e->tok);
+ break;
+ }
+ }
+
ec->code = "THIS->__retvalue = _pfm_pmd_x[" +
lex_cast<string>(counter_number) + "].reg_num;";
ec->code += "/* pure */";