From c2f05ac92e7fe9e3161ae09ea3f9e0937af42abc Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Sun, 20 Jan 2002 18:05:54 +0000 Subject: Eliminate IEEE_FLOAT. --- gdb/valprint.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'gdb/valprint.c') diff --git a/gdb/valprint.c b/gdb/valprint.c index 45acdc7..84cd272 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -548,21 +548,9 @@ print_floating (char *valaddr, struct type *type, struct ui_file *stream) { DOUBLEST doub; int inv; - const struct floatformat *fmt = &floatformat_unknown; + const struct floatformat *fmt = floatformat_from_type (type); unsigned len = TYPE_LENGTH (type); - /* FIXME: kettenis/2001-01-20: The check for IEEE_FLOAT is probably - still necessary since GDB by default assumes that the target uses - the IEEE 754 representation for its floats and doubles. Of - course this is all crock and should be cleaned up. */ - - if (len == TARGET_FLOAT_BIT / TARGET_CHAR_BIT && IEEE_FLOAT) - fmt = TARGET_FLOAT_FORMAT; - else if (len == TARGET_DOUBLE_BIT / TARGET_CHAR_BIT && IEEE_FLOAT) - fmt = TARGET_DOUBLE_FORMAT; - else if (len == TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT) - fmt = TARGET_LONG_DOUBLE_FORMAT; - if (floatformat_is_nan (fmt, valaddr)) { if (floatformat_is_negative (fmt, valaddr)) @@ -575,6 +563,13 @@ print_floating (char *valaddr, struct type *type, struct ui_file *stream) return; } + /* FIXME: cagney/2002-01-15: The simpler extract_typed_floating() + routine could be used here only that routine has no way of + indicating that the floating point it extracted was invalid (As + indicated by INVALID_FLOAT). Instead, this code here could call + something like floating_invalid() to check for an invalid + floating point. */ + doub = unpack_double (type, valaddr, &inv); if (inv) { @@ -585,6 +580,10 @@ print_floating (char *valaddr, struct type *type, struct ui_file *stream) /* FIXME: kettenis/2001-01-20: The following code makes too much assumptions about the host and target floating point format. */ + /* FIXME: cagney/2002-01-15: The floatformat pointed to by FMT + should contain all the information needed to print the + floating-point value without host dependencies. */ + if (len < sizeof (double)) fprintf_filtered (stream, "%.9g", (double) doub); else if (len == sizeof (double)) -- cgit v1.1