Bug 10622 - unsuccessful location searches for extern $variables
Summary: unsuccessful location searches for extern $variables
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: translator (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-09 21:37 UTC by Frank Ch. Eigler
Modified: 2009-11-16 09:52 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:
Project(s) to access:
ssh public key:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Ch. Eigler 2009-09-09 21:37:52 UTC
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).
Comment 1 Mark Wielaard 2009-09-09 21:49:27 UTC
$ 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.
Comment 2 Wenji Huang 2009-11-12 06:39:05 UTC
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.
Comment 3 Mark Wielaard 2009-11-16 09:52:20 UTC
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.