From b8fbeb1874605f3dfe03e0b3ced670f6308b95f5 Mon Sep 17 00:00:00 2001 From: Elena Zannoni Date: Thu, 4 May 2000 16:52:34 +0000 Subject: Elena Zannoni * 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. --- gdb/objfiles.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) (limited to 'gdb/objfiles.c') diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 41ec317..d307c2a 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -305,6 +305,14 @@ allocate_objfile (abfd, flags) } } + /* Initialize the section indexes for this objfile, so that we can + later detect if they are used w/o being properly assigned to. */ + + objfile->sect_index_text = -1; + objfile->sect_index_data = -1; + objfile->sect_index_bss = -1; + objfile->sect_index_rodata = -1; + /* Add this file onto the tail of the linked list of other such files. */ objfile->next = NULL; @@ -591,8 +599,8 @@ objfile_relocate (objfile, new_offsets) ALL_OBJFILE_PSYMTABS (objfile, p) { - p->textlow += ANOFFSET (delta, SECT_OFF_TEXT); - p->texthigh += ANOFFSET (delta, SECT_OFF_TEXT); + p->textlow += ANOFFSET (delta, SECT_OFF_TEXT (objfile)); + p->texthigh += ANOFFSET (delta, SECT_OFF_TEXT (objfile)); } } @@ -643,41 +651,41 @@ objfile_relocate (objfile, new_offsets) if (flags & SEC_CODE) { - s->addr += ANOFFSET (delta, SECT_OFF_TEXT); - s->endaddr += ANOFFSET (delta, SECT_OFF_TEXT); + s->addr += ANOFFSET (delta, SECT_OFF_TEXT (objfile)); + s->endaddr += ANOFFSET (delta, SECT_OFF_TEXT (objfile)); } else if (flags & (SEC_DATA | SEC_LOAD)) { - s->addr += ANOFFSET (delta, SECT_OFF_DATA); - s->endaddr += ANOFFSET (delta, SECT_OFF_DATA); + s->addr += ANOFFSET (delta, SECT_OFF_DATA (objfile)); + s->endaddr += ANOFFSET (delta, SECT_OFF_DATA (objfile)); } else if (flags & SEC_ALLOC) { - s->addr += ANOFFSET (delta, SECT_OFF_BSS); - s->endaddr += ANOFFSET (delta, SECT_OFF_BSS); + s->addr += ANOFFSET (delta, SECT_OFF_BSS (objfile)); + s->endaddr += ANOFFSET (delta, SECT_OFF_BSS (objfile)); } } } if (objfile->ei.entry_point != ~(CORE_ADDR) 0) - objfile->ei.entry_point += ANOFFSET (delta, SECT_OFF_TEXT); + objfile->ei.entry_point += ANOFFSET (delta, SECT_OFF_TEXT (objfile)); if (objfile->ei.entry_func_lowpc != INVALID_ENTRY_LOWPC) { - objfile->ei.entry_func_lowpc += ANOFFSET (delta, SECT_OFF_TEXT); - objfile->ei.entry_func_highpc += ANOFFSET (delta, SECT_OFF_TEXT); + objfile->ei.entry_func_lowpc += ANOFFSET (delta, SECT_OFF_TEXT (objfile)); + objfile->ei.entry_func_highpc += ANOFFSET (delta, SECT_OFF_TEXT (objfile)); } if (objfile->ei.entry_file_lowpc != INVALID_ENTRY_LOWPC) { - objfile->ei.entry_file_lowpc += ANOFFSET (delta, SECT_OFF_TEXT); - objfile->ei.entry_file_highpc += ANOFFSET (delta, SECT_OFF_TEXT); + objfile->ei.entry_file_lowpc += ANOFFSET (delta, SECT_OFF_TEXT (objfile)); + objfile->ei.entry_file_highpc += ANOFFSET (delta, SECT_OFF_TEXT (objfile)); } if (objfile->ei.main_func_lowpc != INVALID_ENTRY_LOWPC) { - objfile->ei.main_func_lowpc += ANOFFSET (delta, SECT_OFF_TEXT); - objfile->ei.main_func_highpc += ANOFFSET (delta, SECT_OFF_TEXT); + objfile->ei.main_func_lowpc += ANOFFSET (delta, SECT_OFF_TEXT (objfile)); + objfile->ei.main_func_highpc += ANOFFSET (delta, SECT_OFF_TEXT (objfile)); } /* Relocate breakpoints as necessary, after things are relocated. */ -- cgit v1.1