From b9a8e3bfd40ae4b14d2ff3a6d7f8704f5782eba8 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Tue, 22 Feb 2000 19:18:53 +0000 Subject: Bring COERCE_FLOAT_TO_DOUBLE under gdbarch's control. * valops.c (COERCE_FLOAT_TO_DOUBLE): Rework definition to be more function-like. (default_coerce_float_to_double, standard_coerce_float_to_double): New functions. (value_arg_coerce): Adjust for new definition. * value.h (default_coerce_float_to_double, standard_coerce_float_to_double): New declarations for the above. * gdbarch.sh (coerce_float_to_double): New entry, replacing macro. * gdbarch.c, gdbarch.h: Regenerated. * tm-alpha.h, tm-fr30.h, tm-m32r.h, tm-mips.h, tm-hppa.h, tm-rs6000.h, tm-sh.h, tm-sparc.h (COERCE_FLOAT_TO_DOUBLE): Change definitions. * mips-tdep.c (mips_coerce_float_to_double): Supply our own custom function here. (mips_gdbarch_init): Install that as our coerce_float_to_double function. --- gdb/gdbarch.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'gdb/gdbarch.c') diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index e9f5f44..f33536d 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -169,6 +169,7 @@ struct gdbarch gdbarch_fix_call_dummy_ftype *fix_call_dummy; int believe_pcc_promotion; int believe_pcc_promotion_type; + gdbarch_coerce_float_to_double_ftype *coerce_float_to_double; gdbarch_get_saved_register_ftype *get_saved_register; gdbarch_register_convertible_ftype *register_convertible; gdbarch_register_convert_to_virtual_ftype *register_convert_to_virtual; @@ -268,6 +269,7 @@ struct gdbarch default_gdbarch = { 0, 0, 0, + 0, generic_get_saved_register, 0, 0, @@ -343,6 +345,7 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->call_dummy_length = -1; gdbarch->call_dummy_p = -1; gdbarch->call_dummy_stack_adjust_p = -1; + gdbarch->coerce_float_to_double = default_coerce_float_to_double; gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint; gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint; gdbarch->decr_pc_after_break = -1; @@ -488,6 +491,9 @@ verify_gdbarch (struct gdbarch *gdbarch) if ((GDB_MULTI_ARCH >= 2) && (gdbarch->fix_call_dummy == 0)) internal_error ("gdbarch: verify_gdbarch: fix_call_dummy invalid"); + if ((GDB_MULTI_ARCH >= 2) + && (gdbarch->coerce_float_to_double == default_coerce_float_to_double)) + internal_error ("gdbarch: verify_gdbarch: coerce_float_to_double invalid"); if ((GDB_MULTI_ARCH >= 1) && (gdbarch->get_saved_register == 0)) internal_error ("gdbarch: verify_gdbarch: get_saved_register invalid"); @@ -770,6 +776,10 @@ gdbarch_dump (void) (long) BELIEVE_PCC_PROMOTION_TYPE); #endif fprintf_unfiltered (gdb_stdlog, + "gdbarch_update: COERCE_FLOAT_TO_DOUBLE = 0x%08lx\n", + (long) current_gdbarch->coerce_float_to_double + /*COERCE_FLOAT_TO_DOUBLE ()*/); + fprintf_unfiltered (gdb_stdlog, "gdbarch_update: GET_SAVED_REGISTER = 0x%08lx\n", (long) current_gdbarch->get_saved_register /*GET_SAVED_REGISTER ()*/); @@ -1732,6 +1742,24 @@ set_gdbarch_believe_pcc_promotion_type (struct gdbarch *gdbarch, gdbarch->believe_pcc_promotion_type = believe_pcc_promotion_type; } +int +gdbarch_coerce_float_to_double (struct gdbarch *gdbarch, struct type *formal, struct type *actual) +{ + if (gdbarch->coerce_float_to_double == 0) + internal_error ("gdbarch: gdbarch_coerce_float_to_double invalid"); + if (gdbarch_debug >= 2) + /* FIXME: gdb_std??? */ + fprintf_unfiltered (gdb_stdlog, "gdbarch_coerce_float_to_double called\n"); + return gdbarch->coerce_float_to_double (formal, actual); +} + +void +set_gdbarch_coerce_float_to_double (struct gdbarch *gdbarch, + gdbarch_coerce_float_to_double_ftype coerce_float_to_double) +{ + gdbarch->coerce_float_to_double = coerce_float_to_double; +} + void gdbarch_get_saved_register (struct gdbarch *gdbarch, char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval) { -- cgit v1.1