Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: Daniel Jacobowitz <dmj+@andrew.cmu.edu>
Cc: Paul Bartlett <paul.bartlett@st.com>, gdb@sources.redhat.com
Subject: Re: gdbserver, remote serial protocol and endian issues
Date: Mon, 08 Apr 2002 11:14:00 -0000	[thread overview]
Message-ID: <3CB1DE21.1000704@cygnus.com> (raw)
In-Reply-To: <20020408114455.A26658@nevyn.them.org>

> On Mon, Apr 08, 2002 at 04:33:01PM +0100, Paul Bartlett wrote:
> 
>> Hi Daniel,
>> 
> 
>> > 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.
> 
>> 
>> Well, maybe I'm guilty of not considering the
>> general case - haven't thought it through yet.
> 
> 
> As soon as you try looking through stack frames, you realize that
> keeping registers in target byte order is a lot simpler for the rest of
> GDB.

Hardware registers are byte-order netural.  It is the way they are 
``spilt'' into memory that is not.  The best guess at an intpretation of 
the remote protocol's G packet format is that it transfers ``spilt'' 
registers.

As for memory transfers.  They are currently ``byte order netural'' (1)(2).

Anyway, two references:

http://sources.redhat.com/gdb/papers/multi-arch/real-multi-arch/index.html#SEC40
http://sources.redhat.com/gdb/bugs/

The former is especially important - it sets the expected overall 
direction.  In particular:

	Tnn;....;Architecture=...
		transfer the architecture including byte order
	<regnr>!<value>
		transfer network ordered registers

Andrew

(1) If someone targets GDB at a word only addressable ISA then this will 
need to be clarified.
(2) I'm ignoring XOR endian issues as found on MIPS and PPC.  The bytes 
are ordered according to how the program sees them vis: ``char *memory = 
NULL; memory[i++];''.  XOR endian does wierd stuff.


  parent reply	other threads:[~2002-04-08 18:14 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
     [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 [this message]
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=3CB1DE21.1000704@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=dmj+@andrew.cmu.edu \
    --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