* gdbserver, remote serial protocol and endian issues
@ 2002-04-08 3:48 Paul Bartlett
2002-04-08 7:45 ` Daniel Jacobowitz
2002-04-08 19:48 ` Andrew Cagney
0 siblings, 2 replies; 7+ messages in thread
From: Paul Bartlett @ 2002-04-08 3:48 UTC (permalink / raw)
To: gdb
Hi Folks,
We've developed an implementation of gdbserver that
runs in a box interfacing the debug ports of SuperH
SH4/SH5 targets to ethernet.
When connecting to a target cpu, various memory mapped
registers must be initialised in order to configure
the external bus interfaces, clock generators and
so forth.
This achieved by doing pokes from script files.
The target may be jumper configured to be either big
or little endian.
Unfortunately, the remote serial protocol makes no
distinction between writes to memory and writes to
memory mapped registers - you just get a byte stream
in target endian order.
In our case, the registers are not byte addressable
and need to be written variously as 8, 16 and 32 bit
quantities. Again, remote serial protocol does not
provide for access size definition.
In order to get things to work at all, we've had to
embed knowledge of specific CPU variants in the
gdbserver code together with an indication of the
target endianness - messy to say the least, and a
pain to maintain.
On an aesthetic note, when reading and writing CPU
registers, the transfer really ought to be endian
neutral - i.e. in a consistent format that does
not change with the endianness of the target. Network
byte order perhaps? This would also remove the need
for gdbserver to be aware of target endianness.
I noticed a brief flurry of posts on the subject about
a year ago but nothing since.
Does anyone have an opinion on this?
Cheers,
Paul
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: gdbserver, remote serial protocol and endian issues
2002-04-08 3:48 gdbserver, remote serial protocol and endian issues Paul Bartlett
@ 2002-04-08 7:45 ` Daniel Jacobowitz
[not found] ` <00d501c1df12$ab1bdd60$300e81a4@bri.st.com>
2002-04-08 19:48 ` Andrew Cagney
1 sibling, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2002-04-08 7:45 UTC (permalink / raw)
To: Paul Bartlett; +Cc: gdb
On Mon, Apr 08, 2002 at 11:47:59AM +0100, Paul Bartlett wrote:
> Hi Folks,
>
> We've developed an implementation of gdbserver that
> runs in a box interfacing the debug ports of SuperH
> SH4/SH5 targets to ethernet.
>
> When connecting to a target cpu, various memory mapped
> registers must be initialised in order to configure
> the external bus interfaces, clock generators and
> so forth.
>
> This achieved by doing pokes from script files.
>
> The target may be jumper configured to be either big
> or little endian.
>
> Unfortunately, the remote serial protocol makes no
> distinction between writes to memory and writes to
> memory mapped registers - you just get a byte stream
> in target endian order.
>
> In our case, the registers are not byte addressable
> and need to be written variously as 8, 16 and 32 bit
> quantities. Again, remote serial protocol does not
> provide for access size definition.
This one is definitely a shortcoming in the remote protocol. The lack
of endianness information may be, also... that's open for discussion.
> In order to get things to work at all, we've had to
> embed knowledge of specific CPU variants in the
> gdbserver code together with an indication of the
> target endianness - messy to say the least, and a
> pain to maintain.
>
> On an aesthetic note, when reading and writing CPU
> registers, the transfer really ought to be endian
> neutral - i.e. in a consistent format that does
> not change with the endianness of the target. Network
> byte order perhaps? This would also remove the need
> for gdbserver to be aware of target endianness.
I don't agree. Target registers are in target-endianness when you read
them off the stack; they should be in target endianness in memory. GDB
has 'set endian little' and 'set endian big', and the stub should just
pass them along however it gets them. gdbserver is also meant to run
in a native configuration, where compile-time checks can tell you the
endianness.
>
> I noticed a brief flurry of posts on the subject about
> a year ago but nothing since.
>
> Does anyone have an opinion on this?
My first impression is that gdbserver is the wrong tool for the job.
Gdbserver is meant as a remote stub for Unix-like systems. You're not
running it on a Unix-like system; you're using it as a proxy, right?
Since GDB already has a stub to speak to the hardware monitor on SH4
boards, as far as I'm aware. This sounds like a job for rproxy
(http://world.std.com/~qqi) instead.
You definitely did highlight some failures of the remote protocol,
though. After I finish my current project I intend to update the
documentation of the protocol and see what needs fixing.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: gdbserver, remote serial protocol and endian issues
2002-04-08 3:48 gdbserver, remote serial protocol and endian issues Paul Bartlett
2002-04-08 7:45 ` Daniel Jacobowitz
@ 2002-04-08 19:48 ` Andrew Cagney
1 sibling, 0 replies; 7+ messages in thread
From: Andrew Cagney @ 2002-04-08 19:48 UTC (permalink / raw)
To: Paul Bartlett; +Cc: gdb
> In our case, the registers are not byte addressable
>> and need to be written variously as 8, 16 and 32 bit
>> quantities. Again, remote serial protocol does not
>> provide for access size definition.
I assume you mean something like a memory read at &foo only works if
done as a 16 bit operation by the remote target.
> This one is definitely a shortcoming in the remote protocol.
Proposals for an extension to the protocol that implement this have been
posted (search for e-mail from jtc). The memory attribute framework was
introduced in preparation for this.
enjoy,
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* FW: gdbserver, remote serial protocol and endian issues
@ 2002-04-10 2:50 Paul Bartlett
2002-04-10 3:05 ` Paul Bartlett
0 siblings, 1 reply; 7+ messages in thread
From: Paul Bartlett @ 2002-04-10 2:50 UTC (permalink / raw)
To: gdb
-----Original Message-----
From: ac131313@cygnus.com [mailto:ac131313@cygnus.com]
Sent: 09 April 2002 18:14
To: paul.bartlett@st.com
Subject: Re: gdbserver, remote serial protocol and endian issues
>
> I've spent a good proportion of the day trawling the list
> archives for JT Conklin's stuff.
>
> I noticed that he was a prolific contributor up to about 16 July
> 2001 and then just disappeared completely.
He was overtaken by other commitments.
> A cursory inspection of remote.c shows that the memory attribute
> changes have made it down to remote_xfer_memory(). I presume
> that all that needs to be done (for remote targets anyhow) is to
> come up with suitable changes to the rsp and propagate the
> parameters through.
>
> I see that one of JT's last contributions was a suggested
> syntax.
> Does anybody have any opinions on which way to go from here?
Proceduraly or technically?
Proceduraly, the first thing to do is get the GDB community to agree on
the protocol extension.
Technically, the first thing to do would be the same - without that
agreement you run the (real) risk of implementing a protocol extension
that isn't accepted into the GDB source tree.
enjoy,
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: gdbserver, remote serial protocol and endian issues
2002-04-10 2:50 FW: " Paul Bartlett
@ 2002-04-10 3:05 ` Paul Bartlett
0 siblings, 0 replies; 7+ messages in thread
From: Paul Bartlett @ 2002-04-10 3:05 UTC (permalink / raw)
To: gdb
Hi Andrew
>Proceduraly or technically?
Proceduraly. The post was intended to canvas opinion as to whether the
proposed enhancement has sufficient support to warrant further
investigation.
If it does, then some discussion on the technical merits of the changes
follows.
If there's no real support for it then I'll resort to handling the problems
that I'm experiencing in another way. It'd be nice to do it 'cleanly'
though.
Best,
Paul
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2002-04-10 10:05 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-08 3:48 gdbserver, remote serial protocol and endian issues Paul Bartlett
2002-04-08 7:45 ` Daniel Jacobowitz
[not found] ` <00d501c1df12$ab1bdd60$300e81a4@bri.st.com>
2002-04-08 8:44 ` Daniel Jacobowitz
2002-04-08 9:01 ` Paul Bartlett
2002-04-08 11:14 ` Andrew Cagney
2002-04-08 19:48 ` Andrew Cagney
2002-04-10 2:50 FW: " Paul Bartlett
2002-04-10 3:05 ` Paul Bartlett
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox