This is the mail archive of the gdb@sourceware.cygnus.com 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]

Re: store_floating() rewrite (was Re: bug in arm_push_arguments())


I'm not sure whether the following was being considered as a patch,
but if so, it is withdrawn.  I've sent a proper patch to gdb-patches
which fix the problems that this rewrite was trying to address.  (As
written, the code below does not take into account the size of the
float type for doing the memcpy in the event that the host and target
float formats are the same.)

On Feb 28, 11:11am, Kevin Buettner wrote:

> Here is my rewrite of this function:
> 
> void
> store_floating (void *addr, int len, DOUBLEST val)
> {
>   if (HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT)
>     {
>       float floatval = val;
> 
>       memcpy (addr, &floatval, sizeof (floatval));
>     }
>   else if (HOST_DOUBLE_FORMAT == TARGET_DOUBLE_FORMAT)
>     {
>       double doubleval = val;
> 
>       memcpy (addr, &doubleval, sizeof (doubleval));
>     }
>   else if (HOST_LONG_DOUBLE_FORMAT == TARGET_LONG_DOUBLE_FORMAT)
>     memcpy (addr, &val, sizeof (val));
>   else if (len * TARGET_CHAR_BIT == TARGET_FLOAT_BIT)
>     floatformat_from_doublest (TARGET_FLOAT_FORMAT, &val, addr);
>   else if (len * TARGET_CHAR_BIT == TARGET_DOUBLE_BIT)
>     floatformat_from_doublest (TARGET_DOUBLE_FORMAT, &val, addr);
>   else if (len * TARGET_CHAR_BIT == TARGET_LONG_DOUBLE_BIT)
>     floatformat_from_doublest (TARGET_LONG_DOUBLE_FORMAT, &val, addr);
> #ifdef TARGET_STORE_FLOATING
>   else if (TARGET_STORE_FLOATING (addr, len, val))
>     return;
> #endif 
>   else
>     error ("Can't deal with a floating point number of %d bytes.", len);
> }

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