Bug 10305 - mark probes fail on prelinked shared library
Summary: mark probes fail on prelinked shared library
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: translator (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Mark Wielaard
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-22 10:43 UTC by Mark Wielaard
Modified: 2009-06-24 12:46 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2009-06-22 10:43:44 UTC
exelib.exp contains a test for putting user space mark probes on a shared
library (currently disabled) that fails.

Enable the prelink tests by adding yes (or replacing the no) in exelib.exp:
    foreach libprelink {no} { # BUG! "yes" breaks uname tests

$ /usr/local/systemtap/bin/stap -vv
/home/mark/src/systemtap/testsuite/systemtap.exelib/mark.stp
./uprobesgcc-O0default-debug-uprobeslibgcc-O0default-prelink-debug_exe
./libuprobeslibgcc-O0default-prelink-debug.so -c
./uprobesgcc-O0default-debug-uprobeslibgcc-O0default-prelink-debug_exe
SystemTap translator/driver (version 0.9.8/0.141 commit
release-0.9.8-85-g98a1242 + changes)
Copyright (C) 2005-2009 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
Session arch: x86_64 release: 2.6.29.4-167.fc11.x86_64
Created temporary directory "/tmp/stapZhqoLa"
Searched '/usr/local/systemtap/share/systemtap/tapset/x86_64/*.stp', found 3
Searched '/usr/local/systemtap/share/systemtap/tapset/*.stp', found 51
Pass 1: parsed user script and 54 library script(s) in 340usr/10sys/436real ms.
probe
main_func@/home/mark/src/systemtap/testsuite/systemtap.exelib/uprobes_exe.c:22
process=/home/mark/src/systemtap/testsuite/uprobesgcc-O0default-debug-uprobeslibgcc-O0default-prelink-debug_exe
reloc=.absolute section=.text pc=0x400600
semantic error: no match while resolving probe point
process("./libuprobeslibgcc-O0default-prelink-debug.so").statement(104859104)
Pass 2: analyzed script: 1 probe(s), 1 function(s), 0 embed(s), 0 global(s) in
10usr/10sys/7real ms.
Pass 2: analysis failed.  Try again with another '--vp 01' option.
Running rm -rf /tmp/stapZhqoLa

Note how the probe is set at 104859104 (0x64005E0). The library is (p)relinked
at 0x6400000 and the probe (nop) is indeed at 0x64005e0 <lib_func+20>.
Comment 1 Mark Wielaard 2009-06-22 18:46:53 UTC
I am testing a patch
Comment 2 Mark Wielaard 2009-06-24 12:46:07 UTC
commit 1f8592d1a615bef5bad1f255e761664e85d9e4f0
Author: Mark Wielaard <mjw@redhat.com>
Date:   Wed Jun 24 14:20:08 2009 +0200

    PR10305 Mark probes fail on prelinked shared library.
    
    Mark probes rely on literal statement addresses, these are based on the
    on-disk module address space. Introduce helper function to turn such
    addresses into symbol addresses as expected by libdwfl. Also properly
    adjust for dw bias when such addresses are used in dw queries.
    
    * dwflpp.h (dwflpp::literal_addr_to_sym_addr): New method.
    * dwflpp.cxx (query_cu_containing_address): Don't "globalize" address.
      (literal_addr_to_sym_addr): New method.
    * tapsets.cxx (query_module_dwarf): Turn literal addresses into symbol
      addresses.
      (query_dwarf_func): Likewise and adjust for dw module bias.