From 03c75a4a21ef3dba8abbc7e596d2a102427a3d96 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 15 Jul 2009 18:21:56 -0700 Subject: PR5930: Address-op for $target and @cast members This allows the '&' operator to get the address of @cast and $target variable expressions. * staptree.h (target_symbol): add addressof field * staptree.cxx (target_symbol::print): print '&' for addressof (cast_op::print): ditto * parse.cxx (parser::parse_value): allow '&' prefix on $target/@cast * dwflpp.cxx (dwflpp::translate_final_fetch_or_store): allow taking the computed address without actually doing a final fetch. * tapset* (*::visit_target_symbol): throw errors for $vars w/o addresses * testsuite/systemtap.base/cast.stp: add &@cast test * testsuite/semok/target_addr.stp: test '&' on different member types * testsuite/semko/target_addr?.stp: test failure on bitfields/registers --- staptree.cxx | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'staptree.cxx') diff --git a/staptree.cxx b/staptree.cxx index 8d251731..9e2ca8da 100644 --- a/staptree.cxx +++ b/staptree.cxx @@ -261,6 +261,8 @@ void symbol::print (ostream& o) const void target_symbol::print (std::ostream& o) const { + if (addressof) + o << "&"; o << base_name; for (unsigned i = 0; i < components.size(); ++i) { @@ -279,6 +281,8 @@ void target_symbol::print (std::ostream& o) const void cast_op::print (std::ostream& o) const { + if (addressof) + o << "&"; o << base_name << '(' << *operand; o << ", " << lex_cast_qstring (type); if (module.length() > 0) -- cgit