summaryrefslogtreecommitdiff
path: root/gdb/i387-tdep.c
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2017-10-24 18:01:39 +0200
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2017-10-24 18:01:39 +0200
commit8ba0dd515c1ba23318f28c6bb04c9da573855b50 (patch)
treeaf57478382ceb88d7d664f38efcfbd72994d0e71 /gdb/i387-tdep.c
parent16e812b29e68c4a6fcad73b033716c4f385ce94f (diff)
downloadbinutils-gdb-8ba0dd515c1ba23318f28c6bb04c9da573855b50.tar.gz
Target FP printing: Use floatformat_to_string in tdep code
A few tdep files use target-specific printing routines to output values in the floating-point registers. To get rid of host floating-point code, this patch changes them to use floatformat_to_string instead. No functional change intended, the resulting output should look the same. ChangeLog: 2017-10-24 Ulrich Weigand <uweigand@de.ibm.com> * i387-tdep.c (print_i387_value): Use floatformat_to_string. * sh64-tdep.c (sh64_do_fp_register): Likewise. * mips-tdep.c (mips_print_fp_register): Likewise.
Diffstat (limited to 'gdb/i387-tdep.c')
-rw-r--r--gdb/i387-tdep.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
index 3de7c62f4a0..85c969aaff6 100644
--- a/gdb/i387-tdep.c
+++ b/gdb/i387-tdep.c
@@ -36,23 +36,14 @@ static void
print_i387_value (struct gdbarch *gdbarch,
const gdb_byte *raw, struct ui_file *file)
{
- DOUBLEST value;
-
- /* Using extract_typed_floating here might affect the representation
- of certain numbers such as NaNs, even if GDB is running natively.
- This is fine since our caller already detects such special
- numbers and we print the hexadecimal representation anyway. */
- value = extract_typed_floating (raw, i387_ext_type (gdbarch));
-
/* We try to print 19 digits. The last digit may or may not contain
garbage, but we'd better print one too many. We need enough room
to print the value, 1 position for the sign, 1 for the decimal
point, 19 for the digits and 6 for the exponent adds up to 27. */
-#ifdef PRINTF_HAS_LONG_DOUBLE
- fprintf_filtered (file, " %-+27.19Lg", (long double) value);
-#else
- fprintf_filtered (file, " %-+27.19g", (double) value);
-#endif
+ const struct floatformat *fmt
+ = floatformat_from_type (i387_ext_type (gdbarch));
+ std::string str = floatformat_to_string (fmt, raw, " %-+27.19g");
+ fprintf_filtered (file, "%s", str.c_str ());
}
/* Print the classification for the register contents RAW. */