diff options
author | Elena Zannoni <ezannoni@kwikemart.cygnus.com> | 2000-05-04 16:52:34 +0000 |
---|---|---|
committer | Elena Zannoni <ezannoni@kwikemart.cygnus.com> | 2000-05-04 16:52:34 +0000 |
commit | b8fbeb1874605f3dfe03e0b3ced670f6308b95f5 (patch) | |
tree | ba47cc4aeefd9f6fd6515a2a4f5fe296511d6bf3 /gdb/symfile.c | |
parent | 70d1b0e82047b6bb257d95311fce2689dae98074 (diff) | |
download | gdb-b8fbeb1874605f3dfe03e0b3ced670f6308b95f5.zip gdb-b8fbeb1874605f3dfe03e0b3ced670f6308b95f5.tar.gz gdb-b8fbeb1874605f3dfe03e0b3ced670f6308b95f5.tar.bz2 |
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Define as functions of OBJFILE. Add
sect_index_text, sect_index_data, sect_index_rodata,
sect_index_bss to objfile structure.
* gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS,
SECT_OFF_RODATA): Remove.
* objfiles.c (allocate_objfile): Initialize
sect_index_{text,data,bss,rodata} to -1, for error detection.
* symfile.c (default_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata} from bfd information.
* xcoffread.c (xcoff_symfile_offsets): Ditto.
* somread.c (som_symfile_offsets): Initialize
sect_index_{text,data,bss,rodata}.
* coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c,
hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c,
mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h,
remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c,
stabsread.c, symfile.c, xcoffread.c:
Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the
current objfile.
* xcoffread.c: Add new field objfile to find_targ_sec_arg.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r-- | gdb/symfile.c | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c index 108695a..b01fe33 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -518,33 +518,49 @@ default_symfile_offsets (objfile, addrs) struct section_addr_info *addrs; { int i; + asection *sect = NULL; 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); - /* Now calculate offsets for other sections. */ + /* Now calculate offsets for section that were specified by the + caller. */ for (i = 0; i < MAX_SECTIONS && addrs->other[i].name; i++) { struct other_sections *osp ; osp = &addrs->other[i] ; - if (addrs->other[i].addr == 0) + if (osp->addr == 0) continue; -#if 0 - if (strcmp (".text", osp->name) == 0) - SECT_OFF_TEXT = osp->sectindex ; - else if (strcmp (".data", osp->name) == 0) - SECT_OFF_DATA = osp->sectindex ; - else if (strcmp (".bss", osp->name) == 0) - SECT_OFF_BSS = osp->sectindex ; -#endif + /* Record all sections in offsets */ + /* The section_offsets in the objfile are here filled in using + the BFD index. */ ANOFFSET (objfile->section_offsets, osp->sectindex) = osp->addr; } -} + /* Remember the bfd indexes for the .text, .data, .bss and + .rodata sections. */ + + sect = bfd_get_section_by_name (objfile->obfd, ".text"); + if (sect) + objfile->sect_index_text = sect->index; + + sect = bfd_get_section_by_name (objfile->obfd, ".data"); + if (sect) + objfile->sect_index_data = sect->index; + + sect = bfd_get_section_by_name (objfile->obfd, ".bss"); + if (sect) + objfile->sect_index_bss = sect->index; + + sect = bfd_get_section_by_name (objfile->obfd, ".rodata"); + if (sect) + objfile->sect_index_rodata = sect->index; + +} /* Process a symbol file, as either the main file or as a dynamically loaded file. @@ -631,12 +647,12 @@ syms_from_objfile (objfile, addrs, mainline, verbo) if (lower_sect == NULL) warning ("no loadable sections found in added symbol-file %s", objfile->name); - else if ((bfd_get_section_flags (objfile->obfd, lower_sect) & SEC_CODE) - == 0) - warning ("Lowest section in %s is %s at %s", - objfile->name, - bfd_section_name (objfile->obfd, lower_sect), - paddr (bfd_section_vma (objfile->obfd, lower_sect))); + else + if ((bfd_get_section_flags (objfile->obfd, lower_sect) & SEC_CODE) == 0) + warning ("Lowest section in %s is %s at %s", + objfile->name, + bfd_section_name (objfile->obfd, lower_sect), + paddr (bfd_section_vma (objfile->obfd, lower_sect))); if (lower_sect != NULL) lower_offset = bfd_section_vma (objfile->obfd, lower_sect); else |