diff options
author | Daniel Jacobowitz <drow@false.org> | 2007-03-30 14:31:44 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2007-03-30 14:31:44 +0000 |
commit | 203890574da95d16f8c453491026d349be4b2721 (patch) | |
tree | 710bf3d3ba4bba96d041b36ee261296db68f66a4 /gdb/valprint.c | |
parent | 30b50213ec9759b035bc719efb13ef5e090ed7ef (diff) | |
download | gdb-203890574da95d16f8c453491026d349be4b2721.zip gdb-203890574da95d16f8c453491026d349be4b2721.tar.gz gdb-203890574da95d16f8c453491026d349be4b2721.tar.bz2 |
* doublest.c (convert_floatformat_to_doublest): Use
floatformat_classify.
(floatformat_is_nan): Rename to...
(floatformat_classify): ...this. Return more information.
* doublest.h (enum float_kind): New.
(floatformat_is_nan): Replace prototype...
(floatformat_classify): ...with this one.
* valprint.c (print_floating): Use floatformat_classify. Handle
infinity.
* gdb.base/infnan.c, gdb.base/infnan.exp: New files.
Diffstat (limited to 'gdb/valprint.c')
-rw-r--r-- | gdb/valprint.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/gdb/valprint.c b/gdb/valprint.c index c2663e1..ff6f5d6 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -442,19 +442,31 @@ print_floating (const gdb_byte *valaddr, struct type *type, int inv; const struct floatformat *fmt = NULL; unsigned len = TYPE_LENGTH (type); + enum float_kind kind; /* If it is a floating-point, check for obvious problems. */ if (TYPE_CODE (type) == TYPE_CODE_FLT) fmt = floatformat_from_type (type); - if (fmt != NULL && floatformat_is_nan (fmt, valaddr)) + if (fmt != NULL) { - if (floatformat_is_negative (fmt, valaddr)) - fprintf_filtered (stream, "-"); - fprintf_filtered (stream, "nan("); - fputs_filtered ("0x", stream); - fputs_filtered (floatformat_mantissa (fmt, valaddr), stream); - fprintf_filtered (stream, ")"); - return; + kind = floatformat_classify (fmt, valaddr); + if (kind == float_nan) + { + if (floatformat_is_negative (fmt, valaddr)) + fprintf_filtered (stream, "-"); + fprintf_filtered (stream, "nan("); + fputs_filtered ("0x", stream); + fputs_filtered (floatformat_mantissa (fmt, valaddr), stream); + fprintf_filtered (stream, ")"); + return; + } + else if (kind == float_infinite) + { + if (floatformat_is_negative (fmt, valaddr)) + fputs_filtered ("-", stream); + fputs_filtered ("inf", stream); + return; + } } /* NOTE: cagney/2002-01-15: The TYPE passed into print_floating() |