aboutsummaryrefslogtreecommitdiff
path: root/gdb/objfiles.c
diff options
context:
space:
mode:
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>2000-05-04 16:52:34 +0000
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>2000-05-04 16:52:34 +0000
commitb8fbeb1874605f3dfe03e0b3ced670f6308b95f5 (patch)
treeba47cc4aeefd9f6fd6515a2a4f5fe296511d6bf3 /gdb/objfiles.c
parent70d1b0e82047b6bb257d95311fce2689dae98074 (diff)
downloadgdb-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/objfiles.c')
-rw-r--r--gdb/objfiles.c38
1 files changed, 23 insertions, 15 deletions
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. */