diff options
author | Jim Blandy <jimb@codesourcery.com> | 2000-04-14 19:14:19 +0000 |
---|---|---|
committer | Jim Blandy <jimb@codesourcery.com> | 2000-04-14 19:14:19 +0000 |
commit | 7355ddbacef086a00575d289049611428fbf8087 (patch) | |
tree | 1bb11c0265fb71578fcf8ccb59331ecb4937999d /gdb/valprint.c | |
parent | 16c088d03772776d9305b5e3f447f6600727c4b8 (diff) | |
download | gdb-7355ddbacef086a00575d289049611428fbf8087.zip gdb-7355ddbacef086a00575d289049611428fbf8087.tar.gz gdb-7355ddbacef086a00575d289049611428fbf8087.tar.bz2 |
Bring IEEE_FLOAT under gdbarch's control.
* gdbarch.sh (IEEE_FLOAT): New entry.
* gdbarch.c, gdbarch.h: Regenerated.
* valprint.c (IEEE_FLOAT): Provide a default #definition for this.
(print_floating): Use IEEE_FLOAT as if it were an expression; use
the code specific to IEEE-format numbers whenever the value of
IEEE_FLOAT is non-zero.
* config/a29k/tm-a29k.h, config/alpha/tm-alpha.h,
config/arc/tm-arc.h, config/arm/tm-arm.h, config/fr30/tm-fr30.h,
config/h8300/tm-h8300.h, config/i386/tm-i386.h,
config/i960/tm-i960.h, config/m88k/tm-m88k.h,
config/mips/tm-mips.h, config/pa/tm-hppa.h,
config/sparc/tm-sparc.h, config/delta/tm-delta.h,
config/frv/tm-frv.h (IEEE_FLOAT): For all ports that #define
IEEE_FLOAT, make sure they give it the value (1).
Diffstat (limited to 'gdb/valprint.c')
-rw-r--r-- | gdb/valprint.c | 144 |
1 files changed, 74 insertions, 70 deletions
diff --git a/gdb/valprint.c b/gdb/valprint.c index e141479..455d7ee 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -561,6 +561,13 @@ longest_to_int (arg) return (rtnval); } + +/* Provide a default value for IEEE_FLOAT. */ +#ifndef IEEE_FLOAT +#define IEEE_FLOAT (0) +#endif + + /* Print a floating point value of type TYPE, pointed to in GDB by VALADDR, on STREAM. */ @@ -574,85 +581,82 @@ print_floating (valaddr, type, stream) int inv; unsigned len = TYPE_LENGTH (type); -#if defined (IEEE_FLOAT) - /* Check for NaN's. Note that this code does not depend on us being on an IEEE conforming system. It only depends on the target machine using IEEE representation. This means (a) cross-debugging works right, and (2) IEEE_FLOAT can (and should) - be defined for systems like the 68881, which uses IEEE + be non-zero for systems like the 68881, which uses IEEE representation, but is not IEEE conforming. */ + if (IEEE_FLOAT) + { + unsigned long low, high; + /* Is the sign bit 0? */ + int nonnegative; + /* Is it is a NaN (i.e. the exponent is all ones and + the fraction is nonzero)? */ + int is_nan; + + /* For lint, initialize these two variables to suppress warning: */ + low = high = nonnegative = 0; + if (len == 4) + { + /* It's single precision. */ + /* Assume that floating point byte order is the same as + integer byte order. */ + low = extract_unsigned_integer (valaddr, 4); + nonnegative = ((low & 0x80000000) == 0); + is_nan = ((((low >> 23) & 0xFF) == 0xFF) + && 0 != (low & 0x7FFFFF)); + low &= 0x7fffff; + high = 0; + } + else if (len == 8) + { + /* It's double precision. Get the high and low words. */ - { - unsigned long low, high; - /* Is the sign bit 0? */ - int nonnegative; - /* Is it is a NaN (i.e. the exponent is all ones and - the fraction is nonzero)? */ - int is_nan; - - /* For lint, initialize these two variables to suppress warning: */ - low = high = nonnegative = 0; - if (len == 4) - { - /* It's single precision. */ - /* Assume that floating point byte order is the same as - integer byte order. */ - low = extract_unsigned_integer (valaddr, 4); - nonnegative = ((low & 0x80000000) == 0); - is_nan = ((((low >> 23) & 0xFF) == 0xFF) - && 0 != (low & 0x7FFFFF)); - low &= 0x7fffff; - high = 0; - } - else if (len == 8) - { - /* It's double precision. Get the high and low words. */ - - /* Assume that floating point byte order is the same as - integer byte order. */ - if (TARGET_BYTE_ORDER == BIG_ENDIAN) - { - low = extract_unsigned_integer (valaddr + 4, 4); - high = extract_unsigned_integer (valaddr, 4); - } - else - { - low = extract_unsigned_integer (valaddr, 4); - high = extract_unsigned_integer (valaddr + 4, 4); - } - nonnegative = ((high & 0x80000000) == 0); - is_nan = (((high >> 20) & 0x7ff) == 0x7ff - && !((((high & 0xfffff) == 0)) && (low == 0))); - high &= 0xfffff; - } - else - { + /* Assume that floating point byte order is the same as + integer byte order. */ + if (TARGET_BYTE_ORDER == BIG_ENDIAN) + { + low = extract_unsigned_integer (valaddr + 4, 4); + high = extract_unsigned_integer (valaddr, 4); + } + else + { + low = extract_unsigned_integer (valaddr, 4); + high = extract_unsigned_integer (valaddr + 4, 4); + } + nonnegative = ((high & 0x80000000) == 0); + is_nan = (((high >> 20) & 0x7ff) == 0x7ff + && !((((high & 0xfffff) == 0)) && (low == 0))); + high &= 0xfffff; + } + else + { #ifdef TARGET_ANALYZE_FLOATING - TARGET_ANALYZE_FLOATING; + TARGET_ANALYZE_FLOATING; #else - /* Extended. We can't detect extended NaNs for this target. - Also note that currently extendeds get nuked to double in - REGISTER_CONVERTIBLE. */ - is_nan = 0; + /* Extended. We can't detect extended NaNs for this target. + Also note that currently extendeds get nuked to double in + REGISTER_CONVERTIBLE. */ + is_nan = 0; #endif - } - - if (is_nan) - { - /* The meaning of the sign and fraction is not defined by IEEE. - But the user might know what they mean. For example, they - (in an implementation-defined manner) distinguish between - signaling and quiet NaN's. */ - if (high) - fprintf_filtered (stream, "-NaN(0x%lx%.8lx)" + !!nonnegative, - high, low); - else - fprintf_filtered (stream, "-NaN(0x%lx)" + nonnegative, low); - return; - } - } -#endif /* IEEE_FLOAT. */ + } + + if (is_nan) + { + /* The meaning of the sign and fraction is not defined by IEEE. + But the user might know what they mean. For example, they + (in an implementation-defined manner) distinguish between + signaling and quiet NaN's. */ + if (high) + fprintf_filtered (stream, "-NaN(0x%lx%.8lx)" + !!nonnegative, + high, low); + else + fprintf_filtered (stream, "-NaN(0x%lx)" + nonnegative, low); + return; + } + } doub = unpack_double (type, valaddr, &inv); if (inv) |