summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorDaniel Jacobowitz <dan@debian.org>2007-01-29 17:31:06 +0000
committerDaniel Jacobowitz <dan@debian.org>2007-01-29 17:31:06 +0000
commite1a05d1fb21784a4e18e349d7eeae8b38bb4e1f7 (patch)
treeb044afc1990d516943902fb66dabf44b651618fa /gdb
parenta4a6ce7efffc04ada2c47fb8db51089d13dac5e1 (diff)
downloadgdb-e1a05d1fb21784a4e18e349d7eeae8b38bb4e1f7.tar.gz
* doublest.c (floatformat_from_length): Use the right element from
gdbarch floatformats. (floatformat_from_type, extract_typed_floating) (store_typed_floating): Likewise. * doublest.h: Remove declarations for undefined floatformat arrays. * gdbarch.sh (float_format, double_format, long_double_format): Change to pairs. (pformat): Update for pairs. * gdbarch.c, gdbarch.h: Regenerated. * gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double) (floatformats_ieee_double_littlebyte_bigword) (floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext) (floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f) (floatformats_vax_d): New variables. (builtin_type_ieee_single, builtin_type_ieee_double) (builtin_type_arm_ext, builtin_type_ia64_spill) (builtin_type_ia64_quad): Replace arrays with individual types. (builtin_type_ieee_single_big, builtin_type_ieee_single_little) (builtin_type_ieee_double_big, builtin_type_ieee_double_little) (builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext) (builtin_type_m88110_ext, builtin_type_m88110_harris_ext) (builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword) (builtin_type_ia64_spill_big, builtin_type_ia64_spill_little) (builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete unused and endian-specific types. (recursive_dump_type): Update for floatformat pairs. (build_flt): Move higher. Handle bit == -1. Take a floatformat pair. (build_gdbtypes): Use build_flt. (_initialize_gdbtypes): Update set of initialized types. * gdbtypes.h: Update declarations to match gdbtypes.c. (struct main_type): Store a pointer to two floatformats. * arch-utils.c (default_float_format, default_double_format): Delete. * arch-utils.h (default_float_format, default_double_format): Delete. * arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c, ia64-tdep.c, iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c, mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c, sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c, vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog42
-rw-r--r--gdb/alpha-tdep.c4
-rw-r--r--gdb/arch-utils.c36
-rw-r--r--gdb/arch-utils.h4
-rw-r--r--gdb/arm-tdep.c45
-rw-r--r--gdb/avr-tdep.c6
-rw-r--r--gdb/doublest.c18
-rw-r--r--gdb/doublest.h7
-rw-r--r--gdb/gdbarch.c29
-rw-r--r--gdb/gdbarch.h16
-rwxr-xr-xgdb/gdbarch.sh13
-rw-r--r--gdb/gdbtypes.c277
-rw-r--r--gdb/gdbtypes.h44
-rw-r--r--gdb/hppa-tdep.c6
-rw-r--r--gdb/hppabsd-tdep.c2
-rw-r--r--gdb/i386-tdep.c2
-rw-r--r--gdb/ia64-tdep.c10
-rw-r--r--gdb/iq2000-tdep.c6
-rw-r--r--gdb/m68k-tdep.c2
-rw-r--r--gdb/m88k-tdep.c2
-rw-r--r--gdb/mips-linux-tdep.c10
-rw-r--r--gdb/mips-tdep.c44
-rw-r--r--gdb/mt-tdep.c20
-rw-r--r--gdb/ppc-sysv-tdep.c15
-rw-r--r--gdb/ppcobsd-tdep.c2
-rw-r--r--gdb/sparc-linux-tdep.c2
-rw-r--r--gdb/sparc-tdep.c4
-rw-r--r--gdb/sparcnbsd-tdep.c2
-rw-r--r--gdb/spu-tdep.c6
-rw-r--r--gdb/vax-tdep.c8
30 files changed, 281 insertions, 403 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9cb03be2ca9..188fd8c12f4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,45 @@
+2007-01-29 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * doublest.c (floatformat_from_length): Use the right element from
+ gdbarch floatformats.
+ (floatformat_from_type, extract_typed_floating)
+ (store_typed_floating): Likewise.
+ * doublest.h: Remove declarations for undefined floatformat arrays.
+ * gdbarch.sh (float_format, double_format, long_double_format): Change
+ to pairs.
+ (pformat): Update for pairs.
+ * gdbarch.c, gdbarch.h: Regenerated.
+ * gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double)
+ (floatformats_ieee_double_littlebyte_bigword)
+ (floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext)
+ (floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f)
+ (floatformats_vax_d): New variables.
+ (builtin_type_ieee_single, builtin_type_ieee_double)
+ (builtin_type_arm_ext, builtin_type_ia64_spill)
+ (builtin_type_ia64_quad): Replace arrays with individual types.
+ (builtin_type_ieee_single_big, builtin_type_ieee_single_little)
+ (builtin_type_ieee_double_big, builtin_type_ieee_double_little)
+ (builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext)
+ (builtin_type_m88110_ext, builtin_type_m88110_harris_ext)
+ (builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword)
+ (builtin_type_ia64_spill_big, builtin_type_ia64_spill_little)
+ (builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete
+ unused and endian-specific types.
+ (recursive_dump_type): Update for floatformat pairs.
+ (build_flt): Move higher. Handle bit == -1. Take a floatformat pair.
+ (build_gdbtypes): Use build_flt.
+ (_initialize_gdbtypes): Update set of initialized types.
+ * gdbtypes.h: Update declarations to match gdbtypes.c.
+ (struct main_type): Store a pointer to two floatformats.
+ * arch-utils.c (default_float_format, default_double_format): Delete.
+ * arch-utils.h (default_float_format, default_double_format): Delete.
+
+ * arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c,
+ ia64-tdep.c, iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c,
+ mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c,
+ sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c,
+ vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.
+
2007-01-29 Joel Brobecker <brobecker@adacore.com>
* target.c (maintenance_print_target_stack): New function.
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 5b8f4216ae1..b0bc35b3aa8 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -103,7 +103,7 @@ alpha_register_type (struct gdbarch *gdbarch, int regno)
/* Don't need to worry about little vs big endian until
some jerk tries to port to alpha-unicosmk. */
if (regno >= ALPHA_FP0_REGNUM && regno < ALPHA_FP0_REGNUM + 31)
- return builtin_type_ieee_double_little;
+ return builtin_type_ieee_double;
return builtin_type_int64;
}
@@ -319,7 +319,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (accumulate_size < sizeof (arg_reg_buffer)
&& TYPE_LENGTH (arg_type) == 4)
{
- arg_type = builtin_type_ieee_double_little;
+ arg_type = builtin_type_ieee_double;
arg = value_cast (arg_type, arg);
}
/* Tru64 5.1 has a 128-bit long double, and passes this by
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index df3f9f67c1e..a5ca574ac09 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -143,42 +143,6 @@ core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs)
return (lhs > rhs);
}
-
-/* Helper functions for TARGET_{FLOAT,DOUBLE}_FORMAT */
-
-const struct floatformat *
-default_float_format (struct gdbarch *gdbarch)
-{
- int byte_order = gdbarch_byte_order (gdbarch);
- switch (byte_order)
- {
- case BFD_ENDIAN_BIG:
- return &floatformat_ieee_single_big;
- case BFD_ENDIAN_LITTLE:
- return &floatformat_ieee_single_little;
- default:
- internal_error (__FILE__, __LINE__,
- _("default_float_format: bad byte order"));
- }
-}
-
-
-const struct floatformat *
-default_double_format (struct gdbarch *gdbarch)
-{
- int byte_order = gdbarch_byte_order (gdbarch);
- switch (byte_order)
- {
- case BFD_ENDIAN_BIG:
- return &floatformat_ieee_double_big;
- case BFD_ENDIAN_LITTLE:
- return &floatformat_ieee_double_little;
- default:
- internal_error (__FILE__, __LINE__,
- _("default_double_format: bad byte order"));
- }
-}
-
/* Misc helper functions for targets. */
CORE_ADDR
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index f1cdb3ce121..cc00e58ecd7 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -52,10 +52,6 @@ extern gdbarch_remote_translate_xfer_address_ftype generic_remote_translate_xfer
extern int core_addr_lessthan (CORE_ADDR lhs, CORE_ADDR rhs);
extern int core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs);
-/* Floating point values. */
-extern const struct floatformat *default_float_format (struct gdbarch *gdbarch);
-extern const struct floatformat *default_double_format (struct gdbarch *gdbarch);
-
/* Identity functions on a CORE_ADDR. Just return the "addr". */
extern CORE_ADDR core_addr_identity (CORE_ADDR addr);
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index f254876c0c7..7b92cd7975c 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -1334,12 +1334,7 @@ static struct type *
arm_register_type (struct gdbarch *gdbarch, int regnum)
{
if (regnum >= ARM_F0_REGNUM && regnum < ARM_F0_REGNUM + NUM_FREGS)
- {
- if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
- return builtin_type_arm_ext_big;
- else
- return builtin_type_arm_ext_littlebyte_bigword;
- }
+ return builtin_type_arm_ext;
else if (regnum == ARM_SP_REGNUM)
return builtin_type_void_data_ptr;
else if (regnum == ARM_PC_REGNUM)
@@ -2833,34 +2828,18 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_get_longjmp_target (gdbarch, arm_get_longjmp_target);
/* Floating point sizes and format. */
- switch (info.byte_order)
+ set_gdbarch_float_format (gdbarch, floatformats_ieee_single);
+ if (fp_model == ARM_FLOAT_SOFT_FPA || fp_model == ARM_FLOAT_FPA)
{
- case BFD_ENDIAN_BIG:
- set_gdbarch_float_format (gdbarch, &floatformat_ieee_single_big);
- set_gdbarch_double_format (gdbarch, &floatformat_ieee_double_big);
- set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
- break;
-
- case BFD_ENDIAN_LITTLE:
- set_gdbarch_float_format (gdbarch, &floatformat_ieee_single_little);
- if (fp_model == ARM_FLOAT_SOFT_FPA || fp_model == ARM_FLOAT_FPA)
- {
- set_gdbarch_double_format
- (gdbarch, &floatformat_ieee_double_littlebyte_bigword);
- set_gdbarch_long_double_format
- (gdbarch, &floatformat_ieee_double_littlebyte_bigword);
- }
- else
- {
- set_gdbarch_double_format (gdbarch, &floatformat_ieee_double_little);
- set_gdbarch_long_double_format (gdbarch,
- &floatformat_ieee_double_little);
- }
- break;
-
- default:
- internal_error (__FILE__, __LINE__,
- _("arm_gdbarch_init: bad byte order for float format"));
+ set_gdbarch_double_format
+ (gdbarch, floatformats_ieee_double_littlebyte_bigword);
+ set_gdbarch_long_double_format
+ (gdbarch, floatformats_ieee_double_littlebyte_bigword);
+ }
+ else
+ {
+ set_gdbarch_double_format (gdbarch, floatformats_ieee_double);
+ set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
}
return gdbarch;
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 1d50991dd14..960e6dff072 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -1267,9 +1267,9 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_long_double_bit (gdbarch, 4 * TARGET_CHAR_BIT);
- set_gdbarch_float_format (gdbarch, &floatformat_ieee_single_little);
- set_gdbarch_double_format (gdbarch, &floatformat_ieee_single_little);
- set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_single_little);
+ set_gdbarch_float_format (gdbarch, floatformats_ieee_single);
+ set_gdbarch_double_format (gdbarch, floatformats_ieee_single);
+ set_gdbarch_long_double_format (gdbarch, floatformats_ieee_single);
set_gdbarch_read_pc (gdbarch, avr_read_pc);
set_gdbarch_write_pc (gdbarch, avr_write_pc);
diff --git a/gdb/doublest.c b/gdb/doublest.c
index 0f92fdf4900..3b640f5519d 100644
--- a/gdb/doublest.c
+++ b/gdb/doublest.c
@@ -689,19 +689,19 @@ floatformat_from_length (int len)
{
const struct floatformat *format;
if (len * TARGET_CHAR_BIT == TARGET_FLOAT_BIT)
- format = TARGET_FLOAT_FORMAT;
+ format = TARGET_FLOAT_FORMAT[TARGET_BYTE_ORDER];
else if (len * TARGET_CHAR_BIT == TARGET_DOUBLE_BIT)
- format = TARGET_DOUBLE_FORMAT;
+ format = TARGET_DOUBLE_FORMAT[TARGET_BYTE_ORDER];
else if (len * TARGET_CHAR_BIT == TARGET_LONG_DOUBLE_BIT)
- format = TARGET_LONG_DOUBLE_FORMAT;
+ format = TARGET_LONG_DOUBLE_FORMAT[TARGET_BYTE_ORDER];
/* On i386 the 'long double' type takes 96 bits,
while the real number of used bits is only 80,
both in processor and in memory.
The code below accepts the real bit size. */
else if ((TARGET_LONG_DOUBLE_FORMAT != NULL)
&& (len * TARGET_CHAR_BIT ==
- TARGET_LONG_DOUBLE_FORMAT->totalsize))
- format = TARGET_LONG_DOUBLE_FORMAT;
+ TARGET_LONG_DOUBLE_FORMAT[0]->totalsize))
+ format = TARGET_LONG_DOUBLE_FORMAT[TARGET_BYTE_ORDER];
else
format = NULL;
if (format == NULL)
@@ -715,7 +715,7 @@ floatformat_from_type (const struct type *type)
{
gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
if (TYPE_FLOATFORMAT (type) != NULL)
- return TYPE_FLOATFORMAT (type);
+ return TYPE_FLOATFORMAT (type)[TARGET_BYTE_ORDER];
else
return floatformat_from_length (TYPE_LENGTH (type));
}
@@ -776,7 +776,8 @@ extract_typed_floating (const void *addr, const struct type *type)
specific code? stabs?) so handle that here as a special case. */
return extract_floating_by_length (addr, TYPE_LENGTH (type));
- floatformat_to_doublest (TYPE_FLOATFORMAT (type), addr, &retval);
+ floatformat_to_doublest (TYPE_FLOATFORMAT (type)[TARGET_BYTE_ORDER],
+ addr, &retval);
return retval;
}
@@ -813,7 +814,8 @@ store_typed_floating (void *addr, const struct type *type, DOUBLEST val)
specific code? stabs?) so handle that here as a special case. */
store_floating_by_length (addr, TYPE_LENGTH (type), val);
else
- floatformat_from_doublest (TYPE_FLOATFORMAT (type), &val, addr);
+ floatformat_from_doublest (TYPE_FLOATFORMAT (type)[TARGET_BYTE_ORDER],
+ &val, addr);
}
/* Convert a floating-point number of type FROM_TYPE from a
diff --git a/gdb/doublest.h b/gdb/doublest.h
index f2890dd23d9..058b4a34e68 100644
--- a/gdb/doublest.h
+++ b/gdb/doublest.h
@@ -100,11 +100,4 @@ extern void convert_typed_floating (const void *from,
const struct type *from_type,
void *to, const struct type *to_type);
-/* Table of convenient float-formats. */
-extern const struct floatformat *floatformat_ieee_single[BFD_ENDIAN_UNKNOWN];
-extern const struct floatformat *floatformat_ieee_double[BFD_ENDIAN_UNKNOWN];
-extern const struct floatformat *floatformat_ieee_quad[BFD_ENDIAN_UNKNOWN];
-extern const struct floatformat *floatformat_arm_ext[BFD_ENDIAN_UNKNOWN];
-extern const struct floatformat *floatformat_ia64_spill[BFD_ENDIAN_UNKNOWN];
-
#endif
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index decc8e04f52..8b6d60b4a01 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -69,12 +69,13 @@ show_gdbarch_debug (struct ui_file *file, int from_tty,
}
static const char *
-pformat (const struct floatformat *format)
+pformat (const struct floatformat **format)
{
if (format == NULL)
return "(null)";
else
- return format->name;
+ /* Just print out one of them - this is only for diagnostics. */
+ return format[0]->name;
}
@@ -136,11 +137,11 @@ struct gdbarch
int long_bit;
int long_long_bit;
int float_bit;
- const struct floatformat * float_format;
+ const struct floatformat ** float_format;
int double_bit;
- const struct floatformat * double_format;
+ const struct floatformat ** double_format;
int long_double_bit;
- const struct floatformat * long_double_format;
+ const struct floatformat ** long_double_format;
int ptr_bit;
int addr_bit;
int bfd_vma_bit;
@@ -516,13 +517,13 @@ verify_gdbarch (struct gdbarch *current_gdbarch)
/* Skip verify of long_long_bit, invalid_p == 0 */
/* Skip verify of float_bit, invalid_p == 0 */
if (current_gdbarch->float_format == 0)
- current_gdbarch->float_format = default_float_format (current_gdbarch);
+ current_gdbarch->float_format = floatformats_ieee_single;
/* Skip verify of double_bit, invalid_p == 0 */
if (current_gdbarch->double_format == 0)
- current_gdbarch->double_format = default_double_format (current_gdbarch);
+ current_gdbarch->double_format = floatformats_ieee_double;
/* Skip verify of long_double_bit, invalid_p == 0 */
if (current_gdbarch->long_double_format == 0)
- current_gdbarch->long_double_format = default_double_format (current_gdbarch);
+ current_gdbarch->long_double_format = floatformats_ieee_double;
/* Skip verify of ptr_bit, invalid_p == 0 */
if (current_gdbarch->addr_bit == 0)
current_gdbarch->addr_bit = TARGET_PTR_BIT;
@@ -1740,7 +1741,7 @@ set_gdbarch_float_bit (struct gdbarch *gdbarch,
gdbarch->float_bit = float_bit;
}
-const struct floatformat *
+const struct floatformat **
gdbarch_float_format (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
@@ -1751,7 +1752,7 @@ gdbarch_float_format (struct gdbarch *gdbarch)
void
set_gdbarch_float_format (struct gdbarch *gdbarch,
- const struct floatformat * float_format)
+ const struct floatformat ** float_format)
{
gdbarch->float_format = float_format;
}
@@ -1773,7 +1774,7 @@ set_gdbarch_double_bit (struct gdbarch *gdbarch,
gdbarch->double_bit = double_bit;
}
-const struct floatformat *
+const struct floatformat **
gdbarch_double_format (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
@@ -1784,7 +1785,7 @@ gdbarch_double_format (struct gdbarch *gdbarch)
void
set_gdbarch_double_format (struct gdbarch *gdbarch,
- const struct floatformat * double_format)
+ const struct floatformat ** double_format)
{
gdbarch->double_format = double_format;
}
@@ -1806,7 +1807,7 @@ set_gdbarch_long_double_bit (struct gdbarch *gdbarch,
gdbarch->long_double_bit = long_double_bit;
}
-const struct floatformat *
+const struct floatformat **
gdbarch_long_double_format (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
@@ -1817,7 +1818,7 @@ gdbarch_long_double_format (struct gdbarch *gdbarch)
void
set_gdbarch_long_double_format (struct gdbarch *gdbarch,
- const struct floatformat * long_double_format)
+ const struct floatformat ** long_double_format)
{
gdbarch->long_double_format = long_double_format;
}
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 4fac0eec217..8cfd33b18d7 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -141,7 +141,9 @@ extern void set_gdbarch_long_long_bit (struct gdbarch *gdbarch, int long_long_bi
/* The ABI default bit-size and format for "float", "double", and "long
double". These bit/format pairs should eventually be combined into
- a single object. For the moment, just initialize them as a pair. */
+ a single object. For the moment, just initialize them as a pair.
+ Each format describes both the big and little endian layouts (if
+ useful). */
extern int gdbarch_float_bit (struct gdbarch *gdbarch);
extern void set_gdbarch_float_bit (struct gdbarch *gdbarch, int float_bit);
@@ -152,8 +154,8 @@ extern void set_gdbarch_float_bit (struct gdbarch *gdbarch, int float_bit);
#define TARGET_FLOAT_BIT (gdbarch_float_bit (current_gdbarch))
#endif
-extern const struct floatformat * gdbarch_float_format (struct gdbarch *gdbarch);
-extern void set_gdbarch_float_format (struct gdbarch *gdbarch, const struct floatformat * float_format);
+extern const struct floatformat ** gdbarch_float_format (struct gdbarch *gdbarch);
+extern void set_gdbarch_float_format (struct gdbarch *gdbarch, const struct floatformat ** float_format);
#if !defined (GDB_TM_FILE) && defined (TARGET_FLOAT_FORMAT)
#error "Non multi-arch definition of TARGET_FLOAT_FORMAT"
#endif
@@ -170,8 +172,8 @@ extern void set_gdbarch_double_bit (struct gdbarch *gdbarch, int double_bit);
#define TARGET_DOUBLE_BIT (gdbarch_double_bit (current_gdbarch))
#endif
-extern const struct floatformat * gdbarch_double_format (struct gdbarch *gdbarch);
-extern void set_gdbarch_double_format (struct gdbarch *gdbarch, const struct floatformat * double_format);
+extern const struct floatformat ** gdbarch_double_format (struct gdbarch *gdbarch);
+extern void set_gdbarch_double_format (struct gdbarch *gdbarch, const struct floatformat ** double_format);
#if !defined (GDB_TM_FILE) && defined (TARGET_DOUBLE_FORMAT)
#error "Non multi-arch definition of TARGET_DOUBLE_FORMAT"
#endif
@@ -188,8 +190,8 @@ extern void set_gdbarch_long_double_bit (struct gdbarch *gdbarch, int long_doubl
#define TARGET_LONG_DOUBLE_BIT (gdbarch_long_double_bit (current_gdbarch))
#endif
-extern const struct floatformat * gdbarch_long_double_format (struct gdbarch *gdbarch);
-extern void set_gdbarch_long_double_format (struct gdbarch *gdbarch, const struct floatformat * long_double_format);
+extern const struct floatformat ** gdbarch_long_double_format (struct gdbarch *gdbarch);
+extern void set_gdbarch_long_double_format (struct gdbarch *gdbarch, const struct floatformat ** long_double_format);
#if !defined (GDB_TM_FILE) && defined (TARGET_LONG_DOUBLE_FORMAT)
#error "Non multi-arch definition of TARGET_LONG_DOUBLE_FORMAT"
#endif
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index db88df0f9a4..d0547991bc4 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -391,13 +391,15 @@ v:TARGET_LONG_LONG_BIT:int:long_long_bit:::8 * sizeof (LONGEST):2*TARGET_LONG_BI
# The ABI default bit-size and format for "float", "double", and "long
# double". These bit/format pairs should eventually be combined into
# a single object. For the moment, just initialize them as a pair.
+# Each format describes both the big and little endian layouts (if
+# useful).
v:TARGET_FLOAT_BIT:int:float_bit:::8 * sizeof (float):4*TARGET_CHAR_BIT::0
-v:TARGET_FLOAT_FORMAT:const struct floatformat *:float_format:::::default_float_format (current_gdbarch)::pformat (current_gdbarch->float_format)
+v:TARGET_FLOAT_FORMAT:const struct floatformat **:float_format:::::floatformats_ieee_single::pformat (current_gdbarch->float_format)
v:TARGET_DOUBLE_BIT:int:double_bit:::8 * sizeof (double):8*TARGET_CHAR_BIT::0
-v:TARGET_DOUBLE_FORMAT:const struct floatformat *:double_format:::::default_double_format (current_gdbarch)::pformat (current_gdbarch->double_format)
+v:TARGET_DOUBLE_FORMAT:const struct floatformat **:double_format:::::floatformats_ieee_double::pformat (current_gdbarch->double_format)
v:TARGET_LONG_DOUBLE_BIT:int:long_double_bit:::8 * sizeof (long double):8*TARGET_CHAR_BIT::0
-v:TARGET_LONG_DOUBLE_FORMAT:const struct floatformat *:long_double_format:::::default_double_format (current_gdbarch)::pformat (current_gdbarch->long_double_format)
+v:TARGET_LONG_DOUBLE_FORMAT:const struct floatformat **:long_double_format:::::floatformats_ieee_double::pformat (current_gdbarch->long_double_format)
# For most targets, a pointer on the target and its representation as an
# address in GDB have the same size and "look the same". For such a
@@ -1204,12 +1206,13 @@ show_gdbarch_debug (struct ui_file *file, int from_tty,
}
static const char *
-pformat (const struct floatformat *format)
+pformat (const struct floatformat **format)
{
if (format == NULL)
return "(null)";
else
- return format->name;
+ /* Just print out one of them - this is only for diagnostics. */
+ return format[0]->name;
}
EOF
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index a188232128c..5d56de06afe 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -98,27 +98,57 @@ struct type *builtin_type_v4hi;
struct type *builtin_type_v2si;
struct type *builtin_type_vec64;
struct type *builtin_type_vec128;
-struct type *builtin_type_ieee_single[BFD_ENDIAN_UNKNOWN];
-struct type *builtin_type_ieee_single_big;
-struct type *builtin_type_ieee_single_little;
-struct type *builtin_type_ieee_double[BFD_ENDIAN_UNKNOWN];
-struct type *builtin_type_ieee_double_big;
-struct type *builtin_type_ieee_double_little;
-struct type *builtin_type_ieee_double_littlebyte_bigword;
+
+/* Floatformat pairs. */
+const struct floatformat *floatformats_ieee_single[BFD_ENDIAN_UNKNOWN] = {
+ &floatformat_ieee_single_big,
+ &floatformat_ieee_single_little
+};
+const struct floatformat *floatformats_ieee_double[BFD_ENDIAN_UNKNOWN] = {
+ &floatformat_ieee_double_big,
+ &floatformat_ieee_double_little
+};
+const struct floatformat *floatformats_ieee_double_littlebyte_bigword[BFD_ENDIAN_UNKNOWN] = {
+ &floatformat_ieee_double_big,
+ &floatformat_ieee_double_littlebyte_bigword
+};
+const struct floatformat *floatformats_i387_ext[BFD_ENDIAN_UNKNOWN] = {
+ &floatformat_i387_ext,
+ &floatformat_i387_ext
+};
+const struct floatformat *floatformats_m68881_ext[BFD_ENDIAN_UNKNOWN] = {
+ &floatformat_m68881_ext,
+ &floatformat_m68881_ext
+};
+const struct floatformat *floatformats_arm_ext[BFD_ENDIAN_UNKNOWN] = {
+ &floatformat_arm_ext_big,
+ &floatformat_arm_ext_littlebyte_bigword
+};
+const struct floatformat *floatformats_ia64_spill[BFD_ENDIAN_UNKNOWN] = {
+ &floatformat_ia64_spill_big,
+ &floatformat_ia64_spill_little
+};
+const struct floatformat *floatformats_ia64_quad[BFD_ENDIAN_UNKNOWN] = {
+ &floatformat_ia64_quad_big,
+ &floatformat_ia64_quad_little
+};
+const struct floatformat *floatformats_vax_f[BFD_ENDIAN_UNKNOWN] = {
+ &floatformat_vax_f,
+ &floatformat_vax_f
+};
+const struct floatformat *floatformats_vax_d[BFD_ENDIAN_UNKNOWN] = {
+ &floatformat_vax_d,
+ &floatformat_vax_d
+};
+
+struct type *builtin_type_ieee_single;
+struct type *builtin_type_ieee_double;
struct type *builtin_type_i387_ext;
struct type *builtin_type_m68881_ext;
-struct type *builtin_type_i960_ext;
-struct type *builtin_type_m88110_ext;
-struct type *builtin_type_m88110_harris_ext;
-struct type *builtin_type_arm_ext[BFD_ENDIAN_UNKNOWN];
-struct type *builtin_type_arm_ext_big;
-struct type *builtin_type_arm_ext_littlebyte_bigword;
-struct type *builtin_type_ia64_spill[BFD_ENDIAN_UNKNOWN];
-struct type *builtin_type_ia64_spill_big;
-struct type *builtin_type_ia64_spill_little;
-struct type *builtin_type_ia64_quad[BFD_ENDIAN_UNKNOWN];
-struct type *builtin_type_ia64_quad_big;
-struct type *builtin_type_ia64_quad_little;
+struct type *builtin_type_arm_ext;
+struct type *builtin_type_ia64_spill;
+struct type *builtin_type_ia64_quad;
+
struct type *builtin_type_void_data_ptr;
struct type *builtin_type_void_func_ptr;
struct type *builtin_type_CORE_ADDR;
@@ -3148,11 +3178,26 @@ recursive_dump_type (struct type *type, int spaces)
case TYPE_CODE_FLT:
printfi_filtered (spaces, "floatformat ");
- if (TYPE_FLOATFORMAT (type) == NULL
- || TYPE_FLOATFORMAT (type)->name == NULL)
+ if (TYPE_FLOATFORMAT (type) == NULL)
puts_filtered ("(null)");
else
- puts_filtered (TYPE_FLOATFORMAT (type)->name);
+ {
+ puts_filtered ("{ ");
+ if (TYPE_FLOATFORMAT (type)[0] == NULL
+ || TYPE_FLOATFORMAT (type)[0]->name == NULL)
+ puts_filtered ("(null)");
+ else
+ puts_filtered (TYPE_FLOATFORMAT (type)[0]->name);
+
+ puts_filtered (", ");
+ if (TYPE_FLOATFORMAT (type)[1] == NULL
+ || TYPE_FLOATFORMAT (type)[1]->name == NULL)
+ puts_filtered ("(null)");
+ else
+ puts_filtered (TYPE_FLOATFORMAT (type)[1]->name);
+
+ puts_filtered (" }");
+ }
puts_filtered ("\n");
break;
@@ -3315,6 +3360,24 @@ copy_type_recursive (struct objfile *objfile, struct type *type,
return new_type;
}
+static struct type *
+build_flt (int bit, char *name, const struct floatformat **floatformats)
+{
+ struct type *t;
+
+ if (bit == -1)
+ {
+ gdb_assert (floatformats != NULL);
+ gdb_assert (floatformats[0] != NULL && floatformats[1] != NULL);
+ bit = floatformats[0]->totalsize;
+ }
+ gdb_assert (bit >= 0);
+
+ t = init_type (TYPE_CODE_FLT, bit / TARGET_CHAR_BIT, 0, name, NULL);
+ TYPE_FLOATFORMAT (t) = floatformats;
+ return t;
+}
+
static void
build_gdbtypes (void)
{
@@ -3371,35 +3434,14 @@ build_gdbtypes (void)
init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED,
"unsigned long long", (struct objfile *) NULL);
- builtin_type_float =
- init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
- 0,
- "float", (struct objfile *) NULL);
-/* vinschen@redhat.com 2002-02-08:
- The below lines are disabled since they are doing the wrong
- thing for non-multiarch targets. They are setting the correct
- type of floats for the target but while on multiarch targets
- this is done everytime the architecture changes, it's done on
- non-multiarch targets only on startup, leaving the wrong values
- in even if the architecture changes (eg. from big-endian to
- little-endian). */
-#if 0
- TYPE_FLOATFORMAT (builtin_type_float) = TARGET_FLOAT_FORMAT;
-#endif
- builtin_type_double =
- init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
- 0,
- "double", (struct objfile *) NULL);
-#if 0
- TYPE_FLOATFORMAT (builtin_type_double) = TARGET_DOUBLE_FORMAT;
-#endif
- builtin_type_long_double =
- init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
- 0,
- "long double", (struct objfile *) NULL);
-#if 0
- TYPE_FLOATFORMAT (builtin_type_long_double) = TARGET_LONG_DOUBLE_FORMAT;
-#endif
+
+ builtin_type_float = build_flt (TARGET_FLOAT_BIT, "float",
+ TARGET_FLOAT_FORMAT);
+ builtin_type_double = build_flt (TARGET_DOUBLE_BIT, "double",
+ TARGET_DOUBLE_FORMAT);
+ builtin_type_long_double = build_flt (TARGET_LONG_DOUBLE_BIT, "long double",
+ TARGET_LONG_DOUBLE_FORMAT);
+
builtin_type_complex =
init_type (TYPE_CODE_COMPLEX, 2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
0,
@@ -3513,21 +3555,6 @@ builtin_type (struct gdbarch *gdbarch)
static struct type *
-build_flt (int bit, char *name, const struct floatformat *floatformat)
-{
- struct type *t;
- if (bit <= 0 || floatformat == NULL)
- {
- gdb_assert (builtin_type_error != NULL);
- return builtin_type_error;
- }
- t = init_type (TYPE_CODE_FLT, bit / TARGET_CHAR_BIT,
- 0, name, (struct objfile *) NULL);
- TYPE_FLOATFORMAT (t) = floatformat;
- return t;
-}
-
-static struct type *
build_complex (int bit, char *name, struct type *target_type)
{
struct type *t;
@@ -3777,110 +3804,20 @@ _initialize_gdbtypes (void)
/* Note: These types do not need to be swapped - they are target
neutral. FIXME: Are you sure? See the comment above the calls
to DEPRECATED_REGISTER_GDBARCH_SWAP above. */
- builtin_type_ieee_single_big =
- init_type (TYPE_CODE_FLT, floatformat_ieee_single_big.totalsize / 8,
- 0, "builtin_type_ieee_single_big", NULL);
- TYPE_FLOATFORMAT (builtin_type_ieee_single_big) = &floatformat_ieee_single_big;
- builtin_type_ieee_single_little =
- init_type (TYPE_CODE_FLT, floatformat_ieee_single_little.totalsize / 8,
- 0, "builtin_type_ieee_single_little", NULL);
- TYPE_FLOATFORMAT (builtin_type_ieee_single_little) = &floatformat_ieee_single_little;
- builtin_type_ieee_single[BFD_ENDIAN_BIG]
- = build_flt (floatformat_ieee_single_big.totalsize,
- "builtin_type_ieee_single_big",
- &floatformat_ieee_single_big);
- builtin_type_ieee_single[BFD_ENDIAN_LITTLE]
- = build_flt (floatformat_ieee_single_little.totalsize,
- "builtin_type_ieee_single_little",
- &floatformat_ieee_single_little);
- builtin_type_ieee_double_big =
- init_type (TYPE_CODE_FLT, floatformat_ieee_double_big.totalsize / 8,
- 0, "builtin_type_ieee_double_big", NULL);
- TYPE_FLOATFORMAT (builtin_type_ieee_double_big) = &floatformat_ieee_double_big;
- builtin_type_ieee_double_little =
- init_type (TYPE_CODE_FLT, floatformat_ieee_double_little.totalsize / 8,
- 0, "builtin_type_ieee_double_little", NULL);
- TYPE_FLOATFORMAT (builtin_type_ieee_double_little) = &floatformat_ieee_double_little;
- builtin_type_ieee_double[BFD_ENDIAN_BIG]
- = build_flt (floatformat_ieee_double_big.totalsize,
- "builtin_type_ieee_double_big",
- &floatformat_ieee_double_big);
- builtin_type_ieee_double[BFD_ENDIAN_LITTLE]
- = build_flt (floatformat_ieee_double_little.totalsize,
- "builtin_type_ieee_double_little",
- &floatformat_ieee_double_little);
- builtin_type_ieee_double_littlebyte_bigword =
- init_type (TYPE_CODE_FLT, floatformat_ieee_double_littlebyte_bigword.totalsize / 8,
- 0, "builtin_type_ieee_double_littlebyte_bigword", NULL);
- TYPE_FLOATFORMAT (builtin_type_ieee_double_littlebyte_bigword) = &floatformat_ieee_double_littlebyte_bigword;
- builtin_type_i387_ext =
- init_type (TYPE_CODE_FLT, floatformat_i387_ext.totalsize / 8,
- 0, "builtin_type_i387_ext", NULL);
- TYPE_FLOATFORMAT (builtin_type_i387_ext) = &floatformat_i387_ext;
- builtin_type_m68881_ext =
- init_type (TYPE_CODE_FLT, floatformat_m68881_ext.totalsize / 8,
- 0, "builtin_type_m68881_ext", NULL);
- TYPE_FLOATFORMAT (builtin_type_m68881_ext) = &floatformat_m68881_ext;
- builtin_type_i960_ext =
- init_type (TYPE_CODE_FLT, floatformat_i960_ext.totalsize / 8,
- 0, "builtin_type_i960_ext", NULL);
- TYPE_FLOATFORMAT (builtin_type_i960_ext) = &floatformat_i960_ext;
- builtin_type_m88110_ext =
- init_type (TYPE_CODE_FLT, floatformat_m88110_ext.totalsize / 8,
- 0, "builtin_type_m88110_ext", NULL);
- TYPE_FLOATFORMAT (builtin_type_m88110_ext) = &floatformat_m88110_ext;
- builtin_type_m88110_harris_ext =
- init_type (TYPE_CODE_FLT, floatformat_m88110_harris_ext.totalsize / 8,
- 0, "builtin_type_m88110_harris_ext", NULL);
- TYPE_FLOATFORMAT (builtin_type_m88110_harris_ext) = &floatformat_m88110_harris_ext;
- builtin_type_arm_ext_big =
- init_type (TYPE_CODE_FLT, floatformat_arm_ext_big.totalsize / 8,
- 0, "builtin_type_arm_ext_big", NULL);
- TYPE_FLOATFORMAT (builtin_type_arm_ext_big) = &floatformat_arm_ext_big;
- builtin_type_arm_ext_littlebyte_bigword =
- init_type (TYPE_CODE_FLT, floatformat_arm_ext_littlebyte_bigword.totalsize / 8,
- 0, "builtin_type_arm_ext_littlebyte_bigword", NULL);
- TYPE_FLOATFORMAT (builtin_type_arm_ext_littlebyte_bigword) = &floatformat_arm_ext_littlebyte_bigword;
- builtin_type_arm_ext[BFD_ENDIAN_BIG]
- = build_flt (floatformat_arm_ext_big.totalsize,
- "builtin_type_arm_ext_big",
- &floatformat_arm_ext_big);
- builtin_type_arm_ext[BFD_ENDIAN_LITTLE]
- = build_flt (floatformat_arm_ext_littlebyte_bigword.totalsize,
- "builtin_type_arm_ext_littlebyte_bigword",
- &floatformat_arm_ext_littlebyte_bigword);
- builtin_type_ia64_spill_big =
- init_type (TYPE_CODE_FLT, floatformat_ia64_spill_big.totalsize / 8,
- 0, "builtin_type_ia64_spill_big", NULL);
- TYPE_FLOATFORMAT (builtin_type_ia64_spill_big) = &floatformat_ia64_spill_big;
- builtin_type_ia64_spill_little =
- init_type (TYPE_CODE_FLT, floatformat_ia64_spill_little.totalsize / 8,
- 0, "builtin_type_ia64_spill_little", NULL);
- TYPE_FLOATFORMAT (builtin_type_ia64_spill_little) = &floatformat_ia64_spill_little;
- builtin_type_ia64_spill[BFD_ENDIAN_BIG]
- = build_flt (floatformat_ia64_spill_big.totalsize,
- "builtin_type_ia64_spill_big",
- &floatformat_ia64_spill_big);
- builtin_type_ia64_spill[BFD_ENDIAN_LITTLE]
- = build_flt (floatformat_ia64_spill_little.totalsize,
- "builtin_type_ia64_spill_little",
- &floatformat_ia64_spill_little);
- builtin_type_ia64_quad_big =
- init_type (TYPE_CODE_FLT, floatformat_ia64_quad_big.totalsize / 8,
- 0, "builtin_type_ia64_quad_big", NULL);
- TYPE_FLOATFORMAT (builtin_type_ia64_quad_big) = &floatformat_ia64_quad_big;
- builtin_type_ia64_quad_little =
- init_type (TYPE_CODE_FLT, floatformat_ia64_quad_little.totalsize / 8,
- 0, "builtin_type_ia64_quad_little", NULL);
- TYPE_FLOATFORMAT (builtin_type_ia64_quad_little) = &floatformat_ia64_quad_little;
- builtin_type_ia64_quad[BFD_ENDIAN_BIG]
- = build_flt (floatformat_ia64_quad_big.totalsize,
- "builtin_type_ia64_quad_big",
- &floatformat_ia64_quad_big);
- builtin_type_ia64_quad[BFD_ENDIAN_LITTLE]
- = build_flt (floatformat_ia64_quad_little.totalsize,
- "builtin_type_ia64_quad_little",
- &floatformat_ia64_quad_little);
+ builtin_type_ieee_single
+ = build_flt (-1, "builtin_type_ieee_single", floatformats_ieee_single);
+ builtin_type_ieee_double
+ = build_flt (-1, "builtin_type_ieee_double", floatformats_ieee_double);
+ builtin_type_i387_ext
+ = build_flt (-1, "builtin_type_i387_ext", floatformats_i387_ext);
+ builtin_type_m68881_ext
+ = build_flt (-1, "builtin_type_m68881_ext", floatformats_m68881_ext);
+ builtin_type_arm_ext
+ = build_flt (-1, "builtin_type_arm_ext", floatformats_arm_ext);
+ builtin_type_ia64_spill
+ = build_flt (-1, "builtin_type_ia64_spill", floatformats_ia64_spill);
+ builtin_type_ia64_quad
+ = build_flt (-1, "builtin_type_ia64_quad", floatformats_ia64_quad);
add_setshow_zinteger_cmd ("overload", no_class, &overload_debug, _("\
Set debugging of C++ overloading."), _("\
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index ce30b1971e6..8cbd26ce49e 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -497,11 +497,12 @@ struct main_type
struct cplus_struct_type *cplus_stuff;
- /* FLOATFORMAT is for TYPE_CODE_FLT. It is a pointer to the
- floatformat object that describes the floating-point value
- that resides within the type. */
+ /* FLOATFORMAT is for TYPE_CODE_FLT. It is a pointer to two
+ floatformat objects that describe the floating-point value
+ that resides within the type. The first is for big endian
+ targets and the second is for little endian targets. */
- const struct floatformat *floatformat;
+ const struct floatformat **floatformat;
} type_specific;
};
@@ -1105,27 +1106,24 @@ extern struct type *builtin_type_v16_int8;
extern struct type *builtin_type_vec128;
/* Explicit floating-point formats. See "floatformat.h". */
-extern struct type *builtin_type_ieee_single[BFD_ENDIAN_UNKNOWN];
-extern struct type *builtin_type_ieee_single_big;
-extern struct type *builtin_type_ieee_single_little;
-extern struct type *builtin_type_ieee_double[BFD_ENDIAN_UNKNOWN];
-extern struct type *builtin_type_ieee_double_big;
-extern struct type *builtin_type_ieee_double_little;
-extern struct type *builtin_type_ieee_double_littlebyte_bigword;
+extern const struct floatformat *floatformats_ieee_single[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat *floatformats_ieee_double[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat *floatformats_ieee_double_littlebyte_bigword[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat *floatformats_i387_ext[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat *floatformats_m68881_ext[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat *floatformats_arm_ext[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat *floatformats_ia64_spill[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat *floatformats_ia64_quad[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat *floatformats_vax_f[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat *floatformats_vax_d[BFD_ENDIAN_UNKNOWN];
+
+extern struct type *builtin_type_ieee_single;
+extern struct type *builtin_type_ieee_double;
extern struct type *builtin_type_i387_ext;
extern struct type *builtin_type_m68881_ext;
-extern struct type *builtin_type_i960_ext;
-extern struct type *builtin_type_m88110_ext;
-extern struct type *builtin_type_m88110_harris_ext;
-extern struct type *builtin_type_arm_ext[BFD_ENDIAN_UNKNOWN];
-extern struct type *builtin_type_arm_ext_big;
-extern struct type *builtin_type_arm_ext_littlebyte_bigword;
-extern struct type *builtin_type_ia64_spill[BFD_ENDIAN_UNKNOWN];
-extern struct type *builtin_type_ia64_spill_big;
-extern struct type *builtin_type_ia64_spill_little;
-extern struct type *builtin_type_ia64_quad[BFD_ENDIAN_UNKNOWN];
-extern struct type *builtin_type_ia64_quad_big;
-extern struct type *builtin_type_ia64_quad_little;
+extern struct type *builtin_type_arm_ext;
+extern struct type *builtin_type_ia64_spill;
+extern struct type *builtin_type_ia64_quad;
/* We use this for the '/c' print format, because builtin_type_char is
just a one-byte integral type, which languages less laid back than
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 6b149852cc5..059704080f9 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -2635,7 +2635,7 @@ hppa32_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum < HPPA_FP4_REGNUM)
return builtin_type_uint32;
else
- return builtin_type_ieee_single_big;
+ return builtin_type_ieee_single;
}
static struct type *
@@ -2644,7 +2644,7 @@ hppa64_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum < HPPA64_FP4_REGNUM)
return builtin_type_uint64;
else
- return builtin_type_ieee_double_big;
+ return builtin_type_ieee_double;
}
/* Return non-zero if REGNUM is not a register available to the user
@@ -3085,7 +3085,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
and LP64, but might show differences some day. */
set_gdbarch_long_long_bit (gdbarch, 64);
set_gdbarch_long_double_bit (gdbarch, 128);
- set_gdbarch_long_double_format (gdbarch, &floatformat_ia64_quad_big);
+ set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
/* The following gdbarch vector elements do not depend on the address
size, or in any other gdbarch element previously set. */
diff --git a/gdb/hppabsd-tdep.c b/gdb/hppabsd-tdep.c
index 86de8eebf8a..7aaa3a32f02 100644
--- a/gdb/hppabsd-tdep.c
+++ b/gdb/hppabsd-tdep.c
@@ -171,7 +171,7 @@ hppabsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* OpenBSD and NetBSD have a 64-bit 'long double'. */
set_gdbarch_long_double_bit (gdbarch, 64);
- set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
+ set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
/* Core file support. */
set_gdbarch_regset_from_core_section
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index d4c2cc3506f..1f0cb8f3809 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -2333,7 +2333,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
the i387 extended floating-point format. In fact, of all targets
in the GCC 2.95 tree, only OSF/1 does it different, and insists
on having a `long double' that's not `long' at all. */
- set_gdbarch_long_double_format (gdbarch, &floatformat_i387_ext);
+ set_gdbarch_long_double_format (gdbarch, floatformats_i387_ext);
/* Although the i387 extended floating-point has only 80 significant
bits, a `long double' actually takes up 96, probably to enforce
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index dfcc024acd8..1aed60d9982 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -336,6 +336,12 @@ const struct floatformat floatformat_ia64_ext =
floatformat_intbit_yes, "floatformat_ia64_ext", floatformat_valid
};
+const struct floatformat *floatformats_ia64_ext[2] =
+{
+ &floatformat_ia64_ext,
+ &floatformat_ia64_ext
+};
+
/* Extract ``len'' bits from an instruction bundle starting at
bit ``from''. */
@@ -3574,7 +3580,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
builtin_type_ia64_ext =
init_type (TYPE_CODE_FLT, 128 / 8,
0, "builtin_type_ia64_ext", NULL);
- TYPE_FLOATFORMAT (builtin_type_ia64_ext) = &floatformat_ia64_ext;
+ TYPE_FLOATFORMAT (builtin_type_ia64_ext) = floatformats_ia64_ext;
/* According to the ia64 specs, instructions that store long double
floats in memory use a long-double format different than that
@@ -3584,7 +3590,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
format for storing long doubles (e.g. HPUX). In the latter case,
the setting of the format may be moved/overridden in an
OS-specific tdep file. */
- set_gdbarch_long_double_format (gdbarch, &floatformat_i387_ext);
+ set_gdbarch_long_double_format (gdbarch, floatformats_i387_ext);
set_gdbarch_short_bit (gdbarch, 16);
set_gdbarch_int_bit (gdbarch, 32);
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index 1c494daebe6..dd3ff80e2d6 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -837,9 +837,9 @@ iq2000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
- set_gdbarch_float_format (gdbarch, & floatformat_ieee_single_big);
- set_gdbarch_double_format (gdbarch, & floatformat_ieee_double_big);
- set_gdbarch_long_double_format (gdbarch, & floatformat_ieee_double_big);
+ set_gdbarch_float_format (gdbarch, floatformats_ieee_single);
+ set_gdbarch_double_format (gdbarch, floatformats_ieee_double);
+ set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
set_gdbarch_return_value (gdbarch, iq2000_return_value);
set_gdbarch_breakpoint_from_pc (gdbarch, iq2000_breakpoint_from_pc);
set_gdbarch_frame_args_skip (gdbarch, 0);
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index ac2ec772829..55bb5b21fa8 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -1157,7 +1157,7 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep = xmalloc (sizeof (struct gdbarch_tdep));
gdbarch = gdbarch_alloc (&info, tdep);
- set_gdbarch_long_double_format (gdbarch, &floatformat_m68881_ext);
+ set_gdbarch_long_double_format (gdbarch, floatformats_m68881_ext);
set_gdbarch_long_double_bit (gdbarch, 96);
set_gdbarch_skip_prologue (gdbarch, m68k_skip_prologue);
diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c
index 1810f770953..77d1f2331e2 100644
--- a/gdb/m88k-tdep.c
+++ b/gdb/m88k-tdep.c
@@ -845,7 +845,7 @@ m88k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* There is no real `long double'. */
set_gdbarch_long_double_bit (gdbarch, 64);
- set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
+ set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
set_gdbarch_num_regs (gdbarch, M88K_NUM_REGS);
set_gdbarch_register_name (gdbarch, m88k_register_name);
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index 5ce51b25096..3da7522b79c 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -1154,10 +1154,7 @@ mips_linux_init_abi (struct gdbarch_info info,
the same 128-bit IEEE floating point format that IA-64 uses,
except that the quiet/signalling NaN bit is reversed (GDB
does not distinguish between quiet and signalling NaNs). */
- if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
- set_gdbarch_long_double_format (gdbarch, &floatformat_ia64_quad_big);
- else
- set_gdbarch_long_double_format (gdbarch, &floatformat_ia64_quad_little);
+ set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
tramp_frame_prepend_unwinder (gdbarch, &mips_linux_n32_rt_sigframe);
break;
case MIPS_ABI_N64:
@@ -1171,10 +1168,7 @@ mips_linux_init_abi (struct gdbarch_info info,
the same 128-bit IEEE floating point format that IA-64 uses,
except that the quiet/signalling NaN bit is reversed (GDB
does not distinguish between quiet and signalling NaNs). */
- if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
- set_gdbarch_long_double_format (gdbarch, &floatformat_ia64_quad_big);
- else
- set_gdbarch_long_double_format (gdbarch, &floatformat_ia64_quad_little);
+ set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
tramp_frame_prepend_unwinder (gdbarch, &mips_linux_n64_rt_sigframe);
break;
default:
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 99dd2f57945..f25c8a15bfb 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -179,10 +179,16 @@ static const struct floatformat floatformat_n32n64_long_double_big =
{
floatformat_big, 128, 0, 1, 11, 1023, 2047, 12, 52,
floatformat_intbit_no,
- "floatformat_ieee_double_big",
+ "floatformat_n32n64_long_double_big",
n32n64_floatformat_always_valid
};
+static const struct floatformat *floatformats_n32n64_long[BFD_ENDIAN_UNKNOWN] =
+{
+ &floatformat_n32n64_long_double_big,
+ &floatformat_n32n64_long_double_big
+};
+
const struct mips_regnum *
mips_regnum (struct gdbarch *gdbarch)
{
@@ -701,22 +707,10 @@ mips_register_type (struct gdbarch *gdbarch, int regnum)
{
/* The floating-point registers raw, or cooked, always match
mips_isa_regsize(), and also map 1:1, byte for byte. */
- switch (gdbarch_byte_order (gdbarch))
- {
- case BFD_ENDIAN_BIG:
- if (mips_isa_regsize (gdbarch) == 4)
- return builtin_type_ieee_single_big;
- else
- return builtin_type_ieee_double_big;
- case BFD_ENDIAN_LITTLE:
- if (mips_isa_regsize (gdbarch) == 4)
- return builtin_type_ieee_single_little;
- else
- return builtin_type_ieee_double_little;
- case BFD_ENDIAN_UNKNOWN:
- default:
- internal_error (__FILE__, __LINE__, _("bad switch"));
- }
+ if (mips_isa_regsize (gdbarch) == 4)
+ return builtin_type_ieee_single;
+ else
+ return builtin_type_ieee_double;
}
else if (regnum < NUM_REGS)
{
@@ -3867,19 +3861,13 @@ mips_o64_return_value (struct gdbarch *gdbarch,
static struct type *
mips_float_register_type (void)
{
- if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
- return builtin_type_ieee_single_big;
- else
- return builtin_type_ieee_single_little;
+ return builtin_type_ieee_single;
}
static struct type *
mips_double_register_type (void)
{
- if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
- return builtin_type_ieee_double_big;
- else
- return builtin_type_ieee_double_little;
+ return builtin_type_ieee_double;
}
/* Copy a 32-bit single-precision value from the current frame
@@ -5077,8 +5065,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_ptr_bit (gdbarch, 32);
set_gdbarch_long_long_bit (gdbarch, 64);
set_gdbarch_long_double_bit (gdbarch, 128);
- set_gdbarch_long_double_format (gdbarch,
- &floatformat_n32n64_long_double_big);
+ set_gdbarch_long_double_format (gdbarch, floatformats_n32n64_long);
break;
case MIPS_ABI_N64:
set_gdbarch_push_dummy_call (gdbarch, mips_n32n64_push_dummy_call);
@@ -5090,8 +5077,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_ptr_bit (gdbarch, 64);
set_gdbarch_long_long_bit (gdbarch, 64);
set_gdbarch_long_double_bit (gdbarch, 128);
- set_gdbarch_long_double_format (gdbarch,
- &floatformat_n32n64_long_double_big);
+ set_gdbarch_long_double_format (gdbarch, floatformats_n32n64_long);
break;
default:
internal_error (__FILE__, __LINE__, _("unknown ABI in switch"));
diff --git a/gdb/mt-tdep.c b/gdb/mt-tdep.c
index 63d0f2da6f1..386fe709bbc 100644
--- a/gdb/mt-tdep.c
+++ b/gdb/mt-tdep.c
@@ -1118,23 +1118,9 @@ mt_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
provided. */
gdbarch = gdbarch_alloc (&info, NULL);
- switch (info.byte_order)
- {
- case BFD_ENDIAN_BIG:
- set_gdbarch_float_format (gdbarch, &floatformat_ieee_single_big);
- set_gdbarch_double_format (gdbarch, &floatformat_ieee_double_big);
- set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
- break;
- case BFD_ENDIAN_LITTLE:
- set_gdbarch_float_format (gdbarch, &floatformat_ieee_single_little);
- set_gdbarch_double_format (gdbarch, &floatformat_ieee_double_little);
- set_gdbarch_long_double_format (gdbarch,
- &floatformat_ieee_double_little);
- break;
- default:
- internal_error (__FILE__, __LINE__,
- _("mt_gdbarch_init: bad byte order for float format"));
- }
+ set_gdbarch_float_format (gdbarch, floatformats_ieee_single_big);
+ set_gdbarch_double_format (gdbarch, floatformats_ieee_double_big);
+ set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double_big);
set_gdbarch_register_name (gdbarch, mt_register_name);
set_gdbarch_num_regs (gdbarch, MT_NUM_REGS);
diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
index 5d4290cef6a..ca465e2e0ed 100644
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -132,19 +132,8 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (write_pass)
{
char memval[8];
- struct type *memtype;
- switch (TARGET_BYTE_ORDER)
- {
- case BFD_ENDIAN_BIG:
- memtype = builtin_type_ieee_double_big;
- break;
- case BFD_ENDIAN_LITTLE:
- memtype = builtin_type_ieee_double_little;
- break;
- default:
- internal_error (__FILE__, __LINE__, _("bad switch"));
- }
- convert_typed_floating (val, type, memval, memtype);
+ convert_typed_floating (val, type, memval,
+ builtin_type_ieee_double);
write_memory (sp + argoffset, val, len);
}
argoffset += 8;
diff --git a/gdb/ppcobsd-tdep.c b/gdb/ppcobsd-tdep.c
index 89642b55cf5..dc76a1855e2 100644
--- a/gdb/ppcobsd-tdep.c
+++ b/gdb/ppcobsd-tdep.c
@@ -280,7 +280,7 @@ ppcobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
/* OpenBSD doesn't support the 128-bit `long double' from the psABI. */
set_gdbarch_long_double_bit (gdbarch, 64);
- set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
+ set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
/* OpenBSD currently uses a broken GCC. */
set_gdbarch_return_value (gdbarch, ppc_sysv_abi_broken_return_value);
diff --git a/gdb/sparc-linux-tdep.c b/gdb/sparc-linux-tdep.c
index 492efa7e29f..74a1d33c00b 100644
--- a/gdb/sparc-linux-tdep.c
+++ b/gdb/sparc-linux-tdep.c
@@ -246,7 +246,7 @@ sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* GNU/Linux doesn't support the 128-bit `long double' from the psABI. */
set_gdbarch_long_double_bit (gdbarch, 64);
- set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
+ set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 00e802bf5b7..a55687f03fc 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -65,7 +65,7 @@ struct regset;
/* The SPARC Floating-Point Quad-Precision format is similar to
big-endian IA-64 Quad-recision format. */
-#define floatformat_sparc_quad floatformat_ia64_quad_big
+#define floatformats_sparc_quad floatformats_ia64_quad
/* The stack pointer is offset from the stack frame by a BIAS of 2047
(0x7ff) for 64-bit code. BIAS is likely to be defined on SPARC
@@ -1296,7 +1296,7 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->step_trap = sparc_step_trap;
set_gdbarch_long_double_bit (gdbarch, 128);
- set_gdbarch_long_double_format (gdbarch, &floatformat_sparc_quad);
+ set_gdbarch_long_double_format (gdbarch, floatformats_sparc_quad);
set_gdbarch_num_regs (gdbarch, SPARC32_NUM_REGS);
set_gdbarch_register_name (gdbarch, sparc32_register_name);
diff --git a/gdb/sparcnbsd-tdep.c b/gdb/sparcnbsd-tdep.c
index 6c16a9bb57a..0b8d86ef85d 100644
--- a/gdb/sparcnbsd-tdep.c
+++ b/gdb/sparcnbsd-tdep.c
@@ -293,7 +293,7 @@ sparc32nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* NetBSD doesn't support the 128-bit `long double' from the psABI. */
set_gdbarch_long_double_bit (gdbarch, 64);
- set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
+ set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
tdep->gregset = regset_alloc (gdbarch, sparc32nbsd_supply_gregset, NULL);
tdep->sizeof_gregset = 20 * 4;
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 222b95f8f1b..ef8c1c65c95 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -1053,9 +1053,9 @@ spu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_float_bit (gdbarch, 32);
set_gdbarch_double_bit (gdbarch, 64);
set_gdbarch_long_double_bit (gdbarch, 64);
- set_gdbarch_float_format (gdbarch, &floatformat_ieee_single_big);
- set_gdbarch_double_format (gdbarch, &floatformat_ieee_double_big);
- set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
+ set_gdbarch_float_format (gdbarch, floatformats_ieee_single);
+ set_gdbarch_double_format (gdbarch, floatformats_ieee_double);
+ set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
/* Inferior function calls. */
set_gdbarch_push_dummy_call (gdbarch, spu_push_dummy_call);
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index 52d32b211fc..877e02dd3b7 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -477,10 +477,10 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
gdbarch = gdbarch_alloc (&info, NULL);
- set_gdbarch_float_format (gdbarch, &floatformat_vax_f);
- set_gdbarch_double_format (gdbarch, &floatformat_vax_d);
- set_gdbarch_long_double_format (gdbarch, &floatformat_vax_d);
- set_gdbarch_long_double_bit(gdbarch, 64);
+ set_gdbarch_float_format (gdbarch, floatformats_vax_f);
+ set_gdbarch_double_format (gdbarch, floatformats_vax_d);
+ set_gdbarch_long_double_format (gdbarch, floatformats_vax_d);
+ set_gdbarch_long_double_bit (gdbarch, 64);
/* Register info */
set_gdbarch_num_regs (gdbarch, VAX_NUM_REGS);