diff options
author | Mark Kettenis <kettenis@gnu.org> | 2000-04-12 00:22:56 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@gnu.org> | 2000-04-12 00:22:56 +0000 |
commit | 1d77867f997863c81debc79e048b0abffe2fe646 (patch) | |
tree | 14b14b5d612fcb84d376d9856516ed4d29c0f9ca /gdb/i387-tdep.c | |
parent | 7df5277ad68206c9102d43427639ae6328d033f9 (diff) | |
download | gdb-1d77867f997863c81debc79e048b0abffe2fe646.zip gdb-1d77867f997863c81debc79e048b0abffe2fe646.tar.gz gdb-1d77867f997863c81debc79e048b0abffe2fe646.tar.bz2 |
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.
Diffstat (limited to 'gdb/i387-tdep.c')
-rw-r--r-- | gdb/i387-tdep.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c index 20e446d..f887da9 100644 --- a/gdb/i387-tdep.c +++ b/gdb/i387-tdep.c @@ -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 |