From: Mark Kettenis <kettenis@gnu.org>
To: orjan.friberg@axis.com
Cc: gdb-patches@sources.redhat.com, hans-peter.nilsson@axis.com
Subject: Re: [CRIS] Reading core file selects "wrong" mach
Date: Mon, 13 Dec 2004 20:22:00 -0000 [thread overview]
Message-ID: <200412132002.iBDK22Uc001107@elgar.sibelius.xs4all.nl> (raw)
In-Reply-To: <41BDAA01.6080101@axis.com> (message from Orjan Friberg on Mon, 13 Dec 2004 15:41:05 +0100)
Date: Mon, 13 Dec 2004 15:41:05 +0100
From: Orjan Friberg <orjan.friberg@axis.com>
> Is there an implicit assumption that the mach is not to be trusted
> when reading a core file?
>
> What do you mean by "not to be trusted"? It's simply always set to
> the default machine for ELF core files. For most architectures this
> is what makes the most sense anyway. Setting it to anything different
> from the default would involve some architecture-dependent code. I
What I meant was that I couldn't find any other port that looked at
the mach in their grok_prstatus/grok_prinfo, which led me to think
there might be a reason they didn't.
Well, needlessly setting the machine could cause problems, and we
shouldn't blindly do that. But I think it's safe to say that it's
just because it didn't matter. GDB didn't really pay attention to the
architecture of the core file until rather recently.
> guess the correct way to do this would be adding
> elf_set_mach_from_flags() to `struct elf_backend_data', and use that
> in elf_core_file_p() to set the machine after the architecture has
> been set.
Yes, that makes sense. Thanks.
I guess the answer to this is 'no', but would it be possible (and
correct) to use whatever machine was set when loading the
corresponding program into GDB?
No. (See you got it right.) The machine in the core file doesn't
necessarily match the machine for the loaded executable. This mainly
arises in 32-bit x 64-bit cross-debugging. Some 64-bit operating
systems will generate 64-bit core files, even when running 32-bit
code. GDB uses the machine type to recognize the layout of the core
file in such a situation. Example are sparc/sparcv9 or i386/x86_64.
Mark
next prev parent reply other threads:[~2004-12-13 20:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-01 14:00 Orjan Friberg
2004-12-01 16:14 ` Randolph Chung
2004-12-02 10:15 ` Orjan Friberg
2004-12-02 15:42 ` Randolph Chung
2004-12-02 17:18 ` Mark Kettenis
2004-12-13 15:12 ` Orjan Friberg
2004-12-13 16:09 ` Hans-Peter Nilsson
2004-12-13 20:22 ` Mark Kettenis [this message]
2005-01-14 17:10 ` Orjan Friberg
2005-01-14 18:40 ` Hans-Peter Nilsson
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=200412132002.iBDK22Uc001107@elgar.sibelius.xs4all.nl \
--to=kettenis@gnu.org \
--cc=gdb-patches@sources.redhat.com \
--cc=hans-peter.nilsson@axis.com \
--cc=orjan.friberg@axis.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