2003-04-09 Andrew Cagney <cagney@redhat.com>

* doublest.h: Update copyright.
	(deprecated_store_floating, deprecated_extract_floating): Rename
	store_floating and extract_floating.  Update comments.
	* doublest.c: Update copyright.
	(extract_floating_by_length): Replace extract_floating.
	(store_floating_by_length): Replace store_floating.
	(deprecated_extract_floating): New function.
	(deprecated_store_floating): New function.
	(extract_typed_floating): Call extract_floating_by_length.
	(store_typed_floating): Call store_floating_by_length.
	* x86-64-tdep.c (x86_64_store_return_value): Update.
	* sh-tdep.c (sh3e_sh4_extract_return_value): Update.
	(sh64_extract_return_value): Update.
	(sh_sh4_register_convert_to_virtual): Update.
	(sh_sh64_register_convert_to_virtual): Update.
	(sh_sh4_register_convert_to_raw): Update.
	(sh_sh64_register_convert_to_raw): Update.
	* rs6000-tdep.c (rs6000_register_convert_to_virtual): Update.
	(rs6000_register_convert_to_raw): Update.
	* ia64-tdep.c (ia64_register_convert_to_virtual): Update.
	(ia64_register_convert_to_raw): Update.
	* config/i386/tm-symmetry.h (REGISTER_CONVERT_TO_RAW): Update.
	(REGISTER_CONVERT_TO_VIRTUAL): Update.
	* arm-linux-tdep.c (arm_linux_push_arguments): Update.
	* alpha-tdep.c (alpha_register_convert_to_virtual): Update.
	(alpha_register_convert_to_raw): Update.
This commit is contained in:
Andrew Cagney 2003-04-09 15:08:27 +00:00
parent d4b6ee6788
commit f190828974
10 changed files with 89 additions and 38 deletions

View File

@ -1,3 +1,32 @@
2003-04-09 Andrew Cagney <cagney@redhat.com>
* doublest.h: Update copyright.
(deprecated_store_floating, deprecated_extract_floating): Rename
store_floating and extract_floating. Update comments.
* doublest.c: Update copyright.
(extract_floating_by_length): Replace extract_floating.
(store_floating_by_length): Replace store_floating.
(deprecated_extract_floating): New function.
(deprecated_store_floating): New function.
(extract_typed_floating): Call extract_floating_by_length.
(store_typed_floating): Call store_floating_by_length.
* x86-64-tdep.c (x86_64_store_return_value): Update.
* sh-tdep.c (sh3e_sh4_extract_return_value): Update.
(sh64_extract_return_value): Update.
(sh_sh4_register_convert_to_virtual): Update.
(sh_sh64_register_convert_to_virtual): Update.
(sh_sh4_register_convert_to_raw): Update.
(sh_sh64_register_convert_to_raw): Update.
* rs6000-tdep.c (rs6000_register_convert_to_virtual): Update.
(rs6000_register_convert_to_raw): Update.
* ia64-tdep.c (ia64_register_convert_to_virtual): Update.
(ia64_register_convert_to_raw): Update.
* config/i386/tm-symmetry.h (REGISTER_CONVERT_TO_RAW): Update.
(REGISTER_CONVERT_TO_VIRTUAL): Update.
* arm-linux-tdep.c (arm_linux_push_arguments): Update.
* alpha-tdep.c (alpha_register_convert_to_virtual): Update.
(alpha_register_convert_to_raw): Update.
2003-04-08 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (SAVED_PC_AFTER_CALL): Add a predicate.

View File

