Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfa/i387] Eliminate HOST_*_FORMAT from i387-tdep.c
@ 2001-06-29  9:53 Andrew Cagney
  2001-07-01  5:56 ` Mark Kettenis
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Cagney @ 2001-06-29  9:53 UTC (permalink / raw)
  To: gdb-patches

Hello,

Very similar to my ARM tweek, this patch replaces a use of 
HOST_LONG_DOUBLE_FORMAT with more generic code.

There isn't a loss of precision since extract_floating() on i386 native 
should still do a memcopy().

	Andrew

(Disclaimers about testing apply, it does compile :-/ ).
From ac131313@cygnus.com Fri Jun 29 10:23:00 2001
From: Andrew Cagney <ac131313@cygnus.com>
To: gdb-patches@sources.redhat.com
Subject: [rfc/rfa] Almost eliminate HOST_{FLOAT,DOUBLE,...}_FORMAT
Date: Fri, 29 Jun 2001 10:23:00 -0000
Message-id: <3B3CB989.1000706@cygnus.com>
X-SW-Source: 2001-06/msg00531.html
Content-length: 788

Hello,

Attached is a revised patch to defs.h and findvar.c to reduce the 
dependency on host floating point formats.

This patch changes GDB so that, if the host configury didn't specify the 
floating point format, it will fall back immediatly to floatformat_*(). 
  Previously, GDB would assume that the HOST had IEEE FP and try to use 
that.

For hosts that don't specify a HOST_*_FORMAT, this will mean a loss of 
FP precision when using GDB :-/

As an accidental side effect, this eliminates the problem where, if the 
the host/target both forgot to specify their long-double format/size, 
the code would assume that they were identical and do really bizare things.

	Andrew

PS: If you haven't figured it out, I'm tring to eliminate xm.h and 
(gasp) nm.h for at least one platform.
From ac131313@cygnus.com Fri Jun 29 10:51:00 2001
From: Andrew Cagney <ac131313@cygnus.com>
To: gdb-patches@sources.redhat.com
Subject: [rfa] NetBSD/PowerPC doesn't need xm.h
Date: Fri, 29 Jun 2001 10:51:00 -0000
Message-id: <3B3CC000.7040700@cygnus.com>
X-SW-Source: 2001-06/msg00532.html
Content-length: 375

Hello,

Assuming that the other patches are accepted, this patch removes xm.h 
from the NetBSD/PowerPC host configuration.

This is probably a good host/target to work with since it isn't 
mainstream and consequently won't hurt anything like the more important 
GNU systems.

Ok?
	Andrew

PS: There are several follow-on's to this - HOST_BYTE_ORDER can also be 
eliminated.


^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: [rfa/i387] Eliminate HOST_*_FORMAT from i387-tdep.c
@ 2001-07-06  5:52 Michael Elizabeth Chastain
  2001-07-06  6:16 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Elizabeth Chastain @ 2001-07-06  5:52 UTC (permalink / raw)
  To: ac131313; +Cc: gdb-patches

Jump back, this new code has a pointer glitch.  I think it needs
this patch.

I tested this on native Red Hat Linux 7 with gcc 3.0 with the test
script gdb.base/default.exp.  Without the patch, gdb crashes on
an "info float" command.

OK to apply?

MichaelC

===

Index: i387-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i387-tdep.c,v
retrieving revision 1.11
diff -c -1 -0 -p -r1.11 i387-tdep.c
*** gdb/i387-tdep.c	2001/07/04 21:14:05	1.11
--- gdb/i387-tdep.c	2001/07/06 12:47:00
*************** print_i387_value (char *raw)
*** 163,184 ****
    DOUBLEST value;
    int len = TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT;
    char *tmp = alloca (len);
  
    /* This code only works on targets where ... */
    gdb_assert (TARGET_LONG_DOUBLE_FORMAT == &floatformat_i387_ext);
  
    /* Take care of the padding.  FP reg is 80 bits.  The same value in
       memory is 96 bits.  */
    gdb_assert (FPU_REG_RAW_SIZE < len);
!   memcpy (&tmp, raw, FPU_REG_RAW_SIZE);
!   memset (&tmp + FPU_REG_RAW_SIZE, 0, len - FPU_REG_RAW_SIZE);
    
    /* Extract the value as a DOUBLEST.  */
    /* Use extract_floating() rather than floatformat_to_doublest().
       The latter is lossy in nature.  Once GDB gets a host/target
       independent and non-lossy FP it will become possible to bypass
       extract_floating() and call floatformat*() directly.  Note also
       the assumptions about TARGET_LONG_DOUBLE above.  */
    value = extract_floating (tmp, len);
  
    /* We try to print 19 digits.  The last digit may or may not contain
--- 163,184 ----
    DOUBLEST value;
    int len = TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT;
    char *tmp = alloca (len);
  
    /* This code only works on targets where ... */
    gdb_assert (TARGET_LONG_DOUBLE_FORMAT == &floatformat_i387_ext);
  
    /* Take care of the padding.  FP reg is 80 bits.  The same value in
       memory is 96 bits.  */
    gdb_assert (FPU_REG_RAW_SIZE < len);
!   memcpy (tmp, raw, FPU_REG_RAW_SIZE);
!   memset (tmp + FPU_REG_RAW_SIZE, 0, len - FPU_REG_RAW_SIZE);
    
    /* Extract the value as a DOUBLEST.  */
    /* Use extract_floating() rather than floatformat_to_doublest().
       The latter is lossy in nature.  Once GDB gets a host/target
       independent and non-lossy FP it will become possible to bypass
       extract_floating() and call floatformat*() directly.  Note also
       the assumptions about TARGET_LONG_DOUBLE above.  */
    value = extract_floating (tmp, len);
  
    /* We try to print 19 digits.  The last digit may or may not contain


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2001-07-06  6:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-29  9:53 [rfa/i387] Eliminate HOST_*_FORMAT from i387-tdep.c Andrew Cagney
2001-07-01  5:56 ` Mark Kettenis
2001-07-02  8:55   ` Jim Blandy
2001-07-03 12:26     ` Russ Allbery
2001-07-04 12:18   ` Andrew Cagney
2001-07-04 14:13     ` Mark Kettenis
2001-07-06  5:52 Michael Elizabeth Chastain
2001-07-06  6:16 ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox