[Bug uprobes/10273] uprobes fail to insert on prelinked library

mjw at redhat dot com sourceware-bugzilla@sourceware.org
Thu Jun 18 16:14:00 GMT 2009


------- Additional Comments From mjw at redhat dot com  2009-06-18 16:14 -------
So that was almost the correct fix.

The reason this adjustment is necessary is because the addresses we get are from
libdw so we do need to adjust for the bias returned from dwfl_getdwarf (). And
what we call module_bias is that bias.

To be correct we need to adjust before feeding the address to dwfl, which is
what this commit does:

commit d2309c6c3fb97cc0c8931b59e33fe18820b63c5d
Author: Mark Wielaard <mjw@redhat.com>
Date:   Thu Jun 18 17:54:15 2009 +0200

    PR10273 Correctly adjust libdw address for dwfl dwarf bias.
    
    * dwflpp.cxx (relocate_address): Adjust reloc_addr at start, not afterwards.

diff --git a/dwflpp.cxx b/dwflpp.cxx
index e01c697..61627e1 100644
--- a/dwflpp.cxx
+++ b/dwflpp.cxx
@@ -2341,11 +2341,13 @@ dwflpp::get_blacklist_section(Dwarf_Addr addr)
 
 
 Dwarf_Addr
-dwflpp::relocate_address(Dwarf_Addr addr,
+dwflpp::relocate_address(Dwarf_Addr dw_addr,
                          string& reloc_section,
                          string& blacklist_section)
 {
-  Dwarf_Addr reloc_addr = addr;
+  // PR10273
+  // libdw address, so adjust for bias gotten from dwfl_module_getdwarf
+  Dwarf_Addr reloc_addr = dw_addr + module_bias;
   if (!module)
     {
       assert(module_name == TOK_KERNEL);
@@ -2364,14 +2366,13 @@ dwflpp::relocate_address(Dwarf_Addr addr,
 
       if (reloc_section == "" && dwfl_module_relocations (module) == 1)
         {
-          blacklist_section = get_blacklist_section(addr);
+          blacklist_section = get_blacklist_section(dw_addr);
           reloc_section = ".dynamic";
-          reloc_addr += module_bias;  // PR10273
         }
     }
   else
     {
-      blacklist_section = get_blacklist_section(addr);
+      blacklist_section = get_blacklist_section(dw_addr);
       reloc_section = ".absolute";
     }
   return reloc_addr;


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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

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



More information about the Systemtap mailing list