From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15534 invoked by alias); 17 May 2002 23:06:34 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 15468 invoked from network); 17 May 2002 23:06:30 -0000 Received: from unknown (HELO walton.kettenis.dyndns.org) (213.93.114.42) by sources.redhat.com with SMTP; 17 May 2002 23:06:30 -0000 Received: from elgar.kettenis.dyndns.org (elgar.kettenis.dyndns.org [192.168.0.2]) by walton.kettenis.dyndns.org (8.11.6/8.11.6) with ESMTP id g4HN7kG00191; Sat, 18 May 2002 01:07:46 +0200 (CEST) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: (from kettenis@localhost) by elgar.kettenis.dyndns.org (8.11.6/8.11.6) id g4HN6OQ01741; Sat, 18 May 2002 01:06:24 +0200 (CEST) (envelope-from kettenis) Date: Fri, 17 May 2002 16:06:00 -0000 From: Mark Kettenis Message-Id: <200205172306.g4HN6OQ01741@elgar.kettenis.dyndns.org> To: msnyder@redhat.com CC: thorpej@wasabisystems.com, m.m.kettenis@chello.nl, gdb-patches@sources.redhat.com, drow@mvista.com, ac131313@cygnus.com In-reply-to: <3CE541BF.C833493F@redhat.com> (message from Michael Snyder on Fri, 17 May 2002 10:45:35 -0700) Subject: Re: [PATCH/RFA] Don't gdbarch_init for core files References: <20020517135849.ZGDH1268.amsfep15-int.chello.nl@[127.0.0.1]> <20020517104712.A14437@dr-evil.shagadelic.org> <3CE541BF.C833493F@redhat.com> X-SW-Source: 2002-05/txt/msg00768.txt.bz2 Date: Fri, 17 May 2002 10:45:35 -0700 From: Michael Snyder 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 * 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);