Revert "Do not overwrite so_list's so_name in solib_map_sections"

This reverts commit 07293be448, as it
causes an unintended change of behavior with GDB/MI's =library-loaded
events: The host-name="<path>" part of the event is now showing the
target-side path instead of the host-side path.

This revert affects Darwin and AIX systems, however, where the BFD
is either artificial or icomplete, leading to the outputt of
"info shared" not containing the information we'd like. For instance,
on Darwin, we would see:

    (top-gdb) info shared
    From                To                  Syms Read   Shared Object Library
    0x00007fff8d060de4  0x00007fff8d09ce1f  Yes (*)     i386:x86-64
    0x00007fff8af08b10  0x00007fff8b1c6f73  Yes (*)     i386:x86-64

To compensate for that, we overwrite the filename of the associated bfd.

gdb/ChangeLog:

	Revert the following commit:
	* solib.c (solib_map_sections): Remove code overwriting
	SO->SO_NAME with the bfd's filename.

	Make the following changes required after the revert above:
	* solib-aix.c (solib_aix_bfd_open): Set the filename of the
	returned bfd to a copy of the synthetic pathname.
	* solib-darwin.c (darwin_bfd_open): Set the filename of the
	returned bfd to a copy of PATHNAME.
This commit is contained in:
Joel Brobecker 2013-12-13 18:21:37 +01:00
parent 07d100d43e
commit b030cf11d6
4 changed files with 43 additions and 0 deletions

View file

@ -724,6 +724,17 @@ solib_aix_bfd_open (char *pathname)
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. */
{
char *data = bfd_alloc (object_bfd, path_len + 1);
strcpy (data, pathname);
object_bfd->filename = data;
}
gdb_bfd_unref (archive_bfd);
do_cleanups (cleanup);
return object_bfd;