diff options
author | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-04-22 20:42:37 +0000 |
---|---|---|
committer | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-04-22 20:42:37 +0000 |
commit | 4365c36c9b87e20565b20c52809c781c50831a18 (patch) | |
tree | fd18d65814126ec28fd97ac1212534fb7df2eeb4 /gdb/xcoffexec.c | |
parent | 87fe2d9df2930715c261130be8d41c5a1a41f7a7 (diff) | |
download | gdb-4365c36c9b87e20565b20c52809c781c50831a18.zip gdb-4365c36c9b87e20565b20c52809c781c50831a18.tar.gz gdb-4365c36c9b87e20565b20c52809c781c50831a18.tar.bz2 |
* objfiles.h (obj_section), objfiles.c (build_objfile_section_table):
Add objfile field.
* objfiles.c (find_pc_section): Return a struct obj_section *.
* sparc-tdep.c (in_solib_trampoline): Deal with find_pc_section return.
* symfile.c (syms_from_objfile) [IBM6000_TARGET]:
Don't use obj_section hack.
* xcoffexec (vmap_symtab): Relocate obj_sections.
* printcmd.c (containing_function_bounds): Use find_pc_section.
Diffstat (limited to 'gdb/xcoffexec.c')
-rw-r--r-- | gdb/xcoffexec.c | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/gdb/xcoffexec.c b/gdb/xcoffexec.c index c965488..cfc6a78 100644 --- a/gdb/xcoffexec.c +++ b/gdb/xcoffexec.c @@ -312,7 +312,9 @@ vmap_symtab (vp) asection *textsec; asection *datasec; asection *bsssec; - CORE_ADDR old_text_offset; + CORE_ADDR text_delta; + CORE_ADDR data_delta; + CORE_ADDR bss_delta; struct section_offsets *new_offsets; int i; @@ -335,18 +337,47 @@ vmap_symtab (vp) ANOFFSET (new_offsets, i) = ANOFFSET (objfile->section_offsets, i); textsec = bfd_get_section_by_name (vp->bfd, ".text"); - old_text_offset = ANOFFSET (objfile->section_offsets, textsec->target_index); + text_delta = + vp->tstart - ANOFFSET (objfile->section_offsets, textsec->target_index); ANOFFSET (new_offsets, textsec->target_index) = vp->tstart; + datasec = bfd_get_section_by_name (vp->bfd, ".data"); + data_delta = + vp->dstart - ANOFFSET (objfile->section_offsets, datasec->target_index); ANOFFSET (new_offsets, datasec->target_index) = vp->dstart; + bsssec = bfd_get_section_by_name (vp->bfd, ".bss"); + bss_delta = + vp->dstart - ANOFFSET (objfile->section_offsets, bsssec->target_index); ANOFFSET (new_offsets, bsssec->target_index) = vp->dstart; objfile_relocate (objfile, new_offsets); + + { + struct obj_section *s; + for (s = objfile->sections; s < objfile->sections_end; ++s) + { + if (s->sec_ptr->target_index == textsec->target_index) + { + s->addr += text_delta; + s->endaddr += text_delta; + } + else if (s->sec_ptr->target_index == datasec->target_index) + { + s->addr += data_delta; + s->endaddr += data_delta; + } + else if (s->sec_ptr->target_index == bsssec->target_index) + { + s->addr += bss_delta; + s->endaddr += bss_delta; + } + } + } - if (old_text_offset != ANOFFSET (new_offsets, textsec->target_index)) + if (text_delta != 0) /* breakpoints need to be relocated as well. */ - fixup_breakpoints (0, TEXT_SEGMENT_BASE, vp->tstart - old_text_offset); + fixup_breakpoints (0, TEXT_SEGMENT_BASE, text_delta); } /* Add symbols for an objfile. */ |