From 270677457f363b213b10923759f4f96ed1aa868b Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Thu, 2 Jul 2009 12:48:54 +0000 Subject: * gdbtypes.h (builtin_type_ieee_single, builtin_type_ieee_double, builtin_type_i387_ext, builtin_type_m68881_ext, builtin_type_arm_ext, builtin_type_ia64_spill, builtin_type_ia64_quad): Remove. (init_float_type, init_complex_type): Add prototypes. * gdbtypes.c (builtin_type_ieee_single, builtin_type_ieee_double, builtin_type_i387_ext, builtin_type_m68881_ext, builtin_type_arm_ext, builtin_type_ia64_spill, builtin_type_ia64_quad): Remove. (_initialize_gdbtypes): Do not initialize them. (build_flt): Rename to ... (init_float_type): ... this. Make global. (build_complex): Rename to ... (init_complex_type): ... this. Make global. Remove BIT argument. (gdbtypes_post_init): Update calls. * ada-lang.c (ada_language_arch_info): Use init_float_type. * jv-lang.c (build_java_types): Likewise. * m2-lang.c (build_m2_types): Likewise. * f-lang.c (build_fortran_types): Use init_float_type and init_complex_type. * target-descriptions.c (tdesc_gdb_type): Call init_float_type instead of using builtin_type_ieee_single, builtin_type_ieee_double, or builtin_type_arm_ext. * ia64-tdep.h (struct gdbarch_tdep): Add ia64_ext_type member. * ia64-tdep.c (builtin_type_ia64_ext): Remove. (_initialize_ia64_tdep): Do not initialize it. (floatformat_valid, floatformat_ia64_ext, floatformats_ia64_ext): Move up. (ia64_ext_type): New function. (ia64_register_reggroup_p, ia64_convert_register_p, ia64_register_to_value, ia64_value_to_register, ia64_extract_return_value, ia64_store_return_value): Use ia64_ext_type instead of builtin_type_ia64_ext. * i386-tdep.h (struct gdbarch_tdep): Add i387_ext_type member. (i387_ext_type): Add prototype. * i386-tdep.c (i387_ext_type): New function. (i386_extract_return_value, i386_store_return_value, i386_register_type): Use it instead of builtin_type_i387_ext. * amd64-tdep.c (amd64_register_type): Likewise. * i387-tdep.c (print_i387_value, i387_register_to_value, i387_value_to_register): Likewise. (print_i387_value, print_i387_ext): Add GDBARCH argument. (print_i387_ext, i387_print_float_info): Pass to subroutines. * m68k-tdep.h (struct gdbarch_tdep): Add m68881_ext_type member. * m68k-tdep.c (m68881_ext_type): New function. (m68k_register_type, m68k_convert_register_p): Use it instead of builtin_type_m68881_ext. * arm-tdep.h (struct gdbarch_tdep): Add arm_ext_type member. * arm-tdep.c (arm_ext_type): New function. (arm_register_type): Use it instead of builtin_type_arm_ext. * alpha-tdep.c (alpha_register_type): Use builtin types instead of builtin_type_ieee_double. * mips-tdep.c (mips_float_register_type, mips_double_register_type): Remove. (mips_register_type): Use builtin types instead of builtin_type_ieee_single and builtin_type_ieee_double. (mips_print_fp_register): Use builtin types instead of mips_float_register_type and mips_double_register_type. * hppa-tdep.c (hppa32_register_type, hppa64_register_type): Use builtin types instead of builtin_type_ieee_single and builtin_type_ieee_double. --- gdb/i387-tdep.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'gdb/i387-tdep.c') diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c index ff5a843..2444d5c 100644 --- a/gdb/i387-tdep.c +++ b/gdb/i387-tdep.c @@ -37,7 +37,8 @@ /* Print the floating point number specified by RAW. */ static void -print_i387_value (const gdb_byte *raw, struct ui_file *file) +print_i387_value (struct gdbarch *gdbarch, + const gdb_byte *raw, struct ui_file *file) { DOUBLEST value; @@ -45,7 +46,7 @@ print_i387_value (const gdb_byte *raw, struct ui_file *file) 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, builtin_type_i387_ext); + 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 @@ -61,7 +62,8 @@ print_i387_value (const gdb_byte *raw, struct ui_file *file) /* Print the classification for the register contents RAW. */ static void -print_i387_ext (const gdb_byte *raw, struct ui_file *file) +print_i387_ext (struct gdbarch *gdbarch, + const gdb_byte *raw, struct ui_file *file) { int sign; int integer; @@ -92,11 +94,11 @@ print_i387_ext (const gdb_byte *raw, struct ui_file *file) } else if (exponent < 0x7fff && exponent > 0x0000 && integer) /* Normal. */ - print_i387_value (raw, file); + print_i387_value (gdbarch, raw, file); else if (exponent == 0x0000) { /* Denormal or zero. */ - print_i387_value (raw, file); + print_i387_value (gdbarch, raw, file); if (integer) /* Pseudo-denormal. */ @@ -258,7 +260,7 @@ i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, fprintf_filtered (file, "%02x", raw[i]); if (tag != 3) - print_i387_ext (raw, file); + print_i387_ext (gdbarch, raw, file); fputs_filtered ("\n", file); } @@ -290,7 +292,7 @@ i387_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type) { /* Floating point registers must be converted unless we are accessing them in their hardware type. */ - if (type == builtin_type_i387_ext) + if (type == i387_ext_type (gdbarch)) return 0; else return 1; @@ -306,9 +308,10 @@ void i387_register_to_value (struct frame_info *frame, int regnum, struct type *type, gdb_byte *to) { + struct gdbarch *gdbarch = get_frame_arch (frame); gdb_byte from[I386_MAX_REGISTER_SIZE]; - gdb_assert (i386_fp_regnum_p (get_frame_arch (frame), regnum)); + gdb_assert (i386_fp_regnum_p (gdbarch, regnum)); /* We only support floating-point values. */ if (TYPE_CODE (type) != TYPE_CODE_FLT) @@ -320,7 +323,7 @@ i387_register_to_value (struct frame_info *frame, int regnum, /* Convert to TYPE. */ get_frame_register (frame, regnum, from); - convert_typed_floating (from, builtin_type_i387_ext, to, type); + convert_typed_floating (from, i387_ext_type (gdbarch), to, type); } /* Write the contents FROM of a value of type TYPE into register @@ -330,9 +333,10 @@ void i387_value_to_register (struct frame_info *frame, int regnum, struct type *type, const gdb_byte *from) { + struct gdbarch *gdbarch = get_frame_arch (frame); gdb_byte to[I386_MAX_REGISTER_SIZE]; - gdb_assert (i386_fp_regnum_p (get_frame_arch (frame), regnum)); + gdb_assert (i386_fp_regnum_p (gdbarch, regnum)); /* We only support floating-point values. */ if (TYPE_CODE (type) != TYPE_CODE_FLT) @@ -343,7 +347,7 @@ i387_value_to_register (struct frame_info *frame, int regnum, } /* Convert from TYPE. */ - convert_typed_floating (from, type, to, builtin_type_i387_ext); + convert_typed_floating (from, type, to, i387_ext_type (gdbarch)); put_frame_register (frame, regnum, to); } -- cgit v1.1