This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch rfc] Deprecate extract_floating() and store_floating()
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 06 Apr 2003 14:06:33 -0400
- Subject: [patch rfc] Deprecate extract_floating() and store_floating()
Hello,
This follows up a very long standing comment in "doublest.h" by
explicitly deprecating these functions.
Baring comment, I'll commit in a day or so.
Andrew
2003-04-06 Andrew Cagney <cagney at redhat dot 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.
Index: alpha-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/alpha-tdep.c,v
retrieving revision 1.75
diff -u -r1.75 alpha-tdep.c
--- alpha-tdep.c 1 Apr 2003 17:17:27 -0000 1.75
+++ alpha-tdep.c 6 Apr 2003 18:03:28 -0000
@@ -1458,8 +1458,8 @@
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 @@
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)
{
Index: arm-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-linux-tdep.c,v
retrieving revision 1.28
diff -u -r1.28 arm-linux-tdep.c
--- arm-linux-tdep.c 26 Mar 2003 22:39:52 -0000 1.28
+++ arm-linux-tdep.c 6 Apr 2003 18:03:28 -0000
@@ -181,10 +181,10 @@
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
Index: doublest.c
===================================================================
RCS file: /cvs/src/src/gdb/doublest.c,v
retrieving revision 1.13
diff -u -r1.13 doublest.c
--- doublest.c 11 Mar 2003 16:38:52 -0000 1.13
+++ doublest.c 6 Apr 2003 18:03:29 -0000
@@ -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 @@
/* 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 @@
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 @@
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 @@
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 @@
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);
}
Index: doublest.h
===================================================================
RCS file: /cvs/src/src/gdb/doublest.h,v
retrieving revision 1.9
diff -u -r1.9 doublest.h
--- doublest.h 10 Feb 2002 02:47:11 -0000 1.9
+++ doublest.h 6 Apr 2003 18:03:29 -0000
@@ -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_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.
+
+ 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 extract_floating (const void *addr, int len);
-extern void store_floating (void *addr, int len, DOUBLEST val);
+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
Index: ia64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-tdep.c,v
retrieving revision 1.67
diff -u -r1.67 ia64-tdep.c
--- ia64-tdep.c 5 Apr 2003 18:54:38 -0000 1.67
+++ ia64-tdep.c 6 Apr 2003 18:03:30 -0000
@@ -273,7 +273,7 @@
{
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,8 +285,8 @@
{
if (regnum >= IA64_FR0_REGNUM && regnum <= IA64_FR127_REGNUM)
{
- DOUBLEST val = extract_floating (from, TYPE_LENGTH(type));
- floatformat_from_doublest (&floatformat_ia64_ext, &val, to);
+ DOUBLEST val = deprecated_extract_floating (from, TYPE_LENGTH(type));
+ deprecated_floatformat_from_doublest (&floatformat_ia64_ext, &val, to);
}
else
error("ia64_register_convert_to_raw called with non floating point register number");
Index: rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.124
diff -u -r1.124 rs6000-tdep.c
--- rs6000-tdep.c 5 Apr 2003 18:54:38 -0000 1.124
+++ rs6000-tdep.c 6 Apr 2003 18:03:31 -0000
@@ -1892,8 +1892,8 @@
{
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 @@
{
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));
Index: sh-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sh-tdep.c,v
retrieving revision 1.115
diff -u -r1.115 sh-tdep.c
--- sh-tdep.c 5 Apr 2003 18:54:38 -0000 1.115
+++ sh-tdep.c 6 Apr 2003 18:03:33 -0000
@@ -2414,7 +2414,7 @@
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 @@
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 @@
{
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 @@
{
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 @@
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 @@
|| (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
Index: x86-64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/x86-64-tdep.c,v
retrieving revision 1.62
diff -u -r1.62 x86-64-tdep.c
--- x86-64-tdep.c 4 Apr 2003 21:04:33 -0000 1.62
+++ x86-64-tdep.c 6 Apr 2003 18:03:33 -0000
@@ -781,7 +781,7 @@
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);
Index: config/i386/tm-symmetry.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/tm-symmetry.h,v
retrieving revision 1.12
diff -u -r1.12 tm-symmetry.h
--- config/i386/tm-symmetry.h 26 Mar 2003 22:39:53 -0000 1.12
+++ config/i386/tm-symmetry.h 6 Apr 2003 18:03:34 -0000
@@ -236,7 +236,7 @@
{ \
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 @@
#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)); \
}