From c187492465e6fd60ebf2f4710944fa7b6a679a02 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Sat, 13 Oct 2007 00:06:54 +0000 Subject: [PATCH] * gdbarch.sh (deprecated_use_struct_convention): Remove. (extract_return_value, store_return_value): Remove. (return_value): Remove default implementation. * gdbarch.c, gdbarch.h: Regenerate. * stack.c (return_command): Remove compatibility hack. * arch-utils.c (legacy_return_value): Remove. * arch-utils.h (legacy_return_value): Likewise. * arch-utils.c (always_use_struct_convention): Remove. * arch-utils.h (always_use_struct_convention): Likewise. * value.c (generic_use_struct_convention): Remove. * defs.h (generic_use_struct_convention): Likewise. doc/ChangeLog: * gdbint.texi (Target Conditionals): Remove documentation of and references to DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS, gdbarch_extract_return_value, and gdbarch_store_return_value. --- gdb/ChangeLog | 16 ++++++++++ gdb/arch-utils.c | 41 ------------------------ gdb/arch-utils.h | 13 -------- gdb/defs.h | 6 ---- gdb/doc/ChangeLog | 6 ++++ gdb/doc/gdbint.texinfo | 34 -------------------- gdb/gdbarch.c | 72 +----------------------------------------- gdb/gdbarch.h | 22 +------------ gdb/gdbarch.sh | 15 +-------- gdb/stack.c | 16 ---------- gdb/value.c | 26 --------------- 11 files changed, 25 insertions(+), 242 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 743f1440cf..989eb74cd0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,19 @@ +2007-10-12 Ulrich Weigand + + * gdbarch.sh (deprecated_use_struct_convention): Remove. + (extract_return_value, store_return_value): Remove. + (return_value): Remove default implementation. + * gdbarch.c, gdbarch.h: Regenerate. + + * stack.c (return_command): Remove compatibility hack. + * arch-utils.c (legacy_return_value): Remove. + * arch-utils.h (legacy_return_value): Likewise. + + * arch-utils.c (always_use_struct_convention): Remove. + * arch-utils.h (always_use_struct_convention): Likewise. + * value.c (generic_use_struct_convention): Remove. + * defs.h (generic_use_struct_convention): Likewise. + 2007-10-12 Ulrich Weigand * avr-tdep.c (avr_return_value): New function. diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index a21e997400..4ef616ae71 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -36,47 +36,6 @@ #include "floatformat.h" -int -always_use_struct_convention (int gcc_p, struct type *value_type) -{ - return 1; -} - -enum return_value_convention -legacy_return_value (struct gdbarch *gdbarch, struct type *valtype, - struct regcache *regcache, gdb_byte *readbuf, - const gdb_byte *writebuf) -{ - /* NOTE: cagney/2004-06-13: The gcc_p parameter to - USE_STRUCT_CONVENTION isn't used. */ - int struct_return = ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT - || TYPE_CODE (valtype) == TYPE_CODE_UNION - || TYPE_CODE (valtype) == TYPE_CODE_ARRAY) - && gdbarch_deprecated_use_struct_convention - (gdbarch, 0, valtype)); - - if (writebuf != NULL) - { - gdb_assert (!struct_return); - /* NOTE: cagney/2004-06-13: See stack.c:return_command. Old - architectures don't expect store_return_value to handle small - structures. Should not be called with such types. */ - gdb_assert (TYPE_CODE (valtype) != TYPE_CODE_STRUCT - && TYPE_CODE (valtype) != TYPE_CODE_UNION); - gdbarch_store_return_value (gdbarch, valtype, regcache, writebuf); - } - - if (readbuf != NULL) - { - gdb_assert (!struct_return); - gdbarch_extract_return_value (gdbarch, valtype, regcache, readbuf); - } - - if (struct_return) - return RETURN_VALUE_STRUCT_CONVENTION; - else - return RETURN_VALUE_REGISTER_CONVENTION; -} int legacy_register_sim_regno (int regnum) diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index c99b084236..6b46e257ed 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -30,19 +30,6 @@ struct gdbarch_info; /* gdbarch trace variable */ extern int gdbarch_debug; -/* An implementation of return_value that props up architectures still - using USE_STRUCT_RETURN, gdbarch_extract_return_value and - store_return_value. See also the hacks in "stack.c". */ -enum return_value_convention legacy_return_value (struct gdbarch *gdbarch, - struct type *valtype, - struct regcache *regcache, - gdb_byte *readbuf, - const gdb_byte *writebuf); - -/* To return any structure or union type by value, store it at the - address passed as an invisible first argument to the function. */ -extern gdbarch_deprecated_use_struct_convention_ftype always_use_struct_convention; - /* The only possible cases for inner_than. */ extern int core_addr_lessthan (CORE_ADDR lhs, CORE_ADDR rhs); extern int core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs); diff --git a/gdb/defs.h b/gdb/defs.h index bb14aa0a59..8cfc6e36aa 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -422,12 +422,6 @@ char *ldirname (const char *filename); extern void set_demangling_style (char *); -/* From tm.h */ - -struct type; -typedef int (use_struct_convention_fn) (int gcc_p, struct type * value_type); -extern use_struct_convention_fn generic_use_struct_convention; - /* Annotation stuff. */ diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 83b123fd7b..7fa66e8fd4 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,9 @@ +2007-10-12 Ulrich Weigand + + * gdbint.texi (Target Conditionals): Remove documentation + of and references to DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS, + gdbarch_extract_return_value, and gdbarch_store_return_value. + 2007-10-12 Ulrich Weigand * gdbint.texi (Target Conditionals): Remove documentation of diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 21b3c90851..127bcb31a3 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -3515,28 +3515,6 @@ If not defined, no conversion will be performed. Convert ECOFF register number @var{ecoff_regnr} into @value{GDBN} regnum. If not defined, no conversion will be performed. -@item void gdbarch_extract_return_value (@var{gdbarch}, @var{type}, @var{regbuf}, @var{valbuf}) -@findex gdbarch_extract_return_value -Define this to extract a function's return value of type @var{type} from -the raw register state @var{regbuf} and copy that, in virtual format, -into @var{valbuf}. - -This method has been deprecated in favour of @code{gdbarch_return_value} -(@pxref{gdbarch_return_value}). - -@item DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(@var{regbuf}) -@findex DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS -@anchor{DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS} -When defined, extract from the array @var{regbuf} (containing the raw -register state) the @code{CORE_ADDR} at which a function should return -its structure value. - -@xref{gdbarch_return_value}. - -@item DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P() -@findex DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P -Predicate for @code{DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS}. - @item DEPRECATED_FP_REGNUM @findex DEPRECATED_FP_REGNUM If the virtual frame pointer is kept in a register, then define this @@ -3974,9 +3952,6 @@ non-@code{NULL}, also copy the return value from @var{regcache} into @var{readbuf} (@var{regcache} contains a copy of the registers from the just returned function). -@xref{DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS}, for a description of how -return-values that use the struct convention are handled. - @emph{Maintainer note: This method replaces separate predicate, extract, store methods. By having only one method, the logic needed to determine the return-value convention need only be implemented in one place. If @@ -4028,15 +4003,6 @@ there is no such register. Use this function to convert stab register @var{stab_regnr} into @value{GDBN} regnum. If not defined, no conversion will be done. -@item void gdbarch_store_return_value (@var{gdbarch}, @var{type}, @var{regcache}, @var{valbuf}) -@findex gdbarch_store_return_value -A function that writes the function return value, found in -@var{valbuf}, into the @var{regcache}. @var{type} is the type of the -value that is to be returned. - -This method has been deprecated in favour of @code{gdbarch_return_value} -(@pxref{gdbarch_return_value}). - @item SYMBOL_RELOADING_DEFAULT @findex SYMBOL_RELOADING_DEFAULT The default value of the ``symbol-reloading'' variable. (Never defined in diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index adf56741fc..8b51c02209 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -182,9 +182,6 @@ struct gdbarch gdbarch_address_to_pointer_ftype *address_to_pointer; gdbarch_integer_to_address_ftype *integer_to_address; gdbarch_return_value_ftype *return_value; - gdbarch_extract_return_value_ftype *extract_return_value; - gdbarch_store_return_value_ftype *store_return_value; - gdbarch_deprecated_use_struct_convention_ftype *deprecated_use_struct_convention; gdbarch_skip_prologue_ftype *skip_prologue; gdbarch_inner_than_ftype *inner_than; gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc; @@ -304,9 +301,6 @@ struct gdbarch startup_gdbarch = 0, /* address_to_pointer */ 0, /* integer_to_address */ 0, /* return_value */ - 0, /* extract_return_value */ - 0, /* store_return_value */ - 0, /* deprecated_use_struct_convention */ 0, /* skip_prologue */ 0, /* inner_than */ 0, /* breakpoint_from_pc */ @@ -420,8 +414,6 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->value_from_register = default_value_from_register; current_gdbarch->pointer_to_address = unsigned_pointer_to_address; current_gdbarch->address_to_pointer = unsigned_address_to_pointer; - current_gdbarch->return_value = legacy_return_value; - current_gdbarch->deprecated_use_struct_convention = generic_use_struct_convention; current_gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint; current_gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint; current_gdbarch->remote_register_number = default_remote_register_number; @@ -550,7 +542,6 @@ verify_gdbarch (struct gdbarch *current_gdbarch) /* Skip verify of address_to_pointer, invalid_p == 0 */ /* Skip verify of integer_to_address, has predicate */ /* Skip verify of return_value, has predicate */ - /* Skip verify of deprecated_use_struct_convention, invalid_p == 0 */ if (current_gdbarch->skip_prologue == 0) fprintf_unfiltered (log, "\n\tskip_prologue"); if (current_gdbarch->inner_than == 0) @@ -734,9 +725,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: deprecated_function_start_offset = 0x%s\n", paddr_nz (current_gdbarch->deprecated_function_start_offset)); - fprintf_unfiltered (file, - "gdbarch_dump: deprecated_use_struct_convention = <0x%lx>\n", - (long) current_gdbarch->deprecated_use_struct_convention); fprintf_unfiltered (file, "gdbarch_dump: double_bit = %s\n", paddr_d (current_gdbarch->double_bit)); @@ -755,9 +743,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: elf_make_msymbol_special = <0x%lx>\n", (long) current_gdbarch->elf_make_msymbol_special); - fprintf_unfiltered (file, - "gdbarch_dump: extract_return_value = <0x%lx>\n", - (long) current_gdbarch->extract_return_value); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_fetch_pointer_argument_p() = %d\n", gdbarch_fetch_pointer_argument_p (current_gdbarch)); @@ -998,9 +983,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: stabs_argument_has_addr = <0x%lx>\n", (long) current_gdbarch->stabs_argument_has_addr); - fprintf_unfiltered (file, - "gdbarch_dump: store_return_value = <0x%lx>\n", - (long) current_gdbarch->store_return_value); fprintf_unfiltered (file, "gdbarch_dump: target_desc = %s\n", paddr_d ((long) current_gdbarch->target_desc)); @@ -2046,7 +2028,7 @@ int gdbarch_return_value_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - return gdbarch->return_value != legacy_return_value; + return gdbarch->return_value != NULL; } enum return_value_convention @@ -2054,7 +2036,6 @@ gdbarch_return_value (struct gdbarch *gdbarch, struct type *valtype, struct regc { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->return_value != NULL); - /* Do not check predicate: gdbarch->return_value != legacy_return_value, allow call. */ if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_return_value called\n"); return gdbarch->return_value (gdbarch, valtype, regcache, readbuf, writebuf); @@ -2067,57 +2048,6 @@ set_gdbarch_return_value (struct gdbarch *gdbarch, gdbarch->return_value = return_value; } -void -gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, gdb_byte *valbuf) -{ - gdb_assert (gdbarch != NULL); - gdb_assert (gdbarch->extract_return_value != NULL); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_extract_return_value called\n"); - gdbarch->extract_return_value (type, regcache, valbuf); -} - -void -set_gdbarch_extract_return_value (struct gdbarch *gdbarch, - gdbarch_extract_return_value_ftype extract_return_value) -{ - gdbarch->extract_return_value = extract_return_value; -} - -void -gdbarch_store_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, const gdb_byte *valbuf) -{ - gdb_assert (gdbarch != NULL); - gdb_assert (gdbarch->store_return_value != NULL); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_store_return_value called\n"); - gdbarch->store_return_value (type, regcache, valbuf); -} - -void -set_gdbarch_store_return_value (struct gdbarch *gdbarch, - gdbarch_store_return_value_ftype store_return_value) -{ - gdbarch->store_return_value = store_return_value; -} - -int -gdbarch_deprecated_use_struct_convention (struct gdbarch *gdbarch, int gcc_p, struct type *value_type) -{ - gdb_assert (gdbarch != NULL); - gdb_assert (gdbarch->deprecated_use_struct_convention != NULL); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_use_struct_convention called\n"); - return gdbarch->deprecated_use_struct_convention (gcc_p, value_type); -} - -void -set_gdbarch_deprecated_use_struct_convention (struct gdbarch *gdbarch, - gdbarch_deprecated_use_struct_convention_ftype deprecated_use_struct_convention) -{ - gdbarch->deprecated_use_struct_convention = deprecated_use_struct_convention; -} - CORE_ADDR gdbarch_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip) { diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index e3775d9394..b682451029 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -356,10 +356,7 @@ extern void set_gdbarch_integer_to_address (struct gdbarch *gdbarch, gdbarch_int /* It has been suggested that this, well actually its predecessor, should take the type/value of the function to be called and not the - return type. This is left as an exercise for the reader. - NOTE: cagney/2004-06-13: The function stack.c:return_command uses - the predicate with default hack to avoid calling store_return_value - (via legacy_return_value), when a small struct is involved. */ + return type. This is left as an exercise for the reader. */ extern int gdbarch_return_value_p (struct gdbarch *gdbarch); @@ -367,23 +364,6 @@ typedef enum return_value_convention (gdbarch_return_value_ftype) (struct gdbarc extern enum return_value_convention gdbarch_return_value (struct gdbarch *gdbarch, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf); extern void set_gdbarch_return_value (struct gdbarch *gdbarch, gdbarch_return_value_ftype *return_value); -/* The deprecated methods extract_return_value, store_return_value, - DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS and - deprecated_use_struct_convention have all been folded into - RETURN_VALUE. */ - -typedef void (gdbarch_extract_return_value_ftype) (struct type *type, struct regcache *regcache, gdb_byte *valbuf); -extern void gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, gdb_byte *valbuf); -extern void set_gdbarch_extract_return_value (struct gdbarch *gdbarch, gdbarch_extract_return_value_ftype *extract_return_value); - -typedef void (gdbarch_store_return_value_ftype) (struct type *type, struct regcache *regcache, const gdb_byte *valbuf); -extern void gdbarch_store_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, const gdb_byte *valbuf); -extern void set_gdbarch_store_return_value (struct gdbarch *gdbarch, gdbarch_store_return_value_ftype *store_return_value); - -typedef int (gdbarch_deprecated_use_struct_convention_ftype) (int gcc_p, struct type *value_type); -extern int gdbarch_deprecated_use_struct_convention (struct gdbarch *gdbarch, int gcc_p, struct type *value_type); -extern void set_gdbarch_deprecated_use_struct_convention (struct gdbarch *gdbarch, gdbarch_deprecated_use_struct_convention_ftype *deprecated_use_struct_convention); - typedef CORE_ADDR (gdbarch_skip_prologue_ftype) (CORE_ADDR ip); extern CORE_ADDR gdbarch_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip); extern void set_gdbarch_skip_prologue (struct gdbarch *gdbarch, gdbarch_skip_prologue_ftype *skip_prologue); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 8a7597cd6a..a5f0a2a060 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -498,20 +498,7 @@ M::CORE_ADDR:integer_to_address:struct type *type, const gdb_byte *buf:type, buf # should take the type/value of the function to be called and not the # return type. This is left as an exercise for the reader. -# NOTE: cagney/2004-06-13: The function stack.c:return_command uses -# the predicate with default hack to avoid calling store_return_value -# (via legacy_return_value), when a small struct is involved. - -M::enum return_value_convention:return_value:struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf:valtype, regcache, readbuf, writebuf::legacy_return_value - -# The deprecated methods extract_return_value, store_return_value, -# DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS and -# deprecated_use_struct_convention have all been folded into -# RETURN_VALUE. - -f::void:extract_return_value:struct type *type, struct regcache *regcache, gdb_byte *valbuf:type, regcache, valbuf:0 -f::void:store_return_value:struct type *type, struct regcache *regcache, const gdb_byte *valbuf:type, regcache, valbuf:0 -f::int:deprecated_use_struct_convention:int gcc_p, struct type *value_type:gcc_p, value_type::generic_use_struct_convention::0 +M::enum return_value_convention:return_value:struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf:valtype, regcache, readbuf, writebuf f::CORE_ADDR:skip_prologue:CORE_ADDR ip:ip:0:0 f::int:inner_than:CORE_ADDR lhs, CORE_ADDR rhs:lhs, rhs:0:0 diff --git a/gdb/stack.c b/gdb/stack.c index 448135ca9d..d311df3dc8 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1789,22 +1789,6 @@ return_command (char *retval_exp, int from_tty) is discarded, side effects such as "return i++" still occur. */ return_value = NULL; - /* FIXME: cagney/2004-01-17: If the architecture implements both - return_value and extract_returned_value_address, should allow - "return" to work - don't set return_value to NULL. */ - else if (!gdbarch_return_value_p (current_gdbarch) - && (TYPE_CODE (return_type) == TYPE_CODE_STRUCT - || TYPE_CODE (return_type) == TYPE_CODE_UNION)) - { - /* NOTE: cagney/2003-10-20: Compatibility hack for legacy - code. Old architectures don't expect gdbarch_store_return_value - to be called with with a small struct that needs to be - stored in registers. Don't start doing it now. */ - query_prefix = "\ -A structure or union return type is not supported by this architecture.\n\ -If you continue, the return value that you specified will be ignored.\n"; - return_value = NULL; - } else if (using_struct_return (return_type)) { query_prefix = "\ diff --git a/gdb/value.c b/gdb/value.c index 656c5ead0e..7085ec11f7 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -1681,32 +1681,6 @@ coerce_enum (struct value *arg) } -/* Should we use DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS instead of - gdbarch_extract_return_value? GCC_P is true if compiled with gcc and TYPE - is the type (which is known to be struct, union or array). - - On most machines, the struct convention is used unless we are - using gcc and the type is of a special size. */ -/* As of about 31 Mar 93, GCC was changed to be compatible with the - native compiler. GCC 2.3.3 was the last release that did it the - old way. Since gcc2_compiled was not changed, we have no - way to correctly win in all cases, so we just do the right thing - for gcc1 and for gcc2 after this change. Thus it loses for gcc - 2.0-2.3.3. This is somewhat unfortunate, but changing gcc2_compiled - would cause more chaos than dealing with some struct returns being - handled wrong. */ -/* NOTE: cagney/2004-06-13: Deleted check for "gcc_p". GCC 1.x is - dead. */ - -int -generic_use_struct_convention (int gcc_p, struct type *value_type) -{ - return !(TYPE_LENGTH (value_type) == 1 - || TYPE_LENGTH (value_type) == 2 - || TYPE_LENGTH (value_type) == 4 - || TYPE_LENGTH (value_type) == 8); -} - /* Return true if the function returning the specified type is using the convention of returning structures in memory (passing in the address as a hidden first parameter). */ -- 2.34.1