summaryrefslogtreecommitdiffstats
path: root/tapsets.cxx
diff options
context:
space:
mode:
authorroland <roland>2008-02-20 02:44:10 +0000
committerroland <roland>2008-02-20 02:44:10 +0000
commitf9331b2988dce35aa72bd92fa69ecda45066211b (patch)
treeda835052cd82e7946351442d7e138107e7e31d2e /tapsets.cxx
parentd05bd7b9982fbc6aedd1fff1cd0d9ab1fcda5fc2 (diff)
downloadsystemtap-steved-f9331b2988dce35aa72bd92fa69ecda45066211b.tar.gz
systemtap-steved-f9331b2988dce35aa72bd92fa69ecda45066211b.tar.xz
systemtap-steved-f9331b2988dce35aa72bd92fa69ecda45066211b.zip
2008-02-19 Roland McGrath <roland@redhat.com>
* 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.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r--tapsets.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/tapsets.cxx b/tapsets.cxx
index 52a75e59..2f24129c 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))