From: roland Date: Wed, 20 Feb 2008 02:44:10 +0000 (+0000) Subject: 2008-02-19 Roland McGrath X-Git-Tag: release-0.6.2~45 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=f9331b2988dce35aa72bd92fa69ecda45066211b;p=systemtap.git 2008-02-19 Roland McGrath * 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. --- diff --git a/tapsets.cxx b/tapsets.cxx index 52a75e59f..2f24129ce 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -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))