diff options
author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2017-11-06 15:56:35 +0100 |
---|---|---|
committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2017-11-06 15:56:35 +0100 |
commit | f69fdf9bca80ac703890a51e124e408cbccbb743 (patch) | |
tree | f760113a7673920b807b0871000c40d27dde0604 /gdb/mips-tdep.c | |
parent | 701000146a01f1966c59f50d7b638915917b6378 (diff) | |
download | gdb-f69fdf9bca80ac703890a51e124e408cbccbb743.zip gdb-f69fdf9bca80ac703890a51e124e408cbccbb743.tar.gz gdb-f69fdf9bca80ac703890a51e124e408cbccbb743.tar.bz2 |
Target FP: Add string routines to target-float.{c,h}
This adds target_float_to_string and target_float_from_string,
which dispatch to the corresponding floatformat_ or decimal_ routines.
Existing users of those routines are changed to use the new
target-float routines instead (most of those places already handle
both binary and decimal FP).
In addition, two other places are changes to use target_float_from_string:
- define_symbol in stabsread.c, when parsing a floating-point literal
from stabs debug info
- gdbarch-selftest.c when initializing a target format values (to
eliminate use of DOUBLEST there).
gdb/ChangeLog:
2017-11-06 Ulrich Weigand <uweigand@de.ibm.com>
* target-float.c (target_float_to_string): New function.
(target_float_from_string): New function.
* target-float.h (target_float_to_string): Add prototype.
(target_float_from_string): Add prototype.
* valprint.c: Include "target-float.h". Do not include
"doublest.h" and "dfp.h".
(print_floating): Use target_float_to_string.
* printcmd.c: Include "target-float.h". Do not include "dfp.h".
(printf_floating): Use target_float_to_string.
* i387-tdep.c: Include "target-float.h". Do not include "doublest.h".
(print_i387_value): Use target_float_to_string.
* mips-tdep.c: Include "target-float.h".
(mips_print_fp_register): Use target_float_to_string.
* sh64-tdep.c: Include "target-float.h".
(sh64_do_fp_register): Use target_float_to_string.
* parse.c: Include "target-float.h". Do not include
"doublest.h" and "dfp.h".
(parse_float): Use target_float_from_string.
* stabsread.c: Include "target-float.h". Do not include "doublest.h".
(define_symbol): Use target_float_from_string.
* gdbarch-selftests.c: Include "target-float.h".
(register_to_value_test): Use target_float_from_string.
Diffstat (limited to 'gdb/mips-tdep.c')
-rw-r--r-- | gdb/mips-tdep.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 20bd5d3..039b541 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -55,6 +55,7 @@ #include "user-regs.h" #include "valprint.h" #include "ax.h" +#include "target-float.h" #include <algorithm> static const struct objfile_data *mips_pdr_data; @@ -6258,10 +6259,8 @@ mips_print_fp_register (struct ui_file *file, struct frame_info *frame, gdb_byte *raw_buffer; std::string flt_str, dbl_str; - const struct floatformat *flt_fmt - = floatformat_from_type (builtin_type (gdbarch)->builtin_float); - const struct floatformat *dbl_fmt - = floatformat_from_type (builtin_type (gdbarch)->builtin_double); + const struct type *flt_type = builtin_type (gdbarch)->builtin_float; + const struct type *dbl_type = builtin_type (gdbarch)->builtin_double; raw_buffer = ((gdb_byte *) @@ -6279,7 +6278,7 @@ mips_print_fp_register (struct ui_file *file, struct frame_info *frame, /* 4-byte registers: Print hex and floating. Also print even numbered registers as doubles. */ mips_read_fp_register_single (frame, regnum, raw_buffer); - flt_str = floatformat_to_string (flt_fmt, raw_buffer, "%-17.9g"); + flt_str = target_float_to_string (raw_buffer, flt_type, "%-17.9g"); get_formatted_print_options (&opts, 'x'); print_scalar_formatted (raw_buffer, @@ -6291,7 +6290,7 @@ mips_print_fp_register (struct ui_file *file, struct frame_info *frame, if ((regnum - gdbarch_num_regs (gdbarch)) % 2 == 0) { mips_read_fp_register_double (frame, regnum, raw_buffer); - dbl_str = floatformat_to_string (dbl_fmt, raw_buffer, "%-24.17g"); + dbl_str = target_float_to_string (raw_buffer, dbl_type, "%-24.17g"); fprintf_filtered (file, " dbl: %s", dbl_str.c_str ()); } @@ -6302,10 +6301,10 @@ mips_print_fp_register (struct ui_file *file, struct frame_info *frame, /* Eight byte registers: print each one as hex, float and double. */ mips_read_fp_register_single (frame, regnum, raw_buffer); - flt_str = floatformat_to_string (flt_fmt, raw_buffer, "%-17.9g"); + flt_str = target_float_to_string (raw_buffer, flt_type, "%-17.9g"); mips_read_fp_register_double (frame, regnum, raw_buffer); - dbl_str = floatformat_to_string (dbl_fmt, raw_buffer, "%-24.17g"); + dbl_str = target_float_to_string (raw_buffer, dbl_type, "%-24.17g"); get_formatted_print_options (&opts, 'x'); print_scalar_formatted (raw_buffer, |