Re: [PATCH] [PR 25678] gdb crashes with "internal-error: sect_index_text not initialized" when .text

mlimber
2020-05-20T15:04:27Z

On Wed, May 20, 2020 at 10:12 AM Simon Marchi <simark@simark.ca> wrote:

> On 2020-05-20 9:24 a.m., mlimber wrote:
> > Will both bugs be fixed by a change in one place? That is, is my second
> patch irrelevant because we'll ultimately fix both bugs at some higher
> level? If the patch is still valid, I could work to submit an updated patch
> and test case for my non-DWARF bug now, and then you (or you and I) can
> work up a test case and fix -- possibly under a new bug ticket -- for the
> DWARF bug.
>
> There are two paths forward I see:
>
> (1) make sure sect_index_text is always initialized, even if there's no
> .text section
> (2) make GDB aware that sect_index_text could be left to -1
>
> If we chose (1), then the fixes in your patches wouldn't be needed, as
> sect_index_text will
> never be -1.
>
> If we chose (2), then we should get rid of the code that invents a
> sect_index_text value
> when there's no .text section. The fixes in your patches would be needed
> (or something
> equivalent), but there would be many other similar fixes needed.
>
> I posted this RFC patch that summarizes the problem and starts to
> implement (2):
>
> https://sourceware.org/pipermail/gdb-patches/2020-May/168767.html
>

Thanks for digging into this! I took a look. I'm still willing to assist if
needed, but you've gone beyond my knowledge of GDB and ELF internals, so
I'm not sure if I can be very useful to you. Let me know if there is
something further I can do.

M

PS, I'm surprised mailing list patches are still a thing in the age of
Github!