@ -1458,8 +1458,8 @@ alpha_register_convert_to_virtual (int regnum, struct type *valtype,
if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
{
double d = extract_floating (raw_buffer, REGISTER_RAW_SIZE (regnum));
store_floating (virtual_buffer, TYPE_LENGTH (valtype), d);
double d = deprecated_extract_floating (raw_buffer, REGISTER_RAW_SIZE (regnum));
deprecated_store_floating (virtual_buffer, TYPE_LENGTH (valtype), d);
}
else if (TYPE_CODE (valtype) == TYPE_CODE_INT && TYPE_LENGTH (valtype) <= 4)
{
@ -1484,8 +1484,8 @@ alpha_register_convert_to_raw (struct type *valtype, int regnum,
if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
{
double d = extract_floating (virtual_buffer, TYPE_LENGTH (valtype));
store_floating (raw_buffer, REGISTER_RAW_SIZE (regnum), d);
double d = deprecated_extract_floating (virtual_buffer, TYPE_LENGTH (valtype));
deprecated_store_floating (raw_buffer, REGISTER_RAW_SIZE (regnum), d);
}
else if (TYPE_CODE (valtype) == TYPE_CODE_INT && TYPE_LENGTH (valtype) <= 4)
{

View File

@ -181,10 +181,10 @@ arm_linux_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
if (TYPE_CODE_FLT == typecode && REGISTER_SIZE == len)
{
DOUBLEST dblval;
dblval = extract_floating (val, len);
dblval = deprecated_extract_floating (val, len);
len = TARGET_DOUBLE_BIT / TARGET_CHAR_BIT;
val = alloca (len);
store_floating (val, len, dblval);
deprecated_store_floating (val, len, dblval);
}
/* If the argument is a pointer to a function, and it is a Thumb

View File

@ -236,7 +236,7 @@ switch (regno) { \
{ \
DOUBLEST val; \
floatformat_to_doublest (&floatformat_i387_ext, (FROM), &val); \
store_floating ((TO), TYPE_LENGTH (TYPE), val); \
deprecated_store_floating ((TO), TYPE_LENGTH (TYPE), val); \
}
/* Convert data from virtual format with type TYPE in buffer FROM
@ -245,7 +245,7 @@ switch (regno) { \
#undef REGISTER_CONVERT_TO_RAW
#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
{ \
DOUBLEST val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
DOUBLEST val = deprecated_extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
floatformat_from_doublest (&floatformat_i387_ext, &val, (TO)); \
}

View File

@ -1,7 +1,8 @@
/* Floating point routines for GDB, the GNU debugger.
Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
1996, 1997, 1998, 1999, 2000, 2001, 2003 Free Software Foundation,
Inc.
This file is part of GDB.
@ -663,8 +664,8 @@ floatformat_from_type (const struct type *type)
/* Extract a floating-point number of length LEN from a target-order
byte-stream at ADDR. Returns the value as type DOUBLEST. */
DOUBLEST
extract_floating (const void *addr, int len)
static DOUBLEST
extract_floating_by_length (const void *addr, int len)
{
const struct floatformat *fmt = floatformat_from_length (len);
DOUBLEST val;
@ -679,11 +680,17 @@ extract_floating (const void *addr, int len)
return val;
}
DOUBLEST
deprecated_extract_floating (const void *addr, int len)
{
return extract_floating_by_length (addr, len);
}
/* Store VAL as a floating-point number of length LEN to a
target-order byte-stream at ADDR. */
void
store_floating (void *addr, int len, DOUBLEST val)
static void
store_floating_by_length (void *addr, int len, DOUBLEST val)
{
const struct floatformat *fmt = floatformat_from_length (len);
@ -697,6 +704,12 @@ store_floating (void *addr, int len, DOUBLEST val)
floatformat_from_doublest (fmt, &val, addr);
}
void
deprecated_store_floating (void *addr, int len, DOUBLEST val)
{
store_floating_by_length (addr, len, val);
}
/* Extract a floating-point number of type TYPE from a target-order
byte-stream at ADDR. Returns the value as type DOUBLEST. */
@ -708,7 +721,9 @@ extract_typed_floating (const void *addr, const struct type *type)
gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
if (TYPE_FLOATFORMAT (type) == NULL)
return extract_floating (addr, TYPE_LENGTH (type));
/* Not all code remembers to set the FLOATFORMAT (language
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);
return retval;
@ -743,7 +758,9 @@ store_typed_floating (void *addr, const struct type *type, DOUBLEST val)
memset (addr, 0, TYPE_LENGTH (type));
if (TYPE_FLOATFORMAT (type) == NULL)
store_floating (addr, TYPE_LENGTH (type), val);
/* Not all code remembers to set the FLOATFORMAT (language
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);
}

View File

@ -1,7 +1,8 @@
/* Floating point definitions for GDB.
Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
1996, 1997, 1998, 1999, 2000, 2001, 2003 Free Software Foundation,
Inc.
This file is part of GDB.
@ -59,12 +60,16 @@ extern int floatformat_is_negative (const struct floatformat *, char *);
extern int floatformat_is_nan (const struct floatformat *, char *);
extern char *floatformat_mantissa (const struct floatformat *, char *);
/* These two functions are deprecated in favour of
extract_typed_floating and store_typed_floating. See comments in
'doublest.c' for details. */
/* These functions have been replaced by extract_typed_floating and
store_typed_floating.
extern DOUBLEST extract_floating (const void *addr, int len);
extern void store_floating (void *addr, int len, DOUBLEST val);
Most calls are passing in TYPE_LENGTH (TYPE) so can be changed to
just pass the TYPE. The remainder pass in the length of a
register, those calls should instead pass in the floating point
type that corresponds to that length. */
extern DOUBLEST deprecated_extract_floating (const void *addr, int len);
extern void deprecated_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

View File

@ -273,7 +273,7 @@ ia64_register_convert_to_virtual (int regnum, struct type *type,
{
DOUBLEST val;
floatformat_to_doublest (&floatformat_ia64_ext, from, &val);
store_floating(to, TYPE_LENGTH(type), val);
deprecated_store_floating (to, TYPE_LENGTH(type), val);
}
else
error("ia64_register_convert_to_virtual called with non floating point register number");
@ -285,7 +285,7 @@ ia64_register_convert_to_raw (struct type *type, int regnum,
{
if (regnum >= IA64_FR0_REGNUM && regnum <= IA64_FR127_REGNUM)
{
DOUBLEST val = extract_floating (from, TYPE_LENGTH(type));
DOUBLEST val = deprecated_extract_floating (from, TYPE_LENGTH(type));
floatformat_from_doublest (&floatformat_ia64_ext, &val, to);
}
else

View File

@ -1892,8 +1892,8 @@ rs6000_register_convert_to_virtual (int n, struct type *type,
{
if (TYPE_LENGTH (type) != REGISTER_RAW_SIZE (n))
{
double val = extract_floating (from, REGISTER_RAW_SIZE (n));
store_floating (to, TYPE_LENGTH (type), val);
double val = deprecated_extract_floating (from, REGISTER_RAW_SIZE (n));
deprecated_store_floating (to, TYPE_LENGTH (type), val);
}
else
memcpy (to, from, REGISTER_RAW_SIZE (n));
@ -1908,8 +1908,8 @@ rs6000_register_convert_to_raw (struct type *type, int n,
{
if (TYPE_LENGTH (type) != REGISTER_RAW_SIZE (n))
{
double val = extract_floating (from, TYPE_LENGTH (type));
store_floating (to, REGISTER_RAW_SIZE (n), val);
double val = deprecated_extract_floating (from, TYPE_LENGTH (type));
deprecated_store_floating (to, REGISTER_RAW_SIZE (n), val);
}
else
memcpy (to, from, REGISTER_RAW_SIZE (n));

View File

@ -2414,7 +2414,7 @@ sh3e_sh4_extract_return_value (struct type *type, char *regbuf, char *valbuf)
floatformat_to_doublest (&floatformat_ieee_double_big,
(char *) regbuf + REGISTER_BYTE (return_register),
&val);
store_floating (valbuf, len, val);
deprecated_store_floating (valbuf, len, val);
}
else if (len <= 4)
{
@ -2467,7 +2467,7 @@ sh64_extract_return_value (struct type *type, char *regbuf, char *valbuf)
else
floatformat_to_doublest (&floatformat_ieee_double_big,
(char *) regbuf + offset, &val);
store_floating (valbuf, len, val);
deprecated_store_floating (valbuf, len, val);
}
}
else
@ -3403,7 +3403,7 @@ sh_sh4_register_convert_to_virtual (int regnum, struct type *type,
{
DOUBLEST val;
floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword, from, &val);
store_floating (to, TYPE_LENGTH (type), val);
deprecated_store_floating (to, TYPE_LENGTH (type), val);
}
else
error ("sh_register_convert_to_virtual called with non DR register number");
@ -3429,7 +3429,7 @@ sh_sh64_register_convert_to_virtual (int regnum, struct type *type,
{
DOUBLEST val;
floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword, from, &val);
store_floating(to, TYPE_LENGTH(type), val);
deprecated_store_floating(to, TYPE_LENGTH(type), val);
}
else
error("sh_register_convert_to_virtual called with non DR register number");
@ -3444,7 +3444,7 @@ sh_sh4_register_convert_to_raw (struct type *type, int regnum,
if (regnum >= tdep->DR0_REGNUM
&& regnum <= tdep->DR_LAST_REGNUM)
{
DOUBLEST val = extract_floating (from, TYPE_LENGTH(type));
DOUBLEST val = deprecated_extract_floating (from, TYPE_LENGTH(type));
floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword, &val, to);
}
else
@ -3469,7 +3469,7 @@ sh_sh64_register_convert_to_raw (struct type *type, int regnum,
|| (regnum >= tdep->DR0_C_REGNUM
&& regnum <= tdep->DR_LAST_C_REGNUM))
{
DOUBLEST val = extract_floating (from, TYPE_LENGTH(type));
DOUBLEST val = deprecated_extract_floating (from, TYPE_LENGTH(type));
floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword, &val, to);
}
else

View File

@ -781,7 +781,7 @@ x86_64_store_return_value (struct type *type, struct regcache *regcache,
floating point format used by the FPU. This is probably
not exactly how it would happen on the target itself, but
it is the best we can do. */
val = extract_floating (valbuf, TYPE_LENGTH (type));
val = deprecated_extract_floating (valbuf, TYPE_LENGTH (type));
floatformat_from_doublest (&floatformat_i387_ext, &val, buf);
regcache_cooked_write_part (regcache, FP0_REGNUM,
0, FPU_REG_RAW_SIZE, buf);