]> sourceware.org Git - systemtap.git/commitdiff
2008-02-19 Roland McGrath <roland@redhat.com>
authorroland <roland>
Wed, 20 Feb 2008 02:44:10 +0000 (02:44 +0000)
committerroland <roland>
Wed, 20 Feb 2008 02:44:10 +0000 (02:44 +0000)
* tapsets.cxx (query_module): Use dwfl_module_getdwarf rather
than dwfl_module_getelf for e_machine check.
(dwarf_query::get_blacklist_section): Likewise for section search.
Ignore non-SHF_ALLOC sections.

tapsets.cxx

index 52a75e59f490bf782002d6211f37619bcda4f2c6..2f24129cea90656538f641b01667a3583a162786 100644 (file)
@@ -2615,10 +2615,15 @@ dwarf_query::blacklisted_p(const string& funcname,
 
 string dwarf_query::get_blacklist_section(Dwarf_Addr addr)
 {
-       Dwarf_Addr baseaddr;
        string blacklist_section;
-       Elf* elf = dwfl_module_getelf (dw.module, & baseaddr);
-       Dwarf_Addr offset = addr - baseaddr;
+       Dwarf_Addr bias;
+       // We prefer dwfl_module_getdwarf to dwfl_module_getelf here,
+       // because dwfl_module_getelf can force costly section relocations
+       // we don't really need, while either will do for this purpose.
+       Elf* elf = (dwarf_getelf (dwfl_module_getdwarf (dw.module, &bias))
+                  ?: dwfl_module_getelf (dw.module, &bias));
+
+       Dwarf_Addr offset = addr - bias;
        if (elf)
         {
           Elf_Scn* scn = 0;
@@ -2630,6 +2635,9 @@ string dwarf_query::get_blacklist_section(Dwarf_Addr addr)
               GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
               if (! shdr) continue; // XXX error?
 
+             if (!(shdr->sh_flags & SHF_ALLOC))
+               continue;
+
               GElf_Addr start = shdr->sh_addr;
               GElf_Addr end = start + shdr->sh_size;
               if (! (offset >= start && offset < end))
This page took 0.029743 seconds and 5 git commands to generate.