2009-07-09 Hui Zhu <teawater@gmail.com>
authorHui Zhu <teawater@gmail.com>
Thu, 9 Jul 2009 13:39:17 +0000 (13:39 +0000)
committerHui Zhu <teawater@gmail.com>
Thu, 9 Jul 2009 13:39:17 +0000 (13:39 +0000)
* solib.c (solib_bfd_open): Output a warning if solib's
architecture is not compatible with inferior's architecture.

gdb/ChangeLog
gdb/solib.c

index 82fa8b8426a8c54bef8cfc16c74724188a08642c..e9e9c1971b5ae00c6d53b667abab9ad6e0e69b37 100644 (file)
@@ -1,3 +1,8 @@
+2009-07-09  Hui Zhu  <teawater@gmail.com>
+
+       * solib.c (solib_bfd_open): Output a warning if solib's
+       architecture is not compatible with inferior's architecture.
+
 2009-07-09  Ulrich Weigand  <uweigand@de.ibm.com>
            Jan Kratochvil  <jan.kratochvil@redhat.com>
 
index d194ac78f962eedf0009fb23f51cb213e1230552..53d5d1bcb75a28267322e6aaf0a17f346de25fad 100644 (file)
@@ -289,6 +289,7 @@ solib_bfd_open (char *pathname)
   char *found_pathname;
   int found_file;
   bfd *abfd;
+  const struct bfd_arch_info *b;
 
   /* Use target-specific override if present.  */
   if (ops->bfd_open)
@@ -311,6 +312,13 @@ solib_bfd_open (char *pathname)
             found_pathname, bfd_errmsg (bfd_get_error ()));
     }
 
+  /* Check bfd arch.  */
+  b = gdbarch_bfd_arch_info (target_gdbarch);
+  if (b->compatible (b, bfd_get_arch_info (abfd)) != b)
+    warning (_("`%s': Shared library architecture %s is not compatible "
+               "with target architecture %s."), found_pathname,
+             bfd_get_arch_info (abfd)->printable_name, b->printable_name);
+
   return abfd;
 }