summaryrefslogtreecommitdiffstats
path: root/tapsets.cxx
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2009-05-14 19:07:10 +0200
committerMark Wielaard <mjw@redhat.com>2009-05-14 19:12:45 +0200
commit01a419e428f33d115a72fa8eac1d808825d2cae5 (patch)
tree6ee203741edf7f30dee6c8791edb0fb868a99c9b /tapsets.cxx
parent9af6145187da9e21a606f9737ddb4aa45ac6282d (diff)
downloadsystemtap-steved-01a419e428f33d115a72fa8eac1d808825d2cae5.tar.gz
systemtap-steved-01a419e428f33d115a72fa8eac1d808825d2cae5.tar.xz
systemtap-steved-01a419e428f33d115a72fa8eac1d808825d2cae5.zip
PR10139 Mark .probes section SHF_ALLOC.
* includes/sys/sdt.h (STAP_PROBE_DATA_): Mark .probes section SHF_ALLOC. * tapsets.cxx (dwarf_builder::build): Search in either dwarf or main elf file for .probes section.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r--tapsets.cxx18
1 files changed, 17 insertions, 1 deletions
diff --git a/tapsets.cxx b/tapsets.cxx
index 0e419e96..a027c083 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -5642,12 +5642,12 @@ dwarf_builder::build(systemtap_session & sess,
Elf_Scn *probe_scn = NULL;
dwfl_assert ("getshstrndx", elf_getshstrndx (elf, &shstrndx));
+ GElf_Shdr shdr_mem;
GElf_Shdr *shdr = NULL;
// Is there a .probes section?
while ((probe_scn = elf_nextscn (elf, probe_scn)))
{
- GElf_Shdr shdr_mem;
shdr = gelf_getshdr (probe_scn, &shdr_mem);
assert (shdr != NULL);
@@ -5658,6 +5658,22 @@ dwarf_builder::build(systemtap_session & sess,
}
}
+ // Older versions put .probes section in the debuginfo dwarf file,
+ // so check if it actually exists, if not take the main elf file
+ if (probe_type == probes_and_dwarf && shdr->sh_type == SHT_NOBITS)
+ {
+ elf = dwfl_module_getelf (dw->module, &bias);
+ dwfl_assert ("getshstrndx", elf_getshstrndx (elf, &shstrndx));
+ probe_scn = NULL;
+ while ((probe_scn = elf_nextscn (elf, probe_scn)))
+ {
+ shdr = gelf_getshdr (probe_scn, &shdr_mem);
+ if (strcmp (elf_strptr (elf, shstrndx, shdr->sh_name),
+ ".probes") == 0)
+ break;
+ }
+ }
+
// We got our .probes section, extract data.
if (probe_type == probes_and_dwarf)
{