static void som_symfile_offsets (struct objfile *objfile, const struct section_addr_info *addrs) { int i; CORE_ADDR text_addr; asection *sect; objfile->num_sections = bfd_count_sections (objfile->obfd); objfile->section_offsets = (struct section_offsets *) obstack_alloc (&objfile->objfile_obstack, SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)); set_section_index (objfile, 0, SEC_ALLOC | SEC_CODE, &objfile->sect_index_text); set_section_index (objfile, 0, SEC_ALLOC | SEC_DATA, &objfile->sect_index_data); set_section_index (objfile, SEC_LOAD, SEC_ALLOC | SEC_LOAD, &objfile->sect_index_bss); set_section_index (objfile, 0, SEC_ALLOC | SEC_READONLY, &objfile->sect_index_rodata); /* First see if we're a shared library. If so, get the section offsets from the library, else get them from addrs. */ if (!som_solib_section_offsets (objfile, objfile->section_offsets)) { /* Note: Here is OK to compare with ".text" because this is the name that gdb itself gives to that section, not the SOM name. */ for (i = 0; i < addrs->num_sections; i++) if (strcmp (addrs->other[i].name, ".text") == 0) break; text_addr = addrs->other[i].addr; for (i = 0; i < objfile->num_sections; i++) (objfile->section_offsets)->offsets[i] = text_addr; } }
static void som_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs) { int i; CORE_ADDR text_addr; objfile->num_sections = bfd_count_sections (objfile->obfd); objfile->section_offsets = (struct section_offsets *) obstack_alloc (&objfile->objfile_obstack, SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)); /* FIXME: ezannoni 2000-04-20 The section names in SOM are not .text, .data, etc, but $TEXT$, $DATA$,... We should initialize SET_OFF_* from bfd. (See default_symfile_offsets()). But I don't know the correspondence between SOM sections and GDB's idea of section names. So for now we default to what is was before these changes.*/ objfile->sect_index_text = 0; objfile->sect_index_data = 1; objfile->sect_index_bss = 2; objfile->sect_index_rodata = 3; /* First see if we're a shared library. If so, get the section offsets from the library, else get them from addrs. */ if (!som_solib_section_offsets (objfile, objfile->section_offsets)) { /* Note: Here is OK to compare with ".text" because this is the name that gdb itself gives to that section, not the SOM name. */ for (i = 0; i < objfile->num_sections && addrs->other[i].name; i++) if (strcmp (addrs->other[i].name, ".text") == 0) break; text_addr = addrs->other[i].addr; for (i = 0; i < objfile->num_sections; i++) (objfile->section_offsets)->offsets[i] = text_addr; } }