]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb] Ignore .sframe section in dtrace_static_probe_ops::get_probes
authorTom de Vries <tdevries@suse.de>
Wed, 21 Jan 2026 15:43:07 +0000 (16:43 +0100)
committerTom de Vries <tdevries@suse.de>
Wed, 21 Jan 2026 15:43:07 +0000 (16:43 +0100)
On aarch64-linux (Debian testing), with test-case gdb.base/fission-macro.exp I
run into:
...
(gdb) set complaints 5^M
(gdb) file fission-macro-v4-b32-s0^M
Reading symbols from fission-macro-v4-b32-s0...^M
During symbol reading: \
  skipping section '.sframe' which does not contain valid DOF data.^M
(gdb) FAIL: $exp: lang=c: dwarf_version=4: dwarf_bits=32: strict_dwarf=0: \
  No complaints
...

The problem is that there's an overlap between:
...
./include/elf/common.h:#define SHT_SUNW_dof                 0x6ffffff4
...
and:
...
./include/elf/common.h:#define SHT_GNU_SFRAME      0x6ffffff4
...

So when dtrace_static_probe_ops::get_probes tries reading an SHT_SUNW_dof
section, it fails to read the corresponding magic number and bails with this
complaint:
...
During symbol reading: \
  skipping section '.sframe' which does not contain valid DOF data.^M
...

But the section actually being read is not an SHT_SUNW_dof section, but an
SHT_GNU_SFRAME section:
...
[Nr] Name      Type            Address          Off    Size   ES Flg Lk Inf Al
[17] .sframe   GNU_SFRAME      00000000000008f0 0008f0 000035 00   A  0   0  8
...

Fix this by checking for the section name .sframe in
dtrace_static_probe_ops::get_probes.

Tested on aarch64-linux.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33813

gdb/dtrace-probe.c

index ee9d0d4e5685ebdf2aa9c8c4eac3cfc6b6fc9494..b42afea5a173be48b13dd1fde0c47c5169c558c9 100644 (file)
@@ -841,7 +841,12 @@ dtrace_static_probe_ops::get_probes
      information.  */
   for (sect = abfd->sections; sect != NULL; sect = sect->next)
     {
-      if (elf_section_data (sect)->this_hdr.sh_type == SHT_SUNW_dof)
+      /* Both SHT_SUNW_dof and SHT_GNU_SFRAME are defined as 0x6ffffff4.
+        So for .sframe sections with sh_type == SHT_GNU_SFRAME, it also holds
+        that sh_type == SHT_SUNW_dof.  Therefore, in addition to the sh_type
+        check, we need to check for sections named .sframe.  */
+      if (elf_section_data (sect)->this_hdr.sh_type == SHT_SUNW_dof
+         && strcmp (bfd_section_name (sect), ".sframe") != 0)
        {
          bfd_byte *dof;