diff options
author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2017-10-24 18:01:39 +0200 |
---|---|---|
committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2017-10-24 18:01:39 +0200 |
commit | 8ba0dd515c1ba23318f28c6bb04c9da573855b50 (patch) | |
tree | af57478382ceb88d7d664f38efcfbd72994d0e71 /gdb/sh64-tdep.c | |
parent | 16e812b29e68c4a6fcad73b033716c4f385ce94f (diff) | |
download | gdb-8ba0dd515c1ba23318f28c6bb04c9da573855b50.zip gdb-8ba0dd515c1ba23318f28c6bb04c9da573855b50.tar.gz gdb-8ba0dd515c1ba23318f28c6bb04c9da573855b50.tar.bz2 |
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/sh64-tdep.c')
-rw-r--r-- | gdb/sh64-tdep.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c index 586490b..ac21623 100644 --- a/gdb/sh64-tdep.c +++ b/gdb/sh64-tdep.c @@ -1915,8 +1915,6 @@ sh64_do_fp_register (struct gdbarch *gdbarch, struct ui_file *file, struct frame_info *frame, int regnum) { /* Do values for FP (float) regs. */ unsigned char *raw_buffer; - double flt; /* Double extracted from raw hex data. */ - int inv; /* Allocate space for the float. */ raw_buffer = (unsigned char *) @@ -1927,20 +1925,16 @@ sh64_do_fp_register (struct gdbarch *gdbarch, struct ui_file *file, error (_("can't read register %d (%s)"), regnum, gdbarch_register_name (gdbarch, regnum)); - /* Get the register as a number. */ - flt = unpack_double (builtin_type (gdbarch)->builtin_float, - raw_buffer, &inv); - /* Print the name and some spaces. */ fputs_filtered (gdbarch_register_name (gdbarch, regnum), file); print_spaces_filtered (15 - strlen (gdbarch_register_name (gdbarch, regnum)), file); /* Print the value. */ - if (inv) - fprintf_filtered (file, "<invalid float>"); - else - fprintf_filtered (file, "%-10.9g", flt); + const struct floatformat *fmt + = floatformat_from_type (builtin_type (gdbarch)->builtin_float); + std::string str = floatformat_to_string (fmt, raw_buffer, "%-10.9g"); + fprintf_filtered (file, "%s", str.c_str ()); /* Print the fp register as hex. */ fprintf_filtered (file, "\t(raw "); |