From: Mark Kettenis Date: Wed, 12 Apr 2000 00:26:58 +0000 (+0000) Subject: 2000-04-12 Mark Kettenis X-Git-Tag: gdb_4_95_0-2000-04-27-snapshot~44 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d6de49f8df2cfd0664be225e1907d885bb65abb7;p=thirdparty%2Fbinutils-gdb.git 2000-04-12 Mark Kettenis * i387-tdep.c (print_i387_value): Avoid call to floatformat_to_doublest if long double type is the same on host and target. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 34fffe8c98a..5308205e9e2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2000-04-12 Mark Kettenis + + * i387-tdep.c (print_i387_value): Avoid call to + floatformat_to_doublest if long double type is the same on host + and target. + 2000-04-10 Fernando Nasser From 2000-04-10 Rodney Brown : diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c index 20e446d2ff4..f887da95b26 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