On Wed, Jul 8, 2009 at 00:45, Ulrich Weigand wrote: > Hui Zhu wrote: > >> +  /* Check bfd arch.  */ >> +  b = gdbarch_bfd_arch_info (target_gdbarch); >> +  if (b->compatible (b, bfd_get_arch_info (abfd)) != b) >> +    { >> +      bfd_close (abfd); >> +      make_cleanup (xfree, found_pathname); >> +      error (_("`%s': ARCH not same with inferior."), found_pathname); >> +    } > > I'm not sure this should be an error; we allow debugging a main > executable whose architecture does not match the target architecture > (if the user knows what they're doing), so IMO we should allow this > for shared libraries too.  A *warning* would be more appropriate. > > Also, I think it would be good if the message mentioned the architecture > in question, along the lines of: > >  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); > Agree with you. I make a new patch for it. Please help me review it. Thanks. Hui 2009-07-08 Hui Zhu * solib.c (solib_bfd_open): Output a warning if solib's architecture is not compatible with inferior's architecture. --- solib.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/solib.c +++ b/solib.c @@ -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; }