+2002-01-20 Andrew Cagney <ac131313@redhat.com>
+
+ * doublest.h (floatformat_from_type): Declare.
+ * doublest.c (floatformat_from_type): New function.
+ (convert_typed_floating): Use.
+
+ * valprint.c (print_floating): Replace checks for IEEE_FLOAT with
+ call to function floatformat_from_type.
+
+ * gdbarch.sh (IEEE_FLOAT): Delete.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * config/i960/tm-i960.h (IEEE_FLOAT): Delete macro.
+ * config/i386/tm-i386.h (IEEE_FLOAT): Ditto.
+ * config/z8k/tm-z8k.h (IEEE_FLOAT): Ditto.
+ * config/sparc/tm-sparc.h (IEEE_FLOAT): Ditto.
+ * config/pa/tm-hppa.h (IEEE_FLOAT): Ditto.
+ * config/m88k/tm-m88k.h (IEEE_FLOAT): Ditto.
+ * config/m68k/tm-m68k.h (IEEE_FLOAT): Ditto.
+ * config/h8500/tm-h8500.h (IEEE_FLOAT): Ditto.
+ * config/h8300/tm-h8300.h (IEEE_FLOAT): Ditto.
+ * config/fr30/tm-fr30.h (IEEE_FLOAT): Ditto.
+ * config/arm/tm-arm.h (IEEE_FLOAT): Ditto.
+ * config/arc/tm-arc.h (IEEE_FLOAT): Ditto.
+ * config/alpha/tm-alpha.h (IEEE_FLOAT): Ditto.
+
+ * s390-tdep.c (s390_gdbarch_init): Do not set ieee_float.
+ * x86-64-tdep.c (i386_gdbarch_init): Ditto.
+ * sparc-tdep.c (sparc_gdbarch_init): Ditto.
+ * sh-tdep.c (sh_gdbarch_init): Ditto.
+ * mips-tdep.c (mips_gdbarch_init): Ditto.
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto.
+ * cris-tdep.c (cris_gdbarch_init): Ditto.
+
2002-01-20 Jiri Smid <smid@suse.cz>
* configure.host, configure.tgt: Support x86-64.
#define TARGET_LONG_LONG_BIT 64
#define TARGET_PTR_BIT 64
-/* Floating point is IEEE compliant */
-#define IEEE_FLOAT (1)
-
/* Number of traps that happen between exec'ing the shell
* to run an inferior, and when we finally get to
* the inferior code. This is 2 on most implementations.
/* Byte order is selectable. */
#define TARGET_BYTE_ORDER_SELECTABLE
-/* We have IEEE floating point, if we have any float at all. */
-#define IEEE_FLOAT (1)
-
/* Offset from address of function to start of its code.
Zero on most machines. */
#define FUNCTION_START_OFFSET 0
#define TARGET_BYTE_ORDER_DEFAULT BFD_ENDIAN_LITTLE
/* IEEE format floating point. */
-#define IEEE_FLOAT (1)
#define TARGET_DOUBLE_FORMAT (target_byte_order == BFD_ENDIAN_BIG \
? &floatformat_ieee_double_big \
: &floatformat_ieee_double_littlebyte_bigword)
/* Define this for Wingdb */
#define TARGET_FR30
-/* IEEE format floating point */
-#define IEEE_FLOAT (1)
-
/* Define other aspects of the stack frame. */
/* An expression that tells us whether the function invocation represented
extern void h8300_init_extra_frame_info ();
-#define IEEE_FLOAT (1)
/* Define the bit, byte, and word ordering of the machine. */
#define TARGET_BYTE_ORDER BFD_ENDIAN_BIG
#undef TARGET_INT_BIT
#define GDB_TARGET_IS_H8500
-#define IEEE_FLOAT (1)
-
/* Define the bit, byte, and word ordering of the machine. */
#define TARGET_BYTE_ORDER BFD_ENDIAN_BIG
#define TARGET_LONG_DOUBLE_BIT 96
-/* Used for example in valprint.c:print_floating() to enable checking
- for NaN's */
-
-#define IEEE_FLOAT (1)
-
/* Number of traps that happen between exec'ing the shell to run an
inferior, and when we finally get to the inferior code. This is 2
on most implementations. */
/* Byte order is configurable, but this machine runs little-endian. */
#define TARGET_BYTE_ORDER BFD_ENDIAN_LITTLE
-/* We have IEEE floating point, if we have any float at all. */
-
-#define IEEE_FLOAT (1)
-
/* Offset from address of function to start of its code.
Zero on most machines. */
/* Generic 68000 stuff, to be included by other tm-*.h files. */
-#define IEEE_FLOAT (1)
-
/* Define the bit, byte, and word ordering of the machine. */
#define TARGET_BYTE_ORDER BFD_ENDIAN_BIG
init_extra_frame_info (fromleaf, fi)
extern void init_extra_frame_info ();
-#define IEEE_FLOAT (1)
-
/* Offset from address of function to start of its code.
Zero on most machines. */
((X) >> (31 - (TO)) & ((1 << ((TO) - (FROM) + 1)) - 1))
#endif
-/* Watch out for NaNs */
-
-#define IEEE_FLOAT (1)
-
/* On the PA, any pass-by-value structure > 8 bytes is actually
passed via a pointer regardless of its type or the compiler
used. */
#define STACK_ALIGN(ADDR) sparc32_stack_align (ADDR)
extern CORE_ADDR sparc32_stack_align (CORE_ADDR addr);
-/* Floating point is IEEE compatible. */
-#define IEEE_FLOAT (1)
-
/* The Sparc returns long doubles on the stack. */
#define RETURN_VALUE_ON_STACK(TYPE) \
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#define IEEE_FLOAT (1)
-
#undef TARGET_INT_BIT
#undef TARGET_LONG_BIT
#undef TARGET_SHORT_BIT
which means we have to set this explicitly. */
set_gdbarch_long_double_bit (gdbarch, 64);
- /* Floating point is IEEE compatible. */
- set_gdbarch_ieee_float (gdbarch, 1);
-
/* There are 32 registers (some of which may not be implemented). */
set_gdbarch_num_regs (gdbarch, 32);
set_gdbarch_sp_regnum (gdbarch, 14);
+2002-01-20 Andrew Cagney <ac131313@redhat.com>
+
+ * gdbint.texinfo (Target Architecture Definition): Remove
+ definition of IEEE_FLOAT.
+
2002-01-20 Eli Zaretskii <eliz@is.elta.co.il>
* gdb.texinfo: Beautify copyright years; fix a typo.
@samp{$} or @samp{$$}. For example, @code{$$dyncall} is a millicode
routine that handles inter-space procedure calls on PA-RISC.
-@item IEEE_FLOAT
-@findex IEEE_FLOAT
-Define this if the target system uses IEEE-format floating point numbers.
-
@item INIT_EXTRA_FRAME_INFO (@var{fromleaf}, @var{frame})
@findex INIT_EXTRA_FRAME_INFO
If additional information about the frame is required this should be
target-dependent code, the format of floating-point types is known,
but not passed on by GDB. This should be fixed. */
-static const struct floatformat *
+const struct floatformat *
floatformat_from_length (int len)
{
if (len * TARGET_CHAR_BIT == TARGET_FLOAT_BIT)
return NULL;
}
+const struct floatformat *
+floatformat_from_type (const struct type *type)
+{
+ gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
+ if (TYPE_FLOATFORMAT (type) != NULL)
+ return TYPE_FLOATFORMAT (type);
+ else
+ return floatformat_from_length (TYPE_LENGTH (type));
+}
+
/* If the host doesn't define NAN, use zero instead. */
#ifndef NAN
#define NAN 0.0
convert_typed_floating (const void *from, const struct type *from_type,
void *to, const struct type *to_type)
{
- const struct floatformat *from_fmt = TYPE_FLOATFORMAT (from_type);
- const struct floatformat *to_fmt = TYPE_FLOATFORMAT (to_type);
+ const struct floatformat *from_fmt = floatformat_from_type (from_type);
+ const struct floatformat *to_fmt = floatformat_from_type (to_type);
gdb_assert (TYPE_CODE (from_type) == TYPE_CODE_FLT);
gdb_assert (TYPE_CODE (to_type) == TYPE_CODE_FLT);
- /* If the floating-point format of FROM_TYPE or TO_TYPE isn't known,
- try to guess it from the type's length. */
- if (from_fmt == NULL)
- from_fmt = floatformat_from_length (TYPE_LENGTH (from_type));
- if (to_fmt == NULL)
- to_fmt = floatformat_from_length (TYPE_LENGTH (to_type));
-
if (from_fmt == NULL || to_fmt == NULL)
{
/* If we don't know the floating-point format of FROM_TYPE or
extern DOUBLEST extract_floating (const void *addr, int len);
extern void store_floating (void *addr, int len, DOUBLEST val);
+/* Given TYPE, return its floatformat. TYPE_FLOATFORMAT() may return
+ NULL. type_floatformat() detects that and returns a floatformat
+ based on the type size when FLOATFORMAT is NULL. */
+
+const struct floatformat *floatformat_from_type (const struct type *type);
+
extern DOUBLEST extract_typed_floating (const void *addr,
const struct type *type);
extern void store_typed_floating (void *addr, const struct type *type,
int addr_bit;
int bfd_vma_bit;
int char_signed;
- int ieee_float;
gdbarch_read_pc_ftype *read_pc;
gdbarch_write_pc_ftype *write_pc;
gdbarch_read_fp_ftype *read_fp;
0,
0,
0,
- 0,
generic_register_raw_size,
0,
generic_register_virtual_size,
/* Skip verify of bfd_vma_bit, invalid_p == 0 */
if (gdbarch->char_signed == -1)
gdbarch->char_signed = 1;
- /* Skip verify of ieee_float, invalid_p == 0 */
/* Skip verify of read_pc, invalid_p == 0 */
/* Skip verify of write_pc, invalid_p == 0 */
/* Skip verify of read_fp, invalid_p == 0 */
(long) current_gdbarch->get_saved_register
/*GET_SAVED_REGISTER ()*/);
#endif
-#ifdef IEEE_FLOAT
- fprintf_unfiltered (file,
- "gdbarch_dump: IEEE_FLOAT # %s\n",
- XSTRING (IEEE_FLOAT));
- fprintf_unfiltered (file,
- "gdbarch_dump: IEEE_FLOAT = %d\n",
- IEEE_FLOAT);
-#endif
#ifdef INIT_EXTRA_FRAME_INFO
#if GDB_MULTI_ARCH
/* Macro might contain `[{}]' when not multi-arch */
gdbarch->char_signed = char_signed;
}
-int
-gdbarch_ieee_float (struct gdbarch *gdbarch)
-{
- /* Skip verify of ieee_float, invalid_p == 0 */
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_ieee_float called\n");
- return gdbarch->ieee_float;
-}
-
-void
-set_gdbarch_ieee_float (struct gdbarch *gdbarch,
- int ieee_float)
-{
- gdbarch->ieee_float = ieee_float;
-}
-
CORE_ADDR
gdbarch_read_pc (struct gdbarch *gdbarch, ptid_t ptid)
{
#endif
#endif
-/* Default (value) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (IEEE_FLOAT)
-#define IEEE_FLOAT (0)
-#endif
-
-extern int gdbarch_ieee_float (struct gdbarch *gdbarch);
-extern void set_gdbarch_ieee_float (struct gdbarch *gdbarch, int ieee_float);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (IEEE_FLOAT)
-#error "Non multi-arch definition of IEEE_FLOAT"
-#endif
-#if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (IEEE_FLOAT)
-#define IEEE_FLOAT (gdbarch_ieee_float (current_gdbarch))
-#endif
-#endif
-
/* Default (function) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (TARGET_READ_PC)
#define TARGET_READ_PC(ptid) (generic_target_read_pc (ptid))
# One if \`char' acts like \`signed char', zero if \`unsigned char'.
v::TARGET_CHAR_SIGNED:int:char_signed::::1:-1:1::::
#
-v::IEEE_FLOAT:int:ieee_float::::0:0::0:::
-#
f::TARGET_READ_PC:CORE_ADDR:read_pc:ptid_t ptid:ptid::0:generic_target_read_pc::0
f::TARGET_WRITE_PC:void:write_pc:CORE_ADDR val, ptid_t ptid:val, ptid::0:generic_target_write_pc::0
f::TARGET_READ_FP:CORE_ADDR:read_fp:void:::0:generic_target_read_fp::0
set_gdbarch_stack_align (gdbarch, m68hc11_stack_align);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
- set_gdbarch_ieee_float (gdbarch, 1);
return gdbarch;
}
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_breakpoint_from_pc (gdbarch, mips_breakpoint_from_pc);
set_gdbarch_decr_pc_after_break (gdbarch, 0);
- set_gdbarch_ieee_float (gdbarch, 1);
set_gdbarch_skip_prologue (gdbarch, mips_skip_prologue);
set_gdbarch_saved_pc_after_call (gdbarch, mips_saved_pc_after_call);
but not always. */
set_gdbarch_decr_pc_after_break (gdbarch, 2);
set_gdbarch_pop_frame (gdbarch, s390_pop_frame);
- set_gdbarch_ieee_float (gdbarch, 1);
/* Stack grows downward. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
/* Offset from address of function to start of its code.
set_gdbarch_saved_pc_after_call (gdbarch, sh_saved_pc_after_call);
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
- set_gdbarch_ieee_float (gdbarch, 1);
return gdbarch;
}
set_gdbarch_frameless_function_invocation (gdbarch,
frameless_look_for_prologue);
set_gdbarch_get_saved_register (gdbarch, sparc_get_saved_register);
- set_gdbarch_ieee_float (gdbarch, 1);
set_gdbarch_init_extra_frame_info (gdbarch, sparc_init_extra_frame_info);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT);
{
DOUBLEST doub;
int inv;
- const struct floatformat *fmt = &floatformat_unknown;
+ const struct floatformat *fmt = floatformat_from_type (type);
unsigned len = TYPE_LENGTH (type);
- /* FIXME: kettenis/2001-01-20: The check for IEEE_FLOAT is probably
- still necessary since GDB by default assumes that the target uses
- the IEEE 754 representation for its floats and doubles. Of
- course this is all crock and should be cleaned up. */
-
- if (len == TARGET_FLOAT_BIT / TARGET_CHAR_BIT && IEEE_FLOAT)
- fmt = TARGET_FLOAT_FORMAT;
- else if (len == TARGET_DOUBLE_BIT / TARGET_CHAR_BIT && IEEE_FLOAT)
- fmt = TARGET_DOUBLE_FORMAT;
- else if (len == TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT)
- fmt = TARGET_LONG_DOUBLE_FORMAT;
-
if (floatformat_is_nan (fmt, valaddr))
{
if (floatformat_is_negative (fmt, valaddr))
return;
}
+ /* FIXME: cagney/2002-01-15: The simpler extract_typed_floating()
+ routine could be used here only that routine has no way of
+ indicating that the floating point it extracted was invalid (As
+ indicated by INVALID_FLOAT). Instead, this code here could call
+ something like floating_invalid() to check for an invalid
+ floating point. */
+
doub = unpack_double (type, valaddr, &inv);
if (inv)
{
/* FIXME: kettenis/2001-01-20: The following code makes too much
assumptions about the host and target floating point format. */
+ /* FIXME: cagney/2002-01-15: The floatformat pointed to by FMT
+ should contain all the information needed to print the
+ floating-point value without host dependencies. */
+
if (len < sizeof (double))
fprintf_filtered (stream, "%.9g", (double) doub);
else if (len == sizeof (double))
set_gdbarch_ptr_bit (gdbarch, 64);
set_gdbarch_long_double_format (gdbarch, &floatformat_i387_ext);
- set_gdbarch_ieee_float (gdbarch, 1);
-
set_gdbarch_num_regs (gdbarch, X86_64_NUM_REGS);
set_gdbarch_register_name (gdbarch, x86_64_register_name);