diff options
author | Andrew Cagney <cagney@redhat.com> | 2004-08-07 18:12:46 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2004-08-07 18:12:46 +0000 |
commit | 74e063bc30a58ab7faff6e2d6be199479e988611 (patch) | |
tree | 07a17db056a759d2fde57aad56dd47bbcf2d2a14 | |
parent | a937bda067483ff493efb7dc257a1e6088e20071 (diff) | |
download | gdb-74e063bc30a58ab7faff6e2d6be199479e988611.zip gdb-74e063bc30a58ab7faff6e2d6be199479e988611.tar.gz gdb-74e063bc30a58ab7faff6e2d6be199479e988611.tar.bz2 |
2004-08-07 Andrew Cagney <cagney@gnu.org>
* doublest.c: Update copyright.
(floatformat_from_length): Call error when floatformat is NULL.
(extract_floating_by_length): Remove NULL fmt check.
(store_floating_by_length): Ditto.
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/doublest.c | 38 |
2 files changed, 22 insertions, 23 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 97e8e19..d6701d2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2004-08-07 Andrew Cagney <cagney@gnu.org> + + * doublest.c: Update copyright. + (floatformat_from_length): Call error when floatformat is NULL. + (extract_floating_by_length): Remove NULL fmt check. + (store_floating_by_length): Ditto. + 2004-07-29 Andrew Cagney <cagney@gnu.org> * version.in: Bump to version 6.2. diff --git a/gdb/doublest.c b/gdb/doublest.c index 3f283e1..75076b9 100644 --- a/gdb/doublest.c +++ b/gdb/doublest.c @@ -1,8 +1,8 @@ /* Floating point routines for GDB, the GNU debugger. Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, - 1996, 1997, 1998, 1999, 2000, 2001, 2003 Free Software Foundation, - Inc. + 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software + Foundation, Inc. This file is part of GDB. @@ -621,8 +621,8 @@ floatformat_from_doublest (const struct floatformat *fmt, /* Return a floating-point format for a floating-point variable of - length LEN. Return NULL, if no suitable floating-point format - could be found. + length LEN. If no suitable floating-point format is found, an + error is thrown. We need this functionality since information about the floating-point format of a type is not always available to GDB; the @@ -636,12 +636,13 @@ floatformat_from_doublest (const struct floatformat *fmt, static const struct floatformat * floatformat_from_length (int len) { + const struct floatformat *format; if (len * TARGET_CHAR_BIT == TARGET_FLOAT_BIT) - return TARGET_FLOAT_FORMAT; + format = TARGET_FLOAT_FORMAT; else if (len * TARGET_CHAR_BIT == TARGET_DOUBLE_BIT) - return TARGET_DOUBLE_FORMAT; + format = TARGET_DOUBLE_FORMAT; else if (len * TARGET_CHAR_BIT == TARGET_LONG_DOUBLE_BIT) - return TARGET_LONG_DOUBLE_FORMAT; + format = TARGET_LONG_DOUBLE_FORMAT; /* On i386 the 'long double' type takes 96 bits, while the real number of used bits is only 80, both in processor and in memory. @@ -649,9 +650,13 @@ floatformat_from_length (int len) else if ((TARGET_LONG_DOUBLE_FORMAT != NULL) && (len * TARGET_CHAR_BIT == TARGET_LONG_DOUBLE_FORMAT->totalsize)) - return TARGET_LONG_DOUBLE_FORMAT; - - return NULL; + format = TARGET_LONG_DOUBLE_FORMAT; + else + format = NULL; + if (format == NULL) + error ("Unrecognized %d-bit floating-point type.", + len & TARGET_CHAR_BIT); + return format; } const struct floatformat * @@ -678,12 +683,6 @@ extract_floating_by_length (const void *addr, int len) const struct floatformat *fmt = floatformat_from_length (len); DOUBLEST val; - if (fmt == NULL) - { - warning ("Can't extract a floating-point number of %d bytes.", len); - return NAN; - } - floatformat_to_doublest (fmt, addr, &val); return val; } @@ -702,13 +701,6 @@ store_floating_by_length (void *addr, int len, DOUBLEST val) { const struct floatformat *fmt = floatformat_from_length (len); - if (fmt == NULL) - { - warning ("Can't store a floating-point number of %d bytes.", len); - memset (addr, 0, len); - return; - } - floatformat_from_doublest (fmt, &val, addr); } |