This is the mail archive of the gdb@sources.redhat.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]
Other format: [Raw text]

Re: max 64 sections??


Doug Evans writes:
 > I'm seeing an error in gdb where a symbol is being added to the
 > symbol table with a bogus address.
 > 
 > In debugging this, I found this in symfile.c:default_symfile_offsets
 > 
 >   objfile->num_sections = SECT_OFF_MAX;
 >   objfile->section_offsets = (struct section_offsets *)
 >     obstack_alloc (&objfile->psymbol_obstack, SIZEOF_SECTION_OFFSETS);
 >   memset (objfile->section_offsets, 0, SIZEOF_SECTION_OFFSETS);
 > 
 > The bogus address is coming from objfile->section_offsets->offsets[228].
 > SECT_OFF_MAX is only 64.
 > 
 > The elf file in question has _many_ sections.
 > 
 > So what's up?  Should objfile->section_offsets have been allocated
 > with slots for the same number of sections as in the objfile?
 > 

Doug, 
Yes, you are not hallucinating. This is a long standing problem.
Feel free to enter a bug report in the gnat database.

Elena


 > Or is this line in elfread.c:elf_symtab_read  wrong?
 > 
 >           offset = ANOFFSET (objfile->section_offsets, sym->section->index);
 > 
 > Here's where the bogus address gets computed, later in elf_symtab_read:
 > 
 > 	      /* Relocate all non-absolute symbols by the section offset.  */
 > 	      if (sym->section != &bfd_abs_section)
 > 		{
 > 		  symaddr += offset;
 > 		}
 > 
 > Or have I overlooked something?


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