Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Check solib bfd arch
@ 2009-07-03  9:52 Hui Zhu
  2009-07-05 21:36 ` Ulrich Weigand
  0 siblings, 1 reply; 25+ messages in thread
From: Hui Zhu @ 2009-07-03  9:52 UTC (permalink / raw)
  To: gdb-patches ml; +Cc: Michael Snyder

[-- Attachment #1: Type: text/plain, Size: 1004 bytes --]

Hi,

In cross-compile remote debug environment, the gdb will load the solib
of local host if user doesn't set sysroot or something.
Load the wrong lib will make gdb get error.

So I make a patch check the solib bfd arch after load it.  I am not
check the other thing in arch_info because the mach of solib and
inferior is not same (powerpc) sometime.

This patch is tested in a i386 ubuntu and powerpc linux.

Thanks,
Hui

2009-07-03  Hui Zhu  <teawater@gmail.com>

	* solib.c (solib_bfd_open): Check solib bfd arch.

---
 solib.c |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/solib.c
+++ b/solib.c
@@ -311,6 +311,14 @@ solib_bfd_open (char *pathname)
 	     found_pathname, bfd_errmsg (bfd_get_error ()));
     }

+  /* Check bfd arch.  */
+  if (bfd_get_arch (abfd) != gdbarch_bfd_arch_info (target_gdbarch)->arch)
+    {
+      bfd_close (abfd);
+      make_cleanup (xfree, found_pathname);
+      error (_("`%s': ARCH not same with inferior."), found_pathname);
+    }
+
   return abfd;
 }

[-- Attachment #2: solib-check-bfd_arch_info.txt --]
[-- Type: text/plain, Size: 489 bytes --]

---
 solib.c |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/solib.c
+++ b/solib.c
@@ -311,6 +311,14 @@ solib_bfd_open (char *pathname)
 	     found_pathname, bfd_errmsg (bfd_get_error ()));
     }
 
+  /* Check bfd arch.  */
+  if (bfd_get_arch (abfd) != gdbarch_bfd_arch_info (target_gdbarch)->arch)
+    {
+      bfd_close (abfd);
+      make_cleanup (xfree, found_pathname);
+      error (_("`%s': ARCH not same with inferior."), found_pathname);
+    }
+
   return abfd;
 }
 

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2009-09-22 23:04 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-03  9:52 [RFA] Check solib bfd arch Hui Zhu
2009-07-05 21:36 ` Ulrich Weigand
2009-07-06  3:03   ` Hui Zhu
2009-07-07 16:45     ` Ulrich Weigand
2009-07-08  2:46       ` Hui Zhu
2009-07-09 13:43         ` Ulrich Weigand
2009-07-09 16:50           ` Hui Zhu
2009-09-17 22:56         ` Joel Brobecker
2009-09-18  5:05           ` Hui Zhu
2009-09-18 12:50           ` Ulrich Weigand
2009-09-18 13:06             ` Ulrich Weigand
2009-09-18 13:10             ` Daniel Jacobowitz
2009-09-18 14:24               ` Joel Brobecker
2009-09-18 14:08             ` Mark Kettenis
2009-09-18 14:11               ` Mark Kettenis
2009-09-18 14:39               ` Daniel Jacobowitz
2009-09-18 14:53                 ` Pedro Alves
2009-09-18 16:14                   ` Ulrich Weigand
2009-09-18 16:25                     ` Daniel Jacobowitz
2009-09-18 16:41                       ` Pedro Alves
2009-09-18 16:44                         ` Daniel Jacobowitz
2009-09-18 16:45                         ` Pedro Alves
2009-09-18 17:17                           ` Joel Brobecker
2009-09-18 20:43                             ` Joel Brobecker
2009-09-22 23:04           ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox