Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: Paul Bartlett <paul.bartlett@st.com>
Cc: gdb@sources.redhat.com
Subject: Re: gdbserver, remote serial protocol and endian issues
Date: Mon, 08 Apr 2002 07:45:00 -0000	[thread overview]
Message-ID: <20020408104522.A24590@nevyn.them.org> (raw)
In-Reply-To: <005701c1deea$d9cd52b0$300e81a4@bri.st.com>

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


  reply	other threads:[~2002-04-08 14:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-08  3:48 Paul Bartlett
2002-04-08  7:45 ` Daniel Jacobowitz [this message]
     [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

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=20020408104522.A24590@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=gdb@sources.redhat.com \
    --cc=paul.bartlett@st.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