From f19082897468918a09a26b5e962e09f97052abe7 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Wed, 9 Apr 2003 15:08:27 +0000 Subject: [PATCH] 2003-04-09 Andrew Cagney * 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. --- gdb/ChangeLog | 29 +++++++++++++++++++++++++++++ gdb/alpha-tdep.c | 8 ++++---- gdb/arm-linux-tdep.c | 4 ++-- gdb/config/i386/tm-symmetry.h | 4 ++-- gdb/doublest.c | 35 ++++++++++++++++++++++++++--------- gdb/doublest.h | 21 +++++++++++++-------- gdb/ia64-tdep.c | 4 ++-- gdb/rs6000-tdep.c | 8 ++++---- gdb/sh-tdep.c | 12 ++++++------ gdb/x86-64-tdep.c | 2 +- 10 files changed, 89 insertions(+), 38 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a86fe644a7a..8c4ec78c121 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,32 @@ +2003-04-09 Andrew Cagney + + * 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 * gdbarch.sh (SAVED_PC_AFTER_CALL): Add a predicate. diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index fc61140d3cb..2cbec4ef413 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -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) { diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index fa4d8fa00ca..781d4204a2c 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -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 diff --git a/gdb/config/i386/tm-symmetry.h b/gdb/config/i386/tm-symmetry.h index ea2229090e7..282556201c6 100644 --- a/gdb/config/i386/tm-symmetry.h +++ b/gdb/config/i386/tm-symmetry.h @@ -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)); \ } diff --git a/gdb/doublest.c b/gdb/doublest.c index 3f68273877c..101240b5b6d 100644 --- a/gdb/doublest.c +++ b/gdb/doublest.c @@ -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); } diff --git a/gdb/doublest.h b/gdb/doublest.h index 920d7026db4..d98d045c987 100644 --- a/gdb/doublest.h +++ b/gdb/doublest.h @@ -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. + + 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 diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 5e46d6b8f40..7abd7ea3321 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -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 diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 08394dee1d5..8cba11c19e7 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -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)); diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index d30586c7520..b61eb2364f3 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -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 diff --git a/gdb/x86-64-tdep.c b/gdb/x86-64-tdep.c index 24b77af113b..d670ff436db 100644 --- a/gdb/x86-64-tdep.c +++ b/gdb/x86-64-tdep.c @@ -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); -- 2.39.2