Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@chello.nl>
To: gdb@sources.redhat.com, dan@debian.org, amitkale@emsyssoft.com,
	peter@freebsd.org, obrien@freebsd.org, fvdl@netbsd.org
Subject: [RFC] Adding %cs and %ss for AMD64 to GDB
Date: Thu, 01 Jan 2004 00:51:00 -0000	[thread overview]
Message-ID: <200401010051.i010p5Yg016798@elgar.kettenis.dyndns.org> (raw)

Folks,

GDB doesn't handle %cs and %ss for AMD64 yet.  I'm not sure why they
were omitted (might be because they're not particularly useful in long
mode), but there are cases where we might need them.  I might add
these registers after the current last register (%mxcsr), but it just
seems so much more logical to have them close to the other segment
registers.  However, since GDB's register numbering influences the
remote interface, I cannot simply do this.

So here's my question: How bad would it be to change the remote
protocol for AMD64?

I'm proposing to add %cs and %ss just after %eflags.  This would mean
that the segment registers, the floating-point registers and the SSE
registers will shift.  Using a new GDB with an old gdbserver, or an
old remote stub, will mean those registers will contain bogus values.

I did a small survey of the Open Source projects that might make use
of GDB's remote interface to see what the impact would be:

* Linux kgdb doesn't use anything beyond %eflags yet.  Impact would be
  zero.

* FreeBSD kgdb supplies %cs and %ss in the slots that are now reserved
  for %ds and %es.  It provides zero for %fs and %gs (which it thinks
  are %ds and %es).  The impact would be positive!

* NetBSD kgdb doesn't seem to support remote debugging for AMD64 yet.

* Gdbserver supplies %cs and %ss in the slots that are now reserved
  for %ds and %es, %ds and %es in the slots for %fs and %gs, and %fs
  and %gs in the slots for %st0 and %st1.  So the situation for the
  segment registers would actually improve!  However, for the
  floating-point and SSE registers the situation would become worse,
  although right now the most important floating-point registers %st0
  and %st1 might be unreliable.

Note that the problems with gdbserver can be solved by simply
upgrading gdbserver on the remote machine, which in most cases won't
bee too difficult.  I can't imagine that there are many embedded AMD64
systems out there yet.

From the above I conclude that it wouldn't be too bad to add the %cs
and %ss registers the way I propose.  However, don't hesitate to tell
me if you think differently.

Mark


             reply	other threads:[~2004-01-01  0:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-01  0:51 Mark Kettenis [this message]
2004-01-01  6:15 ` Amit S. Kale
2004-01-01  7:47   ` Daniel Jacobowitz
2004-01-02  1:25 ` David O'Brien

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=200401010051.i010p5Yg016798@elgar.kettenis.dyndns.org \
    --to=kettenis@chello.nl \
    --cc=amitkale@emsyssoft.com \
    --cc=dan@debian.org \
    --cc=fvdl@netbsd.org \
    --cc=gdb@sources.redhat.com \
    --cc=obrien@freebsd.org \
    --cc=peter@freebsd.org \
    /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