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 --- testsuite/systemtap.base/cast.stp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'testsuite/systemtap.base/cast.stp') diff --git a/testsuite/systemtap.base/cast.stp b/testsuite/systemtap.base/cast.stp index e2505000..bb889bb8 100644 --- a/testsuite/systemtap.base/cast.stp +++ b/testsuite/systemtap.base/cast.stp @@ -33,6 +33,15 @@ probe begin else printf("sa_data %d != %d\n", data, cast_data) + // Compare usage counter values through a struct address + usage = @cast(curr, "task_struct")->usage->counter + pusage = & @cast(curr, "task_struct")->usage + cast_usage = @cast(pusage, "atomic_t")->counter + if (usage == cast_usage) + println("usage OK") + else + printf("usage %d != %d\n", usage, cast_usage) + exit() } -- cgit