This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: [RFA] Large and small long doubles in "info float"
- To: eliz at is dot elta dot co dot il
- Subject: Re: [RFA] Large and small long doubles in "info float"
- From: Mark Kettenis <kettenis at wins dot uva dot nl>
- Date: Wed, 12 Apr 2000 02:30:16 +0200
- CC: gdb-patches at sourceware dot cygnus dot com
- References: <200004112121.RAA04395@indy.delorie.com>
Date: Tue, 11 Apr 2000 17:21:51 -0400 (EDT)
From: Eli Zaretskii <eliz@delorie.com>
"info float" cannot display very large or very small long double
values:
I need approval for the following patch which fixes this. I would
like to check it in both for the branch and the trunk, which is why I
took care to make it as cautious as I possibly could...
Okay to commit?
I checked in the following patch instead (on both the branch and the
trunk). Fixes the problem for me on Linux :-), and I think it is a
wee bit cleaner than your patch.
2000-04-12 Mark Kettenis <kettenis@gnu.org>
* i387-tdep.c (print_i387_value): Avoid call to
floatformat_to_doublest if long double type is the same on host
and target.
Index: i387-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i387-tdep.c,v
retrieving revision 1.2
diff -u -p -r1.2 i387-tdep.c
--- i387-tdep.c 2000/03/26 21:21:50 1.2
+++ i387-tdep.c 2000/04/12 00:21:17
@@ -166,8 +166,21 @@ static void
print_i387_value (char *raw)
{
DOUBLEST value;
-
- floatformat_to_doublest (&floatformat_i387_ext, raw, &value);
+
+ /* Avoid call to floatformat_to_doublest if possible to preserve as
+ much information as possible. */
+
+#ifdef HAVE_LONG_DOUBLE
+ if (sizeof (value) == sizeof (long double)
+ && HOST_LONG_DOUBLE_FORMAT == &floatformat_i387_ext)
+ {
+ /* Copy straight over, but take care of the padding. */
+ memcpy (&value, raw, FPU_REG_RAW_SIZE);
+ memset (&value + FPU_REG_RAW_SIZE, 0, sizeof (value) - FPU_REG_RAW_SIZE);
+ }
+ else
+#endif
+ floatformat_to_doublest (&floatformat_i387_ext, raw, &value);
/* We try to print 19 digits. The last digit may or may not contain
garbage, but we'd better print one too many. We need enough room