Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jason R Thorpe <thorpej@wasabisystems.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH/RFA] Don't gdbarch_init for core files
Date: Thu, 09 May 2002 18:58:00 -0000	[thread overview]
Message-ID: <20020509185824.U3435@dr-evil.shagadelic.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1242 bytes --]

As discussed on gdb@, there is a problem involving gdbarch and core
files.

At least GNU/Linux and NetBSD identify executables using note sections.
Many targets use this to select the OS/ABI variant for the target.

The problem is that if you are debugging a core file, the core file is
loaded after the executable, and the current code re-initializes the
current gdbarch based on the core file.

Since the core file lacks the same markings as the executable, the
gdbarch that results is unable to debug the executable+core.

There are other problems, as well.  The core file often doesn't have
the same flags as an executable -- consider the flags the MIPS target
uses to decide between o32, o64, n32, etc.  These flags may not be
present in the core file (indeed -- the core file is just a memory image,
and doens't really have an "ABI", per se).  The ABI, again, really comes
from the executable.

At the very least, it has befuddled Daniel and me :-)

The following patch fixes this problem (which can be easily demonstrated
by simply doing "gdb a.out a.out.core" on any target that supports OS/ABI
variants).

	* corelow.c (core_open): Don't reinitialize the current
	gdbarch.

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>

[-- Attachment #2: core-patch --]
[-- Type: text/plain, Size: 506 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 01:40:13 -0000
@@ -321,8 +321,6 @@
     error ("\"%s\": Can't find sections: %s",
 	   bfd_get_filename (core_bfd), bfd_errmsg (bfd_get_error ()));
 
-  set_gdbarch_from_file (core_bfd);
-
   ontop = !push_target (&core_ops);
   discard_cleanups (old_chain);
 

             reply	other threads:[~2002-05-10  1:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-09 18:58 Jason R Thorpe [this message]
2002-05-09 20:04 ` Andrew Cagney
2002-05-09 21:21   ` Jason R Thorpe
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=20020509185824.U3435@dr-evil.shagadelic.org \
    --to=thorpej@wasabisystems.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