This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tapsets/10603] New: Probing *@srcfile:line yields strange results


The kernel function __put_unused_fd is static and only used in two places
(put_unused_fd and sys_close), so the compiler will inline it both times.  

Consider a function probe on it:

$ stap -l 'kernel.function("__put_unused_fd")' --vp 02
probe __put_unused_fd@fs/open.c:983 kernel reloc=.dynamic pc=0xffffffff810d34b1
probe __put_unused_fd@fs/open.c:983 kernel reloc=.dynamic pc=0xffffffff810d3643
kernel.function("__put_unused_fd@fs/open.c:983")
Pass 2: analyzed script: 2 probe(s), 0 function(s), 0 embed(s), 0 global(s) in
350usr/40sys/393real ms.
Running rm -rf /tmp/stap6ESYTD

Now consider a statement probe by its file:line number:

$ stap -l 'kernel.statement("*@fs/open.c:983")' --vp 02
probe sys_close@fs/open.c:985 kernel reloc=.dynamic pc=0xffffffff810d3643
probe __put_unused_fd@fs/open.c:983 kernel reloc=.dynamic pc=0xffffffff810d3643
kernel.statement("sys_close@fs/open.c:985")
kernel.statement("__put_unused_fd@fs/open.c:983")
Pass 2: analyzed script: 2 probe(s), 0 function(s), 0 embed(s), 0 global(s) in
140usr/40sys/191real ms.
Running rm -rf /tmp/stapc364ag

We get the call from sys_close twice, once for the inline instance and once for
the containing function.  We don't see the call from put_unused_fd at all.  The
one in the containing function also has the wrong scope/variables:

$ stap -e 'probe kernel.statement("*@fs/open.c:983") { println($$vars) }' -p2
--vp 01
# probes
kernel.statement("sys_close@fs/open.c:985") /* pc=_stext+0xca643 */ /* <-
kernel.statement("*@fs/open.c:983") */
println(sprint("fd=? filp=? files=? fdt=? retval=?"))
kernel.statement("__put_unused_fd@fs/open.c:983") /* pc=_stext+0xca643 */ /* <-
kernel.statement("*@fs/open.c:983") */
println(sprint("fd=? files=?"))
Pass 2: analyzed script: 2 probe(s), 0 function(s), 0 embed(s), 0 global(s) in
160usr/40sys/194real ms.

-- 
           Summary: Probing *@srcfile:line yields strange results
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tapsets
        AssignedTo: systemtap at sources dot redhat dot com
        ReportedBy: jistone at redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=10603

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]