From: Jason R Thorpe <thorpej@wasabisystems.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH/RFA] Don't gdbarch_init for core files
Date: Thu, 09 May 2002 21:21:00 -0000 [thread overview]
Message-ID: <20020509212134.W3435@dr-evil.shagadelic.org> (raw)
In-Reply-To: <3CDB38BB.4030807@cygnus.com>; from ac131313@cygnus.com on Thu, May 09, 2002 at 11:04:27PM -0400
[-- Attachment #1: Type: text/plain, Size: 454 bytes --]
On Thu, May 09, 2002 at 11:04:27PM -0400, Andrew Cagney wrote:
> Instead of removing the call, is it possible to reasonably detect if the
> core file belongs to the current architecture (either in corefile.c) or
> in gdbarch_FOO_init().
How about this?
* corelow.c (core_open): If the core's arch is known and
different from the current, reinitialize gdbarch based on
the core file.
--
-- Jason R. Thorpe <thorpej@wasabisystems.com>
[-- Attachment #2: core-patch --]
[-- Type: text/plain, Size: 1021 bytes --]
Index: corelow.c
===================================================================
RCS file: /cvs/src/src/gdb/corelow.c,v
retrieving revision 1.21
diff -u -r1.21 corelow.c
--- corelow.c 5 May 2002 01:15:13 -0000 1.21
+++ corelow.c 10 May 2002 04:14:05 -0000
@@ -264,6 +264,7 @@
bfd *temp_bfd;
int ontop;
int scratch_chan;
+ const struct bfd_arch_info *current_arch_info;
target_preopen (from_tty);
if (!filename)
@@ -321,7 +322,13 @@
error ("\"%s\": Can't find sections: %s",
bfd_get_filename (core_bfd), bfd_errmsg (bfd_get_error ()));
- set_gdbarch_from_file (core_bfd);
+ /* If the core's arch is known and different from the current,
+ reinitialize gdbarch based on the core file. */
+
+ current_arch_info = gdbarch_bfd_arch_info (current_gdbarch);
+ if (core_bfd->arch_info->arch != bfd_arch_unknown
+ && core_bfd->arch_info->arch != current_arch_info->arch)
+ set_gdbarch_from_file (core_bfd);
ontop = !push_target (&core_ops);
discard_cleanups (old_chain);
next prev parent reply other threads:[~2002-05-10 4:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-09 18:58 Jason R Thorpe
2002-05-09 20:04 ` Andrew Cagney
2002-05-09 21:21 ` Jason R Thorpe [this message]
2002-05-11 19:48 ` Andrew Cagney
2002-05-11 20:30 ` Jason R Thorpe
2002-05-11 20:46 ` Daniel Jacobowitz
2002-05-16 16:24 ` Michael Snyder
2002-05-16 16:24 ` Michael Snyder
2002-05-16 17:33 ` Andrew Cagney
2002-05-17 6:58 m.m.kettenis
2002-05-17 10:47 ` Jason R Thorpe
2002-05-17 10:59 ` Michael Snyder
2002-05-17 16:06 ` Mark Kettenis
2002-05-17 10:54 ` Michael Snyder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020509212134.W3435@dr-evil.shagadelic.org \
--to=thorpej@wasabisystems.com \
--cc=ac131313@cygnus.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox