This is the mail archive of the gdb@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

SECT_OFF_DATA problems



My recent changes to SECT_OFF_* to tranform those into macros that
call internal_error if index_sect_* is not initialized, seem to have
produced some regressions on a few targets. In particular I have
seen on this on solaris 2.8 and 2.6. What happens is that some of
the shared libraries (like for instance /usr/lib/libld.so.1 on
solaris2.8) have no .data section.  In default_symfile_offsets() gdb
initializes sect_index_data, sect_index_text, sect_index_bss,
sect_index_rodata, but if any of these sections in not found in the
objfile, the corresponding variable is left equal to -1. A subsequent
use of SECT_OFF_DATA (objfile), for instance, would detect this, and
call internal_error().  Before my changes, SECT_OFF_DATA would always
be equal to 1, no matter what the section with index 1 really
was. With the result that any symbols in that section got relocated by
the offset of section number 1, instead of the offset of their own
section. I don't understand how this could have worked, really.

So my question is, what should gdb do with the SECT_OFF_* in case the
corresponding section is not found? Should it try to get the index of
the section where the symbol lives? (this may not always be known
where SET_OFF_* is used). Should gdb initialize SECT_OFF to a random
section number hoping for the best (like it was doing before)?

[Right now the first place where the SECT_OFF_DATA macro is used is in
record_minimal_symbol_and_info(), in elfread.c. GDB classifies minimal
symbols into 3 classes: text, bss, data and uses the corresponding
offsets.]

Any ideas, opinions?


Elena

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]