* i387-tdep.c: Include "gdb_assert.h".
(print_i387_value): Use extract_floating to extract the FP value from a zero padded local buffer.
This commit is contained in:
parent
291903b139
commit
d0df847233
|
@ -1,3 +1,9 @@
|
||||||
|
2001-06-29 Andrew Cagney <ac131313@redhat.com>
|
||||||
|
|
||||||
|
* i387-tdep.c: Include "gdb_assert.h".
|
||||||
|
(print_i387_value): Use extract_floating to extract the FP value
|
||||||
|
from a zero padded local buffer.
|
||||||
|
|
||||||
2001-06-28 Andrew Cagney <ac131313@redhat.com>
|
2001-06-28 Andrew Cagney <ac131313@redhat.com>
|
||||||
|
|
||||||
* TODO: Delete all thread items. The thread code was overhauled.
|
* TODO: Delete all thread items. The thread code was overhauled.
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "gdbcore.h"
|
#include "gdbcore.h"
|
||||||
#include "floatformat.h"
|
#include "floatformat.h"
|
||||||
#include "regcache.h"
|
#include "regcache.h"
|
||||||
|
#include "gdb_assert.h"
|
||||||
|
|
||||||
|
|
||||||
/* FIXME: Eliminate the next two functions when we have the time to
|
/* FIXME: Eliminate the next two functions when we have the time to
|
||||||
|
@ -160,22 +161,25 @@ static void
|
||||||
print_i387_value (char *raw)
|
print_i387_value (char *raw)
|
||||||
{
|
{
|
||||||
DOUBLEST value;
|
DOUBLEST value;
|
||||||
|
int len = TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT;
|
||||||
|
char *tmp = alloca (len);
|
||||||
|
|
||||||
/* Avoid call to floatformat_to_doublest if possible to preserve as
|
/* This code only works on targets where ... */
|
||||||
much information as possible. */
|
gdb_assert (TARGET_LONG_DOUBLE_FORMAT == &floatformat_i387_ext);
|
||||||
|
|
||||||
#ifdef HAVE_LONG_DOUBLE
|
/* Take care of the padding. FP reg is 80 bits. The same value in
|
||||||
if (sizeof (value) == sizeof (long double)
|
memory is 96 bits. */
|
||||||
&& HOST_LONG_DOUBLE_FORMAT == &floatformat_i387_ext)
|
gdb_assert (FPU_REG_RAW_SIZE < len);
|
||||||
{
|
memcpy (&tmp, raw, FPU_REG_RAW_SIZE);
|
||||||
/* Copy straight over, but take care of the padding. */
|
memset (&tmp + FPU_REG_RAW_SIZE, 0, len - FPU_REG_RAW_SIZE);
|
||||||
memcpy (&value, raw, FPU_REG_RAW_SIZE);
|
|
||||||
memset ((char *) &value + FPU_REG_RAW_SIZE, 0,
|
/* Extract the value as a DOUBLEST. */
|
||||||
sizeof (value) - FPU_REG_RAW_SIZE);
|
/* Use extract_floating() rather than floatformat_to_doublest().
|
||||||
}
|
The latter is lossy in nature. Once GDB gets a host/target
|
||||||
else
|
independent and non-lossy FP it will become possible to bypass
|
||||||
#endif
|
extract_floating() and call floatformat*() directly. Note also
|
||||||
floatformat_to_doublest (&floatformat_i387_ext, raw, &value);
|
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
|
/* 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
|
garbage, but we'd better print one too many. We need enough room
|
||||||
|
|
Loading…
Reference in New Issue