-/* Copyright (C) 2013 Free Software Foundation, Inc.
+/* Copyright (C) 2013-2014 Free Software Foundation, Inc.
This file is part of GDB.
solib_aix_relocate_section_addresses (struct so_list *so,
struct target_section *sec)
{
- bfd *abfd = sec->bfd;
struct bfd_section *bfd_sect = sec->the_bfd_section;
+ bfd *abfd = bfd_sect->owner;
const char *section_name = bfd_section_name (abfd, bfd_sect);
struct lm_info *info = so->lm_info;
int filename_len;
char *member_name;
bfd *archive_bfd, *object_bfd;
- struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
+ struct cleanup *cleanup;
if (pathname[path_len - 1] != ')')
return solib_bfd_open (pathname);
filename_len = sep - pathname;
filename = xstrprintf ("%.*s", filename_len, pathname);
- make_cleanup (xfree, filename);
+ cleanup = make_cleanup (xfree, filename);
member_name = xstrprintf ("%.*s", path_len - filename_len - 2, sep + 1);
make_cleanup (xfree, member_name);
return NULL;
}
+ /* Override the returned bfd's name with our synthetic name in order
+ to allow commands listing all shared libraries to display that
+ synthetic name. Otherwise, we would only be displaying the name
+ of the archive member object. */
+ xfree (bfd_get_filename (object_bfd));
+ object_bfd->filename = xstrdup (pathname);
+
gdb_bfd_unref (archive_bfd);
do_cleanups (cleanup);
return object_bfd;
if (data_osect == NULL)
error (_("unable to find TOC entry for pc %s "
"(%s has no data section)"),
- core_addr_to_string (pc), pc_osect->objfile->name);
+ core_addr_to_string (pc), objfile_name (pc_osect->objfile));
result = (obj_section_addr (data_osect)
+ xcoff_get_toc_offset (pc_osect->objfile));