This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [patch] Fix uninitialized section index internal error
- To: Joel Brobecker <brobecker at act-europe dot fr>
- Subject: Re: [patch] Fix uninitialized section index internal error
- From: Elena Zannoni <ezannoni at cygnus dot com>
- Date: Thu, 28 Jun 2001 01:33:19 -0400
- Cc: Elena Zannoni <ezannoni at cygnus dot com>, gdb-patches at sources dot redhat dot com
- References: <20010510234031.A17108@act-europe.fr><15142.34631.889495.152234@kwikemart.cygnus.com><20010615084043.E10731@act-europe.fr>
Joel Brobecker writes:
> Hi Elena,
>
> thank you very much for reviewing this patch.
>
> > I see what's happening, your symbol is in section scSBss and not in scBss.
> > This macro in mdebugread.c:
> > SC_IS_BSS(sc) ((sc) == scBss || (sc) == scSBss)
> >
> > evaluates to true, so you get to execute:
> >
> > else if (SC_IS_BSS (ext_in->asym.sc))
> > {
> > ms_type = mst_bss;
> > svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
> >
> > or (a few lines below):
> >
> > else if (SC_IS_BSS (ext_in->asym.sc))
> > {
> > ms_type = mst_file_bss;
> > svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
> > }
> >
> >
> > The SECT_OFF_BSS then is -1. It shouldn't be used in this case,
> > because the symbol may not be in the bss section.
> >
> > That said, may I suggest a different approach? I think the bug is
> > really in mdebugread.c, not symfile.c. I think the SC_IS_BSS macro
> > should be split in 2 separate ones: a proper SC_IS_BSS and another
> > SC_IS_SBSS for your case. Then the above code would work ok, if you
> > don't have the .bss section, because it wouldn't trigger. As for the
> > SC_IS_SBSS case, you would have to figure out what the correct value
> > to be added to svalue needs to be, and for this you need to find the
> > index of the .sbss section.
>
> Ok, our patch was based on the assumption that the .bss and .sbss
> sections were mutually exclusive. Your approach is more solid.
>
> May I suggest then to go a little further with your approach, which
> cries out for the addition of a new sect_index_sbss in the objfile
> structure:
> - in struct objfile (objfiles.h), add a new section index called
> sect_index_sbss
> - still in objfiles.h, add a new SECT_OFF_SBSS macro
> - initialize the sbss section index in default_symfile_offset
> (symfile.c) at the same time we're initializing the indexes of
> the other common sections
> - in mdebugread.c, fix the SC_IS_BSS macro, add a new SC_IS_SBSS
> macro, and then update the parse_partial_symbols () procedure
> to use the .sbss section if the symbol is there
>
> If you agree with this approach, I'll then submit the new patch.
Joel,
Sorry, but we are trying to move away from having gdb knowing that
some sections are special. Adding a new SECT_OFF_SBSS macro, would not
be in line with that. Would you mind just doing that bit I suggested?
That would solve your immediate problem, right?
Thanks a bunch
Elena
>
> Thanks,
> --
> Joel
>