This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: PATCH: read stabs from files with no .data section
- From: Jim Blandy <jimb at redhat dot com>
- To: Andrew Cagney <ac131313 at redhat dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: 09 Sep 2003 12:45:34 -0500
- Subject: Re: PATCH: read stabs from files with no .data section
- References: <vt2brtvytbz.fsf@zenia.home> <3F5D4961.4010407@redhat.com>
Andrew Cagney <ac131313@redhat.com> writes:
> > + /* If the objfile has no .data section, try using the .bss section. */
> > + data_sect_index = objfile->sect_index_data;
> > + if (data_sect_index == -1)
> > + data_sect_index = SECT_OFF_BSS (objfile);
> > + gdb_assert (data_sect_index != -1);
> > +
>
> So what happens if there is no .data and no .bss?
We lose. Maybe this should fall through the .rodata, and then .text
section offsets, but I think it's still papering over the real
problem, which I don't know how to solve.
I think the correct behavior is to use the offset of the section
containing the variable. Many of the old references to
ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile))
that this patch changes were wrong, for this reason.
But to do the right thing, we'd need to look up the section by the
variable's unrelocated address, as with find_pc_section. This would
be needed for every top-level variable, static and global, in the
speed-critical partial symtab construction pass. I'm not sure that
kind of overhead would be welcome.
I'm certainly open to suggestions.