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/semok/target_addr.stp | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 testsuite/semok/target_addr.stp (limited to 'testsuite/semok') diff --git a/testsuite/semok/target_addr.stp b/testsuite/semok/target_addr.stp new file mode 100755 index 00000000..dfbc2606 --- /dev/null +++ b/testsuite/semok/target_addr.stp @@ -0,0 +1,11 @@ +#! stap -p2 + +// read the address of various task_struct members. +// all should roughly be $p + offsetof(foo) +probe kernel.function("release_task") { + println(& $p->state) // long + println(& $p->usage) // atomic_t + println(& $p->comm) // comm[TASK_COMM_LEN] + println(& $p->comm[1]) + println(& $p->parent) // task_struct* +} -- cgit