* [RFC] Adding %cs and %ss for AMD64 to GDB
@ 2004-01-01 0:51 Mark Kettenis
2004-01-01 6:15 ` Amit S. Kale
2004-01-02 1:25 ` David O'Brien
0 siblings, 2 replies; 4+ messages in thread
From: Mark Kettenis @ 2004-01-01 0:51 UTC (permalink / raw)
To: gdb, dan, amitkale, peter, obrien, fvdl
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC] Adding %cs and %ss for AMD64 to GDB
2004-01-01 0:51 [RFC] Adding %cs and %ss for AMD64 to GDB Mark Kettenis
@ 2004-01-01 6:15 ` Amit S. Kale
2004-01-01 7:47 ` Daniel Jacobowitz
2004-01-02 1:25 ` David O'Brien
1 sibling, 1 reply; 4+ messages in thread
From: Amit S. Kale @ 2004-01-01 6:15 UTC (permalink / raw)
To: Mark Kettenis, gdb, dan, peter, obrien, fvdl, Jim Houston
Mark,
Linux kgdb indeed will not have much of a problem. I anyway have posted a gdb
with kernel module loading feature at kgdb.sourceforge.net. It's going to
stay there for till the time this feature makes it to official gdb. I can add
this change also to that gdb.
I guess it's time to introduce a version stamp on remote protocol. That way
any further modifications to the protocol will not result in surprises from
gdb-gdbserver mismatches.
On Thursday 01 Jan 2004 6:21 am, Mark Kettenis wrote:
> 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
--
Amit Kale
EmSysSoft (http://www.emsyssoft.com)
KGDB: Linux Kernel Source Level Debugger (http://kgdb.sourceforge.net)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC] Adding %cs and %ss for AMD64 to GDB
2004-01-01 6:15 ` Amit S. Kale
@ 2004-01-01 7:47 ` Daniel Jacobowitz
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2004-01-01 7:47 UTC (permalink / raw)
To: Amit S. Kale; +Cc: Mark Kettenis, gdb, peter, obrien, fvdl, Jim Houston
On Thu, Jan 01, 2004 at 11:44:29AM +0530, Amit S. Kale wrote:
> Mark,
>
> Linux kgdb indeed will not have much of a problem. I anyway have posted a gdb
> with kernel module loading feature at kgdb.sourceforge.net. It's going to
> stay there for till the time this feature makes it to official gdb. I can add
> this change also to that gdb.
>
> I guess it's time to introduce a version stamp on remote protocol. That way
> any further modifications to the protocol will not result in surprises from
> gdb-gdbserver mismatches.
Versioning the remote protocol as a whole isn't feasible, since there
are so many variations. I've tentatively proposed a solution for the
problem of changing register sets; it's just that neither I nor anyone
else has had time to implement it :)
Mark, I agree with your assessment. I don't think it will be a
problem.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC] Adding %cs and %ss for AMD64 to GDB
2004-01-01 0:51 [RFC] Adding %cs and %ss for AMD64 to GDB Mark Kettenis
2004-01-01 6:15 ` Amit S. Kale
@ 2004-01-02 1:25 ` David O'Brien
1 sibling, 0 replies; 4+ messages in thread
From: David O'Brien @ 2004-01-02 1:25 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb, dan, amitkale, peter, fvdl
On Thu, Jan 01, 2004 at 01:51:05AM +0100, Mark Kettenis wrote:
> * 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!
From a FreeBSD POV, I would like to see the change made. We can easily
handle the change.
--
-- David (obrien@FreeBSD.org)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-01-02 1:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-01 0:51 [RFC] Adding %cs and %ss for AMD64 to GDB Mark Kettenis
2004-01-01 6:15 ` Amit S. Kale
2004-01-01 7:47 ` Daniel Jacobowitz
2004-01-02 1:25 ` David O'Brien
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox