This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH/RFA] Don't gdbarch_init for core files
Date: Fri, 17 May 2002 10:45:35 -0700
From: Michael Snyder <msnyder@redhat.com>
Jason R Thorpe wrote:
>
> On Fri, May 17, 2002 at 03:58:49PM +0200, m.m.kettenis@chello.nl wrote:
>
> > if (!exec_bfd)
> > set_gdbarch_from_file (core_bfd);
> >
> > I tested this, and it seems to solve the problems for me when testing
> > my pending i386 multi-arch patches on Linux.
>
> Hm, why didn't I think of that :-)
>
> This would be totally cool with me.
Let's do it.
OK, I checked in the attached patch.
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* corelow.c (core_open): Only call set_gdbarch_from_file if
exec_bfd is NULL.
Index: corelow.c
===================================================================
RCS file: /cvs/src/src/gdb/corelow.c,v
retrieving revision 1.21
diff -u -p -r1.21 corelow.c
--- corelow.c 5 May 2002 01:15:13 -0000 1.21
+++ corelow.c 17 May 2002 23:04:13 -0000
@@ -321,7 +321,12 @@ core_open (char *filename, int from_tty)
error ("\"%s\": Can't find sections: %s",
bfd_get_filename (core_bfd), bfd_errmsg (bfd_get_error ()));
- set_gdbarch_from_file (core_bfd);
+ /* If we have no exec file, try to set the architecture from the
+ core file. We don't do this unconditionally since an exec file
+ typically contains more information that helps us determine the
+ architecture than a core file. */
+ if (!exec_bfd)
+ set_gdbarch_from_file (core_bfd);
ontop = !push_target (&core_ops);
discard_cleanups (old_chain);