From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11577 invoked by alias); 8 Apr 2002 18:14:57 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 11555 invoked from network); 8 Apr 2002 18:14:56 -0000 Received: from unknown (HELO localhost.redhat.com) (216.138.202.10) by sources.redhat.com with SMTP; 8 Apr 2002 18:14:56 -0000 Received: from cygnus.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 9A7883DE1; Mon, 8 Apr 2002 14:14:57 -0400 (EDT) Message-ID: <3CB1DE21.1000704@cygnus.com> Date: Mon, 08 Apr 2002 11:14:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:0.9.9) Gecko/20020328 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daniel Jacobowitz Cc: Paul Bartlett , gdb@sources.redhat.com Subject: Re: gdbserver, remote serial protocol and endian issues References: <005701c1deea$d9cd52b0$300e81a4@bristol.st.com> <20020408104522.A24590@nevyn.them.org> <00d501c1df12$ab1bdd60$300e81a4@bri.st.com> <20020408114455.A26658@nevyn.them.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-04/txt/msg00099.txt.bz2 > 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 ! 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.