Semantics of .gdb_index section

"Ali Tamur via gdb" <[email protected]> Fri, 20 Dec 2019 20:00:42 -0800
Newsgroups gmane.comp.gdb.devel,gmane.comp.gdb.general
Message-ID <CAH=Am=6f6U3HRfH0Mebb9aHrkd-ckOgYmTgEhpzpni6Eoz8FJQ@mail.gmail.com>
Hi,
I am trying to debug an elf binary with a .gdb_index section, where gdb
fails.
The .gdb_index section has overlapping address ranges pointing to different
compile units, such as:
[0x100, 0x400) ==> cu_A,
[0x200, 0x300) ==> cu_B.
It seems that the implementation assumes a single compile unit for a given
address. When the user tries
to print a backtrace from a core file, it analyzes the wrong compile unit,
cannot find the range, and
has a gdb_assert failure:

*dwarf2read.c*
static struct compunit_symtab *
dw2_find_pc_sect_compunit_symtab {
   ...
  data = ... addrmap_find ( ... ); // This returns a wrong result.
  ...
  gdb_assert (result != NULL);     // Fails here.
}
I am trying to understand whether this is a shortcoming of gdb, or
whether my .gdb_index section is hopelessly
corrupted. Can gdb_index address ranges contain such overlapping address
pairs?

Thank you,
Ali