Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/gpl3/gdb/dist/gdb When debugging 32 bit binaries on...
details: https://anonhg.NetBSD.org/src/rev/479ce032d7c0
branches: trunk
changeset: 334903:479ce032d7c0
user: christos <christos%NetBSD.org@localhost>
date: Sun Dec 14 19:58:06 2014 +0000
description:
When debugging 32 bit binaries on a 64 bit arch in NetBSD the dynamic
linker magically converts the dynamic linker name to ld.elf_so-<32bitarch>
like ld.elf_so-i386. We do the same magic here.
diffstat:
external/gpl3/gdb/dist/gdb/solib.c | 41 +++++++++++++++++++++++++++++++------
1 files changed, 34 insertions(+), 7 deletions(-)
diffs (65 lines):
diff -r aacefa0de229 -r 479ce032d7c0 external/gpl3/gdb/dist/gdb/solib.c
--- a/external/gpl3/gdb/dist/gdb/solib.c Sun Dec 14 18:14:15 2014 +0000
+++ b/external/gpl3/gdb/dist/gdb/solib.c Sun Dec 14 19:58:06 2014 +0000
@@ -413,13 +413,12 @@
/* Find shared library PATHNAME and open a BFD for it. */
-bfd *
-solib_bfd_open (char *pathname)
+static bfd *
+solib_bfd_open1 (char *pathname)
{
char *found_pathname;
int found_file;
bfd *abfd;
- const struct bfd_arch_info *b;
/* Search for shared library file. */
found_pathname = solib_find (pathname, &found_file);
@@ -443,13 +442,41 @@
error (_("`%s': not in executable format: %s"),
bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
}
+ return abfd;
+}
+
+bfd *
+solib_bfd_open (char *pathname)
+{
+ bfd *abfd, *bbfd;
+ const struct bfd_arch_info *b;
+ char pname[PATH_MAX];
+
+ abfd = solib_bfd_open1 (pathname);
+ if (abfd == NULL)
+ return NULL;
/* Check bfd arch. */
b = gdbarch_bfd_arch_info (target_gdbarch ());
- if (!b->compatible (b, bfd_get_arch_info (abfd)))
- warning (_("`%s': Shared library architecture %s is not compatible "
- "with target architecture %s."), bfd_get_filename (abfd),
- bfd_get_arch_info (abfd)->printable_name, b->printable_name);
+ if (b->compatible (b, bfd_get_arch_info (abfd)))
+ return abfd;
+
+ snprintf (pname, sizeof(pname), "%s-%s", pathname, b->printable_name);
+ bbfd = solib_bfd_open1 (pname);
+ if (bbfd == NULL)
+ goto out;
+
+ gdb_bfd_unref (abfd);
+ abfd = bbfd;
+
+ /* Check bfd arch. */
+ if (b->compatible (b, bfd_get_arch_info (abfd)))
+ return abfd;
+
+out:
+ warning (_("`%s': Shared library architecture %s is not compatible "
+ "with target architecture %s."), bfd_get_filename (abfd),
+ bfd_get_arch_info (abfd)->printable_name, b->printable_name);
return abfd;
}
Home |
Main Index |
Thread Index |
Old Index