This is the mail archive of the
mailing list for the GDB project.
Re: gdbserver, remote serial protocol and endian issues
- From: Andrew Cagney <ac131313 at cygnus dot com>
- To: Daniel Jacobowitz <dmj+ at andrew dot cmu dot edu>
- Cc: Paul Bartlett <paul dot bartlett at st dot com>, gdb at sources dot redhat dot com
- Date: Mon, 08 Apr 2002 14:14:57 -0400
- Subject: Re: gdbserver, remote serial protocol and endian issues
- References: <email@example.com> <20020408104522.A24590@nevyn.them.org> <firstname.lastname@example.org> <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
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''
As for memory transfers. They are currently ``byte order netural'' (1)(2).
Anyway, two references:
The former is especially important - it sets the expected overall
direction. In particular:
transfer the architecture including byte order
transfer network ordered registers
(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.