stap -e 'probe kernel.function("do_gettimeofday") { println($xtime) }' gives ... failed to retrieve location attribute for local 'xtime'. whereas that die describes itself as "external", and has a friend declaration that might have the needed location list (a symbol address).
$ stap -e 'probe kernel.function("do_gettimeofday") { printf("xtime.tv_sec: %d\n", $xtime->tv_sec); }' semantic error: failed to retrieve location attribute for local 'xtime' (dieoffset: 0x752637): identifier '$xtime' at <input>:1:73 source: probe kernel.function("do_gettimeofday") { printf("xtime.tv_sec: %d\n", $xtime->tv_sec); } ^ Pass 2: analysis failed. Try again with another '--vp 01' option. $ eu-readelf -N --debug-dump=info /usr/lib/debug/lib/modules/2.6.30.5-43.fc11.i586/vmlinux [752637] variable name "xtime" decl_file 3 decl_line 100 type [74c7b3] external declaration So no location description in this CU. We need to look it up in the symbol table.
Guess it's related to gcc or fedora debuginfo. On RHEL5 with self-built 2.6.32-rc6 kernel. The latest stap works fine both with elfutils 0.141 and 0.142. $ stap -e 'probe kernel.function("do_gettimeofday") { println($xtime) }' semantic error: 'struct timespec' is being accessed instead of a member: identifier '$xtime' at <input>:1:52 source: probe kernel.function("do_gettimeofday") { println($xtime) } ^ Pass 2: analysis failed. Try again with another '--vp 01' option. Got different message, but seems stap can get location attribute. $ stap -e 'probe kernel.function("do_gettimeofday") { printf("xtime.tv_sec:%d\n", $xtime->tv_sec); exit() }' xtime.tv_sec:1257921482 But failed on FC11, gcc 4.4. The error message like previous comment, also as comment #11 of bug # 9738.
commit 228af5c49c06079e6bfe1daa64ead51b1dc979c7 Author: Mark Wielaard <mjw@redhat.com> Date: Mon Nov 16 10:02:50 2009 +0100 PR10622 Search for extern $variables in symbol table. * dwflpp.h (vardie_from_symtable): New method. * dwflpp.cxx (vardie_from_symtable): New method. (literal_stmt_for_local): Use vardie_from_symtable when no location attribute and DW_AT_external. * testsuite/buildok/xtime.stp: New testcase from PR10622.