From 74055713e6ea65185ee25cd49cb7b4e720a81ec3 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Mon, 26 Jan 2004 20:52:13 +0000 Subject: [PATCH] 2004-01-26 Andrew Cagney * gdbarch.sh (EXTRACT_STRUCT_VALUE_ADDRESS): Deprecate. Add comments mentioning extract_returned_value_address. * infcmd.c (print_return_value): Update. Add comments on extract_returned_value_address. * stack.c (return_command): Add comments on extract_returned_value_address. * values.c: Update comment. * m32r-tdep.c: Update comment. * sparc-tdep.c: Update comment. * ia64-tdep.c (ia64_use_struct_convention): Update comment. * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. * sh64-tdep.c (sh64_gdbarch_init): Update. * sh-tdep.c (sh_gdbarch_init): Update. * s390-tdep.c (s390_gdbarch_init): Update. * rs6000-tdep.c (rs6000_gdbarch_init): Update. * m68klinux-tdep.c (m68k_linux_init_abi): Update. * m68k-tdep.c (m68k_gdbarch_init): Update. * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. * m32r-tdep.c (m32r_gdbarch_init): Update. * ia64-tdep.c (ia64_gdbarch_init): Update. * h8300-tdep.c (h8300_gdbarch_init): Update. * frv-tdep.c (frv_gdbarch_init): Update. * arm-tdep.c (arm_gdbarch_init): Update. * alpha-tdep.c (alpha_gdbarch_init): Update. Index: doc/ChangeLog 2004-01-26 Andrew Cagney * gdbint.texinfo (Target Architecture Definition): Rename EXTRACT_STRUCT_VALUE_ADDRESS to DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS. --- gdb/ChangeLog | 27 ++++++++++++++++++++++ gdb/alpha-tdep.c | 3 +-- gdb/arm-tdep.c | 3 +-- gdb/doc/ChangeLog | 6 +++++ gdb/doc/gdbint.texinfo | 14 ++++++------ gdb/frv-tdep.c | 2 +- gdb/gdbarch.c | 62 +++++++++++++++++++++++++------------------------- gdb/gdbarch.h | 56 ++++++++++++++++++++++++++++----------------- gdb/gdbarch.sh | 29 +++++++++++++++++------ gdb/h8300-tdep.c | 3 +-- gdb/ia64-tdep.c | 8 +++---- gdb/infcmd.c | 7 ++++-- gdb/m32r-tdep.c | 9 ++++---- gdb/m68hc11-tdep.c | 2 +- gdb/m68k-tdep.c | 3 +-- gdb/m68klinux-tdep.c | 3 +-- gdb/rs6000-tdep.c | 2 +- gdb/s390-tdep.c | 2 +- gdb/sh-tdep.c | 3 +-- gdb/sh64-tdep.c | 2 +- gdb/sparc-tdep.c | 4 ++-- gdb/stack.c | 7 ++++++ gdb/values.c | 6 ++--- gdb/xstormy16-tdep.c | 2 +- 24 files changed, 165 insertions(+), 100 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 00ac491..42dcc46 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,32 @@ 2004-01-26 Andrew Cagney + * gdbarch.sh (EXTRACT_STRUCT_VALUE_ADDRESS): Deprecate. Add + comments mentioning extract_returned_value_address. + * infcmd.c (print_return_value): Update. Add comments on + extract_returned_value_address. + * stack.c (return_command): Add comments on + extract_returned_value_address. + * values.c: Update comment. + * m32r-tdep.c: Update comment. + * sparc-tdep.c: Update comment. + * ia64-tdep.c (ia64_use_struct_convention): Update comment. + * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. + * sh64-tdep.c (sh64_gdbarch_init): Update. + * sh-tdep.c (sh_gdbarch_init): Update. + * s390-tdep.c (s390_gdbarch_init): Update. + * rs6000-tdep.c (rs6000_gdbarch_init): Update. + * m68klinux-tdep.c (m68k_linux_init_abi): Update. + * m68k-tdep.c (m68k_gdbarch_init): Update. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Update. + * m32r-tdep.c (m32r_gdbarch_init): Update. + * ia64-tdep.c (ia64_gdbarch_init): Update. + * h8300-tdep.c (h8300_gdbarch_init): Update. + * frv-tdep.c (frv_gdbarch_init): Update. + * arm-tdep.c (arm_gdbarch_init): Update. + * alpha-tdep.c (alpha_gdbarch_init): Update. + +2004-01-26 Andrew Cagney + * dwarf2loc.c (dwarf_expr_frame_base): Use SYMBOL_OPS instead of SYMBOL_LOCATION_FUNCS (dwarf2_loclist_funcs, dwarf2_locexpr_funcs): Change type to diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index a166ba5..c777933 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -1537,8 +1537,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_use_struct_convention (gdbarch, always_use_struct_convention); set_gdbarch_extract_return_value (gdbarch, alpha_extract_return_value); set_gdbarch_store_return_value (gdbarch, alpha_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, - alpha_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, alpha_extract_struct_value_address); /* Settings for calling functions in the inferior. */ set_gdbarch_push_dummy_call (gdbarch, alpha_push_dummy_call); diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index f51b82e..b4f37be 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -2923,8 +2923,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_extract_return_value (gdbarch, arm_extract_return_value); set_gdbarch_store_return_value (gdbarch, arm_store_return_value); set_gdbarch_use_struct_convention (gdbarch, arm_use_struct_convention); - set_gdbarch_extract_struct_value_address (gdbarch, - arm_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, arm_extract_struct_value_address); /* Single stepping. */ /* XXX For an RDI target we should ask the target if it can single-step. */ diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 2ddf21a..1b075f8 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,9 @@ +2004-01-26 Andrew Cagney + + * gdbint.texinfo (Target Architecture Definition): Rename + EXTRACT_STRUCT_VALUE_ADDRESS to + DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS. + 2004-01-24 Eli Zaretskii * gdb.texinfo (KOD): Document "show os". Add index entries for diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index ebf9a37..081f999 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -3174,18 +3174,18 @@ into @var{valbuf}. This method has been deprecated in favour of @code{gdbarch_return_value} (@pxref{gdbarch_return_value}). -@item EXTRACT_STRUCT_VALUE_ADDRESS(@var{regbuf}) -@findex EXTRACT_STRUCT_VALUE_ADDRESS -@anchor{EXTRACT_STRUCT_VALUE_ADDRESS} +@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 EXTRACT_STRUCT_VALUE_ADDRESS_P() -@findex EXTRACT_STRUCT_VALUE_ADDRESS_P -Predicate for @code{EXTRACT_STRUCT_VALUE_ADDRESS}. +@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 @@ -3794,7 +3794,7 @@ 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{EXTRACT_STRUCT_VALUE_ADDRESS}, for a description of how +@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, diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index 67fb641..bc680c5 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -1400,7 +1400,7 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_store_struct_return (gdbarch, frv_store_struct_return); set_gdbarch_store_return_value (gdbarch, frv_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, frv_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, frv_extract_struct_value_address); /* Frame stuff. */ set_gdbarch_unwind_pc (gdbarch, frv_unwind_pc); diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index fffbd0d..a3d4ee5 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -208,7 +208,7 @@ struct gdbarch gdbarch_deprecated_extract_return_value_ftype *deprecated_extract_return_value; gdbarch_deprecated_store_return_value_ftype *deprecated_store_return_value; gdbarch_use_struct_convention_ftype *use_struct_convention; - gdbarch_extract_struct_value_address_ftype *extract_struct_value_address; + gdbarch_deprecated_extract_struct_value_address_ftype *deprecated_extract_struct_value_address; gdbarch_deprecated_frame_init_saved_regs_ftype *deprecated_frame_init_saved_regs; gdbarch_deprecated_init_extra_frame_info_ftype *deprecated_init_extra_frame_info; gdbarch_skip_prologue_ftype *skip_prologue; @@ -379,7 +379,7 @@ struct gdbarch startup_gdbarch = 0, /* deprecated_extract_return_value */ 0, /* deprecated_store_return_value */ 0, /* use_struct_convention */ - 0, /* extract_struct_value_address */ + 0, /* deprecated_extract_struct_value_address */ 0, /* deprecated_frame_init_saved_regs */ 0, /* deprecated_init_extra_frame_info */ 0, /* skip_prologue */ @@ -686,7 +686,7 @@ verify_gdbarch (struct gdbarch *current_gdbarch) /* Skip verify of extract_return_value, invalid_p == 0 */ /* Skip verify of store_return_value, invalid_p == 0 */ /* Skip verify of use_struct_convention, invalid_p == 0 */ - /* Skip verify of extract_struct_value_address, has predicate */ + /* Skip verify of deprecated_extract_struct_value_address, has predicate */ /* Skip verify of deprecated_frame_init_saved_regs, has predicate */ /* Skip verify of deprecated_init_extra_frame_info, has predicate */ if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) @@ -1087,6 +1087,25 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) (long) current_gdbarch->deprecated_extract_return_value /*DEPRECATED_EXTRACT_RETURN_VALUE ()*/); #endif +#ifdef DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P()", + XSTRING (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P() = %d\n", + DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P ()); +#endif +#ifdef DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(regcache)", + XSTRING (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS (regcache))); + fprintf_unfiltered (file, + "gdbarch_dump: DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS = <0x%08lx>\n", + (long) current_gdbarch->deprecated_extract_struct_value_address + /*DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS ()*/); +#endif #ifdef DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED fprintf_unfiltered (file, "gdbarch_dump: DEPRECATED_EXTRA_STACK_ALIGNMENT_NEEDED # %s\n", @@ -1753,25 +1772,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) (long) current_gdbarch->extract_return_value /*EXTRACT_RETURN_VALUE ()*/); #endif -#ifdef EXTRACT_STRUCT_VALUE_ADDRESS_P - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "EXTRACT_STRUCT_VALUE_ADDRESS_P()", - XSTRING (EXTRACT_STRUCT_VALUE_ADDRESS_P ())); - fprintf_unfiltered (file, - "gdbarch_dump: EXTRACT_STRUCT_VALUE_ADDRESS_P() = %d\n", - EXTRACT_STRUCT_VALUE_ADDRESS_P ()); -#endif -#ifdef EXTRACT_STRUCT_VALUE_ADDRESS - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "EXTRACT_STRUCT_VALUE_ADDRESS(regcache)", - XSTRING (EXTRACT_STRUCT_VALUE_ADDRESS (regcache))); - fprintf_unfiltered (file, - "gdbarch_dump: EXTRACT_STRUCT_VALUE_ADDRESS = <0x%08lx>\n", - (long) current_gdbarch->extract_struct_value_address - /*EXTRACT_STRUCT_VALUE_ADDRESS ()*/); -#endif #ifdef FETCH_POINTER_ARGUMENT_P fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -4346,27 +4346,27 @@ set_gdbarch_use_struct_convention (struct gdbarch *gdbarch, } int -gdbarch_extract_struct_value_address_p (struct gdbarch *gdbarch) +gdbarch_deprecated_extract_struct_value_address_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - return gdbarch->extract_struct_value_address != NULL; + return gdbarch->deprecated_extract_struct_value_address != NULL; } CORE_ADDR -gdbarch_extract_struct_value_address (struct gdbarch *gdbarch, struct regcache *regcache) +gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, struct regcache *regcache) { gdb_assert (gdbarch != NULL); - gdb_assert (gdbarch->extract_struct_value_address != NULL); + gdb_assert (gdbarch->deprecated_extract_struct_value_address != NULL); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_extract_struct_value_address called\n"); - return gdbarch->extract_struct_value_address (regcache); + fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_extract_struct_value_address called\n"); + return gdbarch->deprecated_extract_struct_value_address (regcache); } void -set_gdbarch_extract_struct_value_address (struct gdbarch *gdbarch, - gdbarch_extract_struct_value_address_ftype extract_struct_value_address) +set_gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, + gdbarch_deprecated_extract_struct_value_address_ftype deprecated_extract_struct_value_address) { - gdbarch->extract_struct_value_address = extract_struct_value_address; + gdbarch->deprecated_extract_struct_value_address = deprecated_extract_struct_value_address; } int diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 8240ae4..e6651c7 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -1447,11 +1447,7 @@ extern void set_gdbarch_return_value (struct gdbarch *gdbarch, gdbarch_return_va /* The deprecated methods RETURN_VALUE_ON_STACK, EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE and USE_STRUCT_CONVENTION have all been folded - into RETURN_VALUE. For the moment do not try to fold in - EXTRACT_STRUCT_VALUE_ADDRESS as, dependant on the ABI, the debug - info, and the level of effort, it may well be possible to find the - address of a structure being return on the stack. Someone else can - make that change. */ + into RETURN_VALUE. */ typedef int (gdbarch_return_value_on_stack_ftype) (struct type *type); extern int gdbarch_return_value_on_stack (struct gdbarch *gdbarch, struct type *type); @@ -1513,29 +1509,47 @@ extern void set_gdbarch_use_struct_convention (struct gdbarch *gdbarch, gdbarch_ #define USE_STRUCT_CONVENTION(gcc_p, value_type) (gdbarch_use_struct_convention (current_gdbarch, gcc_p, value_type)) #endif -#if defined (EXTRACT_STRUCT_VALUE_ADDRESS) -/* Legacy for systems yet to multi-arch EXTRACT_STRUCT_VALUE_ADDRESS */ -#if !defined (EXTRACT_STRUCT_VALUE_ADDRESS_P) -#define EXTRACT_STRUCT_VALUE_ADDRESS_P() (1) +/* As of 2004-01-17 only the 32-bit SPARC ABI has been identified as an + ABI suitable for the implementation of a robust extract + struct-convention return-value address method (the sparc saves the + address in the callers frame). All the other cases so far examined, + the DEPRECATED_EXTRACT_STRUCT_VALUE implementation has been + erreneous - the code was incorrectly assuming that the return-value + address, stored in a register, was preserved across the entire + function call. + For the moment retain DEPRECATED_EXTRACT_STRUCT_VALUE as a marker of + the ABIs that are still to be analyzed - perhaps this should simply + be deleted. The commented out extract_returned_value_address method + is provided as a starting point for the 32-bit SPARC. It, or + something like it, along with changes to both infcmd.c and stack.c + will be needed for that case to work. NB: It is passed the callers + frame since it is only after the callee has returned that this + function is used. + M:::CORE_ADDR:extract_returned_value_address:struct frame_info *caller_frame:caller_frame */ + +#if defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS) +/* Legacy for systems yet to multi-arch DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS */ +#if !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P) +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P() (1) #endif #endif -extern int gdbarch_extract_struct_value_address_p (struct gdbarch *gdbarch); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (EXTRACT_STRUCT_VALUE_ADDRESS_P) -#error "Non multi-arch definition of EXTRACT_STRUCT_VALUE_ADDRESS" +extern int gdbarch_deprecated_extract_struct_value_address_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P) +#error "Non multi-arch definition of DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS" #endif -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (EXTRACT_STRUCT_VALUE_ADDRESS_P) -#define EXTRACT_STRUCT_VALUE_ADDRESS_P() (gdbarch_extract_struct_value_address_p (current_gdbarch)) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P) +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P() (gdbarch_deprecated_extract_struct_value_address_p (current_gdbarch)) #endif -typedef CORE_ADDR (gdbarch_extract_struct_value_address_ftype) (struct regcache *regcache); -extern CORE_ADDR gdbarch_extract_struct_value_address (struct gdbarch *gdbarch, struct regcache *regcache); -extern void set_gdbarch_extract_struct_value_address (struct gdbarch *gdbarch, gdbarch_extract_struct_value_address_ftype *extract_struct_value_address); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (EXTRACT_STRUCT_VALUE_ADDRESS) -#error "Non multi-arch definition of EXTRACT_STRUCT_VALUE_ADDRESS" +typedef CORE_ADDR (gdbarch_deprecated_extract_struct_value_address_ftype) (struct regcache *regcache); +extern CORE_ADDR gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, struct regcache *regcache); +extern void set_gdbarch_deprecated_extract_struct_value_address (struct gdbarch *gdbarch, gdbarch_deprecated_extract_struct_value_address_ftype *deprecated_extract_struct_value_address); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS) +#error "Non multi-arch definition of DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS" #endif -#if !defined (EXTRACT_STRUCT_VALUE_ADDRESS) -#define EXTRACT_STRUCT_VALUE_ADDRESS(regcache) (gdbarch_extract_struct_value_address (current_gdbarch, regcache)) +#if !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS) +#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(regcache) (gdbarch_deprecated_extract_struct_value_address (current_gdbarch, regcache)) #endif #if defined (DEPRECATED_FRAME_INIT_SAVED_REGS) diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 1801e8f..db7588b 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -606,11 +606,7 @@ M:::enum return_value_convention:return_value:struct type *valtype, struct regca # The deprecated methods RETURN_VALUE_ON_STACK, EXTRACT_RETURN_VALUE, # STORE_RETURN_VALUE and USE_STRUCT_CONVENTION have all been folded -# into RETURN_VALUE. For the moment do not try to fold in -# EXTRACT_STRUCT_VALUE_ADDRESS as, dependant on the ABI, the debug -# info, and the level of effort, it may well be possible to find the -# address of a structure being return on the stack. Someone else can -# make that change. +# into RETURN_VALUE. f:2:RETURN_VALUE_ON_STACK:int:return_value_on_stack:struct type *type:type:::generic_return_value_on_stack_not::0 f:2:EXTRACT_RETURN_VALUE:void:extract_return_value:struct type *type, struct regcache *regcache, void *valbuf:type, regcache, valbuf:::legacy_extract_return_value::0 @@ -619,8 +615,27 @@ f:2:DEPRECATED_EXTRACT_RETURN_VALUE:void:deprecated_extract_return_value:struct f:2:DEPRECATED_STORE_RETURN_VALUE:void:deprecated_store_return_value:struct type *type, char *valbuf:type, valbuf f:2:USE_STRUCT_CONVENTION:int:use_struct_convention:int gcc_p, struct type *value_type:gcc_p, value_type:::generic_use_struct_convention::0 -F:2:EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:extract_struct_value_address:struct regcache *regcache:regcache -# +# As of 2004-01-17 only the 32-bit SPARC ABI has been identified as an +# ABI suitable for the implementation of a robust extract +# struct-convention return-value address method (the sparc saves the +# address in the callers frame). All the other cases so far examined, +# the DEPRECATED_EXTRACT_STRUCT_VALUE implementation has been +# erreneous - the code was incorrectly assuming that the return-value +# address, stored in a register, was preserved across the entire +# function call. + +# For the moment retain DEPRECATED_EXTRACT_STRUCT_VALUE as a marker of +# the ABIs that are still to be analyzed - perhaps this should simply +# be deleted. The commented out extract_returned_value_address method +# is provided as a starting point for the 32-bit SPARC. It, or +# something like it, along with changes to both infcmd.c and stack.c +# will be needed for that case to work. NB: It is passed the callers +# frame since it is only after the callee has returned that this +# function is used. + +#M:::CORE_ADDR:extract_returned_value_address:struct frame_info *caller_frame:caller_frame +F:2:DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:deprecated_extract_struct_value_address:struct regcache *regcache:regcache + F:2:DEPRECATED_FRAME_INIT_SAVED_REGS:void:deprecated_frame_init_saved_regs:struct frame_info *frame:frame F:2:DEPRECATED_INIT_EXTRA_FRAME_INFO:void:deprecated_init_extra_frame_info:int fromleaf, struct frame_info *frame:fromleaf, frame # diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index c87dfab..f6bdb15 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -1328,8 +1328,7 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frameless_function_invocation (gdbarch, frameless_look_for_prologue); - set_gdbarch_extract_struct_value_address (gdbarch, - h8300_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, h8300_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, always_use_struct_convention); set_gdbarch_breakpoint_from_pc (gdbarch, h8300_breakpoint_from_pc); set_gdbarch_push_dummy_code (gdbarch, h8300_push_dummy_code); diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 6b2dba6..d57b5e9 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -2709,9 +2709,9 @@ static struct libunwind_descr ia64_libunwind_descr = #endif /* HAVE_LIBUNWIND_IA64_H */ -/* Should we use EXTRACT_STRUCT_VALUE_ADDRESS instead of - 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). */ +/* Should we use DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS instead of + 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). */ int ia64_use_struct_convention (int gcc_p, struct type *type) { @@ -3400,7 +3400,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_extract_return_value (gdbarch, ia64_extract_return_value); set_gdbarch_store_return_value (gdbarch, ia64_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, ia64_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, ia64_extract_struct_value_address); set_gdbarch_memory_insert_breakpoint (gdbarch, ia64_memory_insert_breakpoint); set_gdbarch_memory_remove_breakpoint (gdbarch, ia64_memory_remove_breakpoint); diff --git a/gdb/infcmd.c b/gdb/infcmd.c index ebf7f39..2de769e 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1061,6 +1061,9 @@ print_return_value (int struct_return, struct type *value_type) /* The return value can be found in the inferior's registers. */ value = register_value_being_returned (value_type, stop_registers); } + /* FIXME: cagney/2004-01-17: When both return_value and + extract_returned_value_address are available, should use that to + find the address of and then extract the returned value. */ /* FIXME: 2003-09-27: When returning from a nested inferior function call, it's possible (with no help from the architecture vector) to locate and return/print a "struct return" value. This is just @@ -1084,9 +1087,9 @@ print_return_value (int struct_return, struct type *value_type) } else { - if (EXTRACT_STRUCT_VALUE_ADDRESS_P ()) + if (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P ()) { - CORE_ADDR addr = EXTRACT_STRUCT_VALUE_ADDRESS (stop_registers); + CORE_ADDR addr = DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS (stop_registers); if (!addr) error ("Function return value unknown."); value = value_at (value_type, addr, NULL); diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c index 16ec1ff..3eff522 100644 --- a/gdb/m32r-tdep.c +++ b/gdb/m32r-tdep.c @@ -75,9 +75,9 @@ m32r_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp) return sp & ~3; } -/* Should we use EXTRACT_STRUCT_VALUE_ADDRESS instead of - 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). +/* Should we use DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS instead of + 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). The m32r returns anything less than 8 bytes in size in registers. */ @@ -939,8 +939,7 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_extract_return_value (gdbarch, m32r_extract_return_value); set_gdbarch_push_dummy_call (gdbarch, m32r_push_dummy_call); set_gdbarch_store_return_value (gdbarch, m32r_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, - m32r_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, m32r_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, m32r_use_struct_convention); set_gdbarch_skip_prologue (gdbarch, m32r_skip_prologue); diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 6aa2911..b84fdd3 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -1553,7 +1553,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info, set_gdbarch_store_return_value (gdbarch, m68hc11_store_return_value); set_gdbarch_store_return_value (gdbarch, m68hc11_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, m68hc11_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, m68hc11_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, m68hc11_use_struct_convention); set_gdbarch_skip_prologue (gdbarch, m68hc11_skip_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index 7938426..3d82bc0 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -1093,8 +1093,7 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_extract_return_value (gdbarch, m68k_extract_return_value); set_gdbarch_store_return_value (gdbarch, m68k_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, - m68k_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, m68k_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, m68k_use_struct_convention); set_gdbarch_frameless_function_invocation (gdbarch, diff --git a/gdb/m68klinux-tdep.c b/gdb/m68klinux-tdep.c index b39eebe..ed7e3ec 100644 --- a/gdb/m68klinux-tdep.c +++ b/gdb/m68klinux-tdep.c @@ -294,8 +294,7 @@ m68k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_extract_return_value (gdbarch, m68k_linux_extract_return_value); set_gdbarch_store_return_value (gdbarch, m68k_linux_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, - m68k_linux_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, m68k_linux_extract_struct_value_address); set_gdbarch_pc_in_sigtramp (gdbarch, m68k_linux_pc_in_sigtramp); diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 57fe902..1743643 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -2892,7 +2892,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) else set_gdbarch_push_dummy_call (gdbarch, rs6000_push_dummy_call); - set_gdbarch_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address); set_gdbarch_deprecated_pop_frame (gdbarch, rs6000_pop_frame); set_gdbarch_skip_prologue (gdbarch, rs6000_skip_prologue); diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 0e52652..2126759 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -2628,7 +2628,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_stab_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum); set_gdbarch_dwarf_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum); set_gdbarch_dwarf2_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum); - set_gdbarch_extract_struct_value_address (gdbarch, s390_cannot_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, s390_cannot_extract_struct_value_address); /* Parameters for inferior function calls. */ set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point); diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 8c7408b..1cf0c0f 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -2239,8 +2239,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_store_return_value (gdbarch, sh_default_store_return_value); set_gdbarch_extract_return_value (gdbarch, sh_default_extract_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, - sh_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh_extract_struct_value_address); set_gdbarch_skip_prologue (gdbarch, sh_skip_prologue); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c index 56063c1..5457254 100644 --- a/gdb/sh64-tdep.c +++ b/gdb/sh64-tdep.c @@ -2887,7 +2887,7 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_push_return_address (gdbarch, sh64_push_return_address); set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp); set_gdbarch_deprecated_store_struct_return (gdbarch, sh64_store_struct_return); - set_gdbarch_extract_struct_value_address (gdbarch, sh64_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, sh64_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, sh64_use_struct_convention); set_gdbarch_deprecated_pop_frame (gdbarch, sh64_pop_frame); set_gdbarch_elf_make_msymbol_special (gdbarch, diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index ed48880..f8adccc 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -839,8 +839,8 @@ sparc32_return_value (struct gdbarch *gdbarch, struct type *type, #if 0 /* NOTE: cagney/2004-01-17: For the moment disable this method. The architecture and CORE-gdb will need new code (and a replacement for - EXTRACT_STRUCT_VALUE_ADDRESS) before this can be made to work - robustly. Here is a possible function signature: */ + DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS) before this can be made to + work robustly. Here is a possible function signature: */ /* NOTE: cagney/2004-01-17: So far only the 32-bit SPARC ABI has been identifed as having a way to robustly recover the address of a struct-convention return-value (after the function has returned). diff --git a/gdb/stack.c b/gdb/stack.c index 73a6ec5..0a9052f 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1857,6 +1857,9 @@ return_command (char *retval_exp, int from_tty) is discarded, side effects such as "return i++" still occure. */ 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)) @@ -1926,6 +1929,10 @@ If you continue, the return value that you specified will be ignored.\n"; STORE_RETURN_VALUE (return_type, current_regcache, VALUE_CONTENTS (return_value)); } + /* FIXME: cagney/2004-01-17: If extract_returned_value_address + is available and the function is using + RETURN_VALUE_STRUCT_CONVENTION, should use it to find the + address of the returned value so that it can be assigned. */ else { gdb_assert (gdbarch_return_value (current_gdbarch, return_type, diff --git a/gdb/values.c b/gdb/values.c index 386e3bf..87baf21 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -1247,9 +1247,9 @@ register_value_being_returned (struct type *valtype, struct regcache *retbuf) return val; } -/* Should we use EXTRACT_STRUCT_VALUE_ADDRESS instead of - 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). +/* Should we use DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS instead of + 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. */ diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index da875d3..48ac1a2 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -1076,7 +1076,7 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_pop_frame (gdbarch, xstormy16_pop_frame); set_gdbarch_deprecated_store_struct_return (gdbarch, xstormy16_store_struct_return); set_gdbarch_deprecated_store_return_value (gdbarch, xstormy16_store_return_value); - set_gdbarch_extract_struct_value_address (gdbarch, xstormy16_extract_struct_value_address); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, xstormy16_extract_struct_value_address); set_gdbarch_use_struct_convention (gdbarch, xstormy16_use_struct_convention); set_gdbarch_deprecated_call_dummy_words (gdbarch, call_dummy_words); -- 2.7.4