Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <dan@codesourcery.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: Mark Kettenis <mark.kettenis@xs4all.nl>, gdb-patches@sourceware.org
Subject: Re: PATCH: Enable x86 XML target descriptions
Date: Sun, 28 Feb 2010 22:23:00 -0000	[thread overview]
Message-ID: <20100228222244.GA29360@caradoc.them.org> (raw)
In-Reply-To: <6dc9ffc81002281258s3289602cg8c06ceaed8bfe34a@mail.gmail.com>

On Sun, Feb 28, 2010 at 12:58:40PM -0800, H.J. Lu wrote:
> > Sorry, but I don't understand this.  How does checking a register in
> > the target description care about the number of registers set in the
> > gdbarch we're building?
> 
> I copied it from ppc_linux_init_abi. Gdb won't work if I don't reserve
> a register number for orig_rax:

This part of the target descriptions infrastructure was designed to
clean up a confusing aspect of some backends.  If there are well-known
registers - things that GDB has to treat specially for calling
conventions, or read from to determine mode, anything like that - this
lets us give them a fixed register number with a #define.  Then, the
register is concealed at runtime if it is not present on the target.

If you want to have an orig_rax register with a constant register
number, you need to bump up num_regs above that constant.

So the key here is that he's not checking a register in the target.
Independent of the target description supplied, he's bumping up the
total "number of registers" to leave a gap for
AMD64_LINUX_ORIG_RAX_REGNUM, because we said that
AMD64_LINUX_ORIG_RAX_REGNUM was a valid register number
(via the tdesc_numbered_register call).

Is that clearer?

> > Which seems wrong to me.  Both the core registers and the SSE
> > registers are different in 64-bit mode.  But perhaps Daniel can shed
> > some light on how these features are supposed to be used?

There are two ways to do this.  For Power, as HJ has pointed out, the
features have size-independent names because they are mostly the same.
There's still an r0, it's just 64-bit instead of 32-bit.
Alternatively, you can define a 32-bit feature and a 64-bit feature
with different names.

IMO it does not make a lot of difference which version you choose.
I would have chosen to give them separate names; there are too many
differences, and I think it would simplify the code.  But given how
amd64 support is treated as an extension of GDB's i386 support,
I can imagine that this approach makes sense.

If we do stick to a single version, the x86 name seems better than
i386.
> The reason is i386_validate_tdesc_p is called by
> i386_gdbarch_init after calling gdbarch_init_osabi,
> which may set up a 64bit target description. If 64bit
> target description has different feature name, it won't
> find core and SSE registers.  If you don't like "i386"
> in the feature name, I can change it to x86.

That's not a reason.  You could just as easily make the code handle
both variants.

-- 
Daniel Jacobowitz
CodeSourcery


  reply	other threads:[~2010-02-28 22:23 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-10 20:03 H.J. Lu
2010-02-17 14:59 ` H.J. Lu
2010-02-17 15:23   ` Mark Kettenis
2010-02-17 15:42     ` H.J. Lu
2010-02-17 15:46       ` Daniel Jacobowitz
2010-02-17 16:19         ` Mark Kettenis
2010-02-18  5:44 ` H.J. Lu
2010-02-18 15:37   ` H.J. Lu
2010-02-18 23:01     ` H.J. Lu
2010-02-22 13:42       ` Mark Kettenis
2010-02-22 14:17         ` H.J. Lu
2010-02-22 15:01           ` Mark Kettenis
2010-02-22 15:27             ` H.J. Lu
2010-02-22 15:30               ` Daniel Jacobowitz
2010-02-22 15:39                 ` H.J. Lu
2010-02-28 20:30           ` Mark Kettenis
2010-02-28 20:58             ` H.J. Lu
2010-02-28 22:23               ` Daniel Jacobowitz [this message]
2010-02-22 14:41         ` Daniel Jacobowitz
2010-02-22 15:34           ` H.J. Lu
2010-02-22 15:52             ` Daniel Jacobowitz
2010-02-22 15:58               ` H.J. Lu
2010-02-22 16:10                 ` Daniel Jacobowitz
2010-02-22 16:58                   ` Mark Kettenis
2010-02-22 17:03                     ` Daniel Jacobowitz
2010-02-22 19:52                       ` Mark Kettenis
2010-02-22 21:06                         ` H.J. Lu
2010-02-22 21:31                           ` Mark Kettenis
2010-02-22 21:41                             ` H.J. Lu
2010-02-22 22:05                               ` H. Peter Anvin
2010-02-22 22:07                                 ` H.J. Lu
2010-02-22 22:15                                   ` H. Peter Anvin
2010-02-22 22:21                                     ` H.J. Lu
2010-02-28 20:12                               ` Mark Kettenis
2010-02-22 21:04       ` H.J. Lu
2010-02-28 21:16         ` H.J. Lu
2010-03-01 14:49           ` Mark Kettenis
2010-03-01 17:07             ` Daniel Jacobowitz
2010-03-01 17:09               ` H.J. Lu

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=20100228222244.GA29360@caradoc.them.org \
    --to=dan@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=hjl.tools@gmail.com \
    --cc=mark.kettenis@xs4all.nl \
    /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