diff options
author | fche <fche> | 2005-11-03 21:20:52 +0000 |
---|---|---|
committer | fche <fche> | 2005-11-03 21:20:52 +0000 |
commit | 703621ae2cb0bec9cc12786f33381dbb890b9251 (patch) | |
tree | 25fa3746c1d2c60071a784e75feaa1d6b037da25 /tapsets.cxx | |
parent | 3c9dd85f7066ec8fe086c83c40ec4d4f70fd2128 (diff) | |
download | systemtap-steved-703621ae2cb0bec9cc12786f33381dbb890b9251.tar.gz systemtap-steved-703621ae2cb0bec9cc12786f33381dbb890b9251.tar.xz systemtap-steved-703621ae2cb0bec9cc12786f33381dbb890b9251.zip |
2005-11-03 Frank Ch. Eigler <fche@elastic.org>
PR 1329.
* tapsets.cxx (dwarf_query::add_probe_point): Look up section name
containing given address. Skip request if it came from .init.*.
* testsuite/semko/thirtytwo.stp: New test.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r-- | tapsets.cxx | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tapsets.cxx b/tapsets.cxx index f9969434..ede2092f 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -1635,6 +1635,7 @@ target_variable_flavour_calculating_visitor::visit_target_symbol (target_symbol } } + void dwarf_query::add_probe_point(string const & funcname, char const * filename, @@ -1644,6 +1645,44 @@ dwarf_query::add_probe_point(string const & funcname, { dwarf_derived_probe *probe = NULL; + // Check whether the given address points into an .init section, + // which will have been unmapped by the kernel by the time we get to + // insert the probe. In this case, just ignore this call. + Dwarf_Addr baseaddr; + Elf* elf = dwfl_module_getelf (dw.module, & baseaddr); + Dwarf_Addr rel_addr = addr - baseaddr; + if (elf) + { + // Iterate through section headers to find which one + // contains the given rel_addr. + Elf_Scn* scn = 0; + size_t shstrndx; + dw.dwfl_assert ("getshstrndx", elf_getshstrndx (elf, &shstrndx)); + while (scn = elf_nextscn (elf, scn)) + { + GElf_Shdr shdr_mem; + GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); + if (! shdr) continue; // XXX error? + + // check for address inclusion + GElf_Addr start = shdr->sh_addr; + GElf_Addr end = start + shdr->sh_size; + if (! (rel_addr >= start && rel_addr < end)) + continue; + + // check for section name + const char* name = elf_strptr (elf, shstrndx, shdr->sh_name); + if (name && strncmp (name, ".init.", 6) == 0) + { + if (sess.verbose) + clog << "skipping function '" << funcname << "' base 0x" + << hex << addr << dec << " is within section '" + << name << "'" << endl; + return; + } + } + } + if (probe_has_no_target_variables) { assert(probe_flavours.size() == 1); |