X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fobjfiles.c;h=5cd01e5210e2223897d95c71882f0a079c5be7ac;hb=9de0904cce9f2bd32549eade2917c1d2b7256e14;hp=530e19b054b58a85a49e81eb25425fbac813221d;hpb=38b90473602f5c7295242ec0cce8f804d171bcbf;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 530e19b054..5cd01e5210 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -123,6 +123,7 @@ allocate_objfile (abfd, mapped) int mapped; { struct objfile *objfile = NULL; + struct objfile *last_one = NULL; mapped |= mapped_symbol_files; @@ -257,11 +258,18 @@ allocate_objfile (abfd, mapped) objfile -> name, bfd_errmsg (bfd_get_error ())); } - /* Push this file onto the head of the linked list of other such files. */ - - objfile -> next = object_files; - object_files = objfile; + /* Add this file onto the tail of the linked list of other such files. */ + objfile -> next = NULL; + if (object_files == NULL) + object_files = objfile; + else + { + for (last_one = object_files; + last_one -> next; + last_one = last_one -> next); + last_one -> next = objfile; + } return (objfile); } @@ -333,7 +341,9 @@ free_objfile (objfile) if (objfile -> obfd != NULL) { char *name = bfd_get_filename (objfile->obfd); - bfd_close (objfile -> obfd); + if (!bfd_close (objfile -> obfd)) + warning ("cannot close \"%s\": %s", + name, bfd_errmsg (bfd_get_error ())); free (name); } @@ -578,6 +588,27 @@ objfile_relocate (objfile, new_offsets) } } } + + if (objfile->ei.entry_point != ~0) + objfile->ei.entry_point += ANOFFSET (delta, SECT_OFF_TEXT); + + 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); + } + + 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); + } + + 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); + } } /* Many places in gdb want to test just to see if we have any partial