This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: [bug] fetch_register_using_p() is not endian-ness safe
- From: Daniel Jacobowitz <drow at false dot org>
- To: "Theodore A. Roth" <troth at openavr dot org>
- Cc: gdb at sources dot redhat dot com, Paul Schlie <schlie at comcast dot net>
- Date: Mon, 25 Oct 2004 19:11:22 -0400
- Subject: Re: [bug] fetch_register_using_p() is not endian-ness safe
- References: <Pine.LNX.4.53.0410191803120.17223@knuth.amplepower.com>
On Tue, Oct 19, 2004 at 06:18:46PM -0700, Theodore A. Roth wrote:
> Hi,
>
> Just got bit by this one.
>
> The recent changes to remote.c to implement 'p' packets using
> fetch_register_using_p() is broken.
>
> It is padding out the hex-ified regnum with zeros, but the resulting
> endian-ness is tied to the gdb host. For example, on my x86 linux box,
> fetching the PC, gdb sends this packet:
>
> "$p22000000#f4"
>
> while on Paul's powerpc system, he sees this packet:
>
> "$p00000022#f4"
>
> This poses a problem for the remote target when the stub needs to parse
> this packet since the byte ordering is not well defined.
FYI, Jim Blandy noticed this a little earlier - and his patch for the
problem was just approved.
--
Daniel Jacobowitz