This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: Regression caused by elfread.c patch
- To: kingdon at redhat dot com (Jim Kingdon)
- Subject: Re: Regression caused by elfread.c patch
- From: Todd Whitesel <toddpw at windriver dot com>
- Date: Tue, 15 Feb 2000 00:00:09 -0800 (PST)
- Cc: akale at veritas dot com, kettenis at wins dot uva dot nl, gdb at sourceware dot cygnus dot com, gdb-patches at sourceware dot cygnus dot com
> I don't see how your patch could work at all - sym->section->index is
> a very different number than a SECT_OFF_* code. The SECT_OFF_* code
In case it interests anyone, I spent most of January figuring out how to teach
GDB how to let both cases coexist properly. It is my considered opinion that
the SECT_OFF_* machinery really only works when all the offsets are the same.
However, so few configurations (read: vxWorks and ??) actually use different
offsets for, say, SECT_OFF_TEXT and SECT_OFF_DATA, that no one notices the
problems with it. (We read relocatable .o files too, which is also rare.)
Our particular bug is as follows: for a.out, read-only data gets put into
.text, but the stabs generated are indistinguishable (or prohibitively hard
to distinguish, anyway) from a non-const version of the same item which gets
put into .data. Thus it is impossible to find the correct address without
using actual relocation records. (The same bug occurs on ELF although in
this case it is because .rodata is classed as a text section by our loader,
which then feeds us a single address for the group of text sections. sigh)
One of our consultants developed code for ELF/DWARF relocatables which
actually calls bfd_final_link_relocate to process reloc info, because in
the DWARF case we have even less information to tell things apart than with
stabs. I extended that to do full final address relocation and worked out
how to have struct section_offsets keep track of what is going on, so that
ANOFFSET can be replaced with a variety of different macros depending on
what usage is intended. (This also allowed optional asserts to be compiled
in, which turned out to be helpful once I started testing, and illuminated
a few cases too.)
A gutted tarball of 4.17+local sources is temporarily available (in an
execute-only directory) at:
ftp://ftp.toddpw.org/private/vxgdb.tar.bz2
--
Todd Whitesel
toddpw @ windriver.com