This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] decimal float point patch based on libdecnumber: gdb patch


On Mon, Aug 21, 2006 at 11:58:14PM +0800, Wu Zhou wrote:
> But as far as I know, the endianess of struct "value" in the target memory 
> is architecture depedent. To name a example, in value_from_decfloat, we 
>  need to set the raw content of val to the dfp constant user inputed, I am 
> using this:
>   memcpy (value_contents_raw (val), decbytes, len);
> 
> decbytes is big-endian on all both x86 and ppc64 platforms.  But the 
> value_contents_raw (val) is little endian on x86 / x86_64 system, and big 
> endian on ppc64.  So exchange_dfp is needed.

No, that's not right.  The format of the byte buffer in struct value is
supposed to match the target representation of the object being
described.  If this is always big endian on the target, it should be
big endian in GDB too.

You can think of it like this:

struct A
{
  char a, b, c, d, e, f, g, h;
};

The first byte in the value buffer is supposed to match "char a", no
matter what the target endianness is.

Does that help, or am I not understanding the problem?

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]