aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2013-08-20 06:42:19 +0000
committerAlan Modra <amodra@gmail.com>2013-08-20 06:42:19 +0000
commitf5aee5eeb88a99a8fb9d2b57971b0bda035ebc65 (patch)
tree13bc1053aee6ec1d6f13a8d675ddb87515e85b13
parent21290977cbdd41c6f4e7b297e63901ad491acadd (diff)
downloadgdb-f5aee5eeb88a99a8fb9d2b57971b0bda035ebc65.zip
gdb-f5aee5eeb88a99a8fb9d2b57971b0bda035ebc65.tar.gz
gdb-f5aee5eeb88a99a8fb9d2b57971b0bda035ebc65.tar.bz2
* doublest.c (convert_floatformat_to_doublest): Use fmt->split_half
for IBM long double nan and inf. (floatformat_is_negative, floatformat_classify, floatformat_mantissa): Similarly. (floatformat_ieee_single, floatformat_ieee_double, floatformat_ieee_quad, floatformat_arm_ext, floatformat_ia64_spill): Delete unused vars. (_initialize_doublest): Delete unused function. * gdbtypes.c (floatformats_ibm_long_double): Use new big- and little-endian variants of floatformat_ibm_long_double.
-rw-r--r--gdb/ChangeLog29
-rw-r--r--gdb/doublest.c49
-rw-r--r--gdb/gdbtypes.c4
3 files changed, 47 insertions, 35 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 06e25da..f22a1b4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,18 @@
+2013-08-20 Alan Modra <amodra@gmail.com>
+
+ * doublest.c (convert_floatformat_to_doublest): Use fmt->split_half
+ for IBM long double nan and inf.
+ (floatformat_is_negative, floatformat_classify,
+ floatformat_mantissa): Similarly.
+ (floatformat_ieee_single, floatformat_ieee_double,
+ floatformat_ieee_quad, floatformat_arm_ext,
+ floatformat_ia64_spill): Delete unused vars.
+ (_initialize_doublest): Delete unused function.
+ * gdbtypes.c (floatformats_ibm_long_double): Use new big- and
+ little-endian variants of floatformat_ibm_long_double.
+
2013-08-19 Luis Machado <lgustavo@codesourcery.com>
-
+
* Makefile.in (SFILES): Remove common/target-common.c and
add target/waitstatus.c.
(HFILES_NO_SRCDIR): Remove common/target-common.h and add
@@ -2752,10 +2765,10 @@
2013-05-20 Tom Tromey <tromey@redhat.com>
- * python/py-event.h (evpy_emit_event): Use
- CPYCHECKER_STEALS_REFERENCE_TO_ARG.
- * python/python-internal.h (CPYCHECKER_STEALS_REFERENCE_TO_ARG):
- New macro.
+ * python/py-event.h (evpy_emit_event): Use
+ CPYCHECKER_STEALS_REFERENCE_TO_ARG.
+ * python/python-internal.h (CPYCHECKER_STEALS_REFERENCE_TO_ARG):
+ New macro.
2013-05-20 Tom Tromey <tromey@redhat.com>
@@ -3042,7 +3055,7 @@
2013-05-13 Tom Tromey <tromey@redhat.com>
- PR gdb/15338:
+ PR gdb/15338:
* dwarf2read.c (dwarf2_record_block_ranges): Ensure that the
ranges section has been read.
@@ -4897,7 +4910,7 @@
2013-04-01 Jiong Wang <jiwang@tilera.com>
* NEWS: Mention TILE-Gx in "New native configurations" and
- "New targets" sections.
+ "New targets" sections.
2013-04-01 Doug Evans <dje@google.com>
@@ -6769,7 +6782,7 @@
* v850-tdep.c: (v850e2_register_name): Revise system register
names to match current V850E2M architecture specifications.
Update register number enum comments too.
-
+
2013-03-01 Jiong Wang <jiwang@tilera.com>
Pedro Alves <palves@redhat.com>
diff --git a/gdb/doublest.c b/gdb/doublest.c
index 2e4c87e..85890b1 100644
--- a/gdb/doublest.c
+++ b/gdb/doublest.c
@@ -190,7 +190,8 @@ convert_floatformat_to_doublest (const struct floatformat *fmt,
{
double dto;
- floatformat_to_double (fmt, from, &dto);
+ floatformat_to_double (fmt->split_half ? fmt->split_half : fmt,
+ from, &dto);
*to = (DOUBLEST) dto;
return;
}
@@ -514,6 +515,11 @@ floatformat_is_negative (const struct floatformat *fmt,
gdb_assert (fmt->totalsize
<= FLOATFORMAT_LARGEST_BYTES * FLOATFORMAT_CHAR_BIT);
+ /* An IBM long double (a two element array of double) always takes the
+ sign of the first double. */
+ if (fmt->split_half)
+ fmt = fmt->split_half;
+
order = floatformat_normalize_byteorder (fmt, uval, newfrom);
if (order != fmt->byteorder)
@@ -540,6 +546,13 @@ floatformat_classify (const struct floatformat *fmt,
gdb_assert (fmt->totalsize
<= FLOATFORMAT_LARGEST_BYTES * FLOATFORMAT_CHAR_BIT);
+ /* An IBM long double (a two element array of double) can be classified
+ by looking at the first double. inf and nan are specified as
+ ignoring the second double. zero and subnormal will always have
+ the second double 0.0 if the long double is correctly rounded. */
+ if (fmt->split_half)
+ fmt = fmt->split_half;
+
order = floatformat_normalize_byteorder (fmt, uval, newfrom);
if (order != fmt->byteorder)
@@ -622,6 +635,16 @@ floatformat_mantissa (const struct floatformat *fmt,
gdb_assert (fmt->totalsize
<= FLOATFORMAT_LARGEST_BYTES * FLOATFORMAT_CHAR_BIT);
+ /* For IBM long double (a two element array of double), return the
+ mantissa of the first double. The problem with returning the
+ actual mantissa from both doubles is that there can be an
+ arbitrary number of implied 0's or 1's between the mantissas
+ of the first and second double. In any case, this function
+ is only used for dumping out nans, and a nan is specified to
+ ignore the value in the second double. */
+ if (fmt->split_half)
+ fmt = fmt->split_half;
+
order = floatformat_normalize_byteorder (fmt, uval, newfrom);
if (order != fmt->byteorder)
@@ -879,27 +902,3 @@ convert_typed_floating (const void *from, const struct type *from_type,
floatformat_from_doublest (to_fmt, &d, to);
}
}
-
-const struct floatformat *floatformat_ieee_single[BFD_ENDIAN_UNKNOWN];
-const struct floatformat *floatformat_ieee_double[BFD_ENDIAN_UNKNOWN];
-const struct floatformat *floatformat_ieee_quad[BFD_ENDIAN_UNKNOWN];
-const struct floatformat *floatformat_arm_ext[BFD_ENDIAN_UNKNOWN];
-const struct floatformat *floatformat_ia64_spill[BFD_ENDIAN_UNKNOWN];
-
-extern void _initialize_doublest (void);
-
-extern void
-_initialize_doublest (void)
-{
- floatformat_ieee_single[BFD_ENDIAN_LITTLE] = &floatformat_ieee_single_little;
- floatformat_ieee_single[BFD_ENDIAN_BIG] = &floatformat_ieee_single_big;
- floatformat_ieee_double[BFD_ENDIAN_LITTLE] = &floatformat_ieee_double_little;
- floatformat_ieee_double[BFD_ENDIAN_BIG] = &floatformat_ieee_double_big;
- floatformat_arm_ext[BFD_ENDIAN_LITTLE]
- = &floatformat_arm_ext_littlebyte_bigword;
- floatformat_arm_ext[BFD_ENDIAN_BIG] = &floatformat_arm_ext_big;
- floatformat_ia64_spill[BFD_ENDIAN_LITTLE] = &floatformat_ia64_spill_little;
- floatformat_ia64_spill[BFD_ENDIAN_BIG] = &floatformat_ia64_spill_big;
- floatformat_ieee_quad[BFD_ENDIAN_LITTLE] = &floatformat_ia64_quad_little;
- floatformat_ieee_quad[BFD_ENDIAN_BIG] = &floatformat_ia64_quad_big;
-}
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index d19c593..dd2ef96 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -108,8 +108,8 @@ const struct floatformat *floatformats_vax_d[BFD_ENDIAN_UNKNOWN] = {
&floatformat_vax_d
};
const struct floatformat *floatformats_ibm_long_double[BFD_ENDIAN_UNKNOWN] = {
- &floatformat_ibm_long_double,
- &floatformat_ibm_long_double
+ &floatformat_ibm_long_double_big,
+ &floatformat_ibm_long_double_little
};
/* Should opaque types be resolved? */