aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2001-10-28 14:07:35 +0000
committerMark Kettenis <kettenis@gnu.org>2001-10-28 14:07:35 +0000
commit4583280ca5c253f8d32b7c397ab10099c049073c (patch)
treeb1d75008af90ec844df2dc26354ab35428b74144
parente371b258f8fd8a710d01cf7528e707f6e2621ca0 (diff)
downloadfsf-binutils-gdb-4583280ca5c253f8d32b7c397ab10099c049073c.zip
fsf-binutils-gdb-4583280ca5c253f8d32b7c397ab10099c049073c.tar.gz
fsf-binutils-gdb-4583280ca5c253f8d32b7c397ab10099c049073c.tar.bz2
* i387-tdep.c (print_i387_value): Use extract_typed_floating to
convert RAW to a DOUBLEST instead of extract_floating.
-rw-r--r--gdb/ChangeLog3
-rw-r--r--gdb/i387-tdep.c23
2 files changed, 8 insertions, 18 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 87761f7..fad9d4a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,8 @@
2001-10-28 Mark Kettenis <kettenis@gnu.org>
+ * i387-tdep.c (print_i387_value): Use extract_typed_floating to
+ convert RAW to a DOUBLEST instead of extract_floating.
+
* gdbtypes.c (_initialize_gdbtypes): Set floating-point type for
builtin_type_i387_ext to floatformat_i387_ext.
diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
index 5842c00..bb69b80 100644
--- a/gdb/i387-tdep.c
+++ b/gdb/i387-tdep.c
@@ -165,25 +165,12 @@ static void
print_i387_value (char *raw)
{
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);
+ /* Using extract_typed_floating here might affect the representation
+ of certain numbers such as NaNs, even if GDB is running natively.
+ This is fine since our caller already detects such special
+ numbers and we print the hexadecimal representation anyway. */
+ value = extract_typed_floating (raw, builtin_type_i387_ext);
/* 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