]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Index: ChangeLog
authorAndrew Cagney <cagney@redhat.com>
Sun, 13 Jun 2004 13:42:33 +0000 (13:42 +0000)
committerAndrew Cagney <cagney@redhat.com>
Sun, 13 Jun 2004 13:42:33 +0000 (13:42 +0000)
2004-06-13  Andrew Cagney  <cagney@gnu.org>

* gdbarch.sh (RETURN_VALUE_ON_STACK): Delete method.
* gdbarch.h, gdbarch.c: Re-generate.
* m68hc11-tdep.c (m68hc11_return_value_on_stack): Delete function.
(m68hc11_use_struct_convention): Delete function.
(m68hc11_extract_struct_value_address): Delete function.
(m68hc11_return_value): New function.
(m68hc11_gdbarch_init): Instead of store_return_value,
extract_return_value, return_value_on_stack,
deprecated_extract_struct_value_address and use_struct_convention,
set return_value.
* values.c (using_struct_return): Do not call
RETURN_VALUE_ON_STACK.
* arch-utils.h (generic_return_value_on_stack_not): Delete
declaration.
* arch-utils.c (generic_return_value_on_stack_not): Delete
function.

Index: doc/ChangeLog
2004-06-13  Andrew Cagney  <cagney@gnu.org>

* gdbint.texinfo (Target Architecture Definition): Delete
description of RETURN_VALUE_ON_STACK.

gdb/ChangeLog
gdb/arch-utils.c
gdb/arch-utils.h
gdb/doc/ChangeLog
gdb/doc/gdbint.texinfo
gdb/gdbarch.c
gdb/gdbarch.h
gdb/gdbarch.sh
gdb/m68hc11-tdep.c
gdb/values.c

index 74179f75136119dc872c2b8ba9e28632bdc7a777..79e0e0e073db522dbf6b1a3c8116763f7541e87d 100644 (file)
@@ -1,3 +1,22 @@
+2004-06-13  Andrew Cagney  <cagney@gnu.org>
+
+       * gdbarch.sh (RETURN_VALUE_ON_STACK): Delete method.
+       * gdbarch.h, gdbarch.c: Re-generate.
+       * m68hc11-tdep.c (m68hc11_return_value_on_stack): Delete function.
+       (m68hc11_use_struct_convention): Delete function.
+       (m68hc11_extract_struct_value_address): Delete function.
+       (m68hc11_return_value): New function.
+       (m68hc11_gdbarch_init): Instead of store_return_value,
+       extract_return_value, return_value_on_stack,
+       deprecated_extract_struct_value_address and use_struct_convention,
+       set return_value.
+       * values.c (using_struct_return): Do not call
+       RETURN_VALUE_ON_STACK.
+       * arch-utils.h (generic_return_value_on_stack_not): Delete
+       declaration.
+       * arch-utils.c (generic_return_value_on_stack_not): Delete
+       function.
+       
 2004-06-12  Andrew Cagney  <cagney@gnu.org>
 
        * values.c (register_value_being_returned): Delete function.
index ccafd2ba06d4b8ad31474c350309225635a9c0e5..2ec0674afea6ec0859eeded3b85ed629de9a68dd 100644 (file)
@@ -84,12 +84,6 @@ legacy_register_sim_regno (int regnum)
     return LEGACY_SIM_REGNO_IGNORE;
 }
 
-int
-generic_return_value_on_stack_not (struct type *type)
-{
-  return 0;
-}
-
 CORE_ADDR
 generic_skip_trampoline_code (CORE_ADDR pc)
 {
index f427424f730d1c26e14751c6bb1cb75cb4adbdbb..df6f0a6fae18baac997ace055e9b872a2bf20f9f 100644 (file)
@@ -43,11 +43,6 @@ extern gdbarch_store_return_value_ftype legacy_store_return_value;
    address passed as an invisible first argument to the function.  */
 extern gdbarch_use_struct_convention_ftype always_use_struct_convention;
 
-/* Only structures, unions, and arrays are returned using the struct
-   convention.  Note that arrays are never passed by value in the C
-   language family, so that case is irrelevant for C.  */
-extern gdbarch_return_value_on_stack_ftype generic_return_value_on_stack_not;
-
 /* Typical remote_translate_xfer_address */
 extern gdbarch_remote_translate_xfer_address_ftype generic_remote_translate_xfer_address;
 
index c97de0326bcc82a1defbea30ba35915d84d1b31b..7eb2a6c537a986f2533e0a21cdf6284032384104 100644 (file)
@@ -1,3 +1,8 @@
+2004-06-13  Andrew Cagney  <cagney@gnu.org>
+
+       * gdbint.texinfo (Target Architecture Definition): Delete
+       description of RETURN_VALUE_ON_STACK.
+
 2004-06-09  Andrew Cagney  <cagney@gnu.org>
 
        * gdbint.texinfo (Native Debugging): Restore "@table @code"
index 047b801ed5c7de698de1d60c278ff0492bc1ab16..e85a2c716723918bf010b715c54987dbf1a8e404 100644 (file)
@@ -3503,43 +3503,6 @@ form.
 Return the appropriate register set for a core file section with name
 @var{sect_name} and size @var{sect_size}.
 
-
-@item RETURN_VALUE_ON_STACK(@var{type})
-@findex RETURN_VALUE_ON_STACK
-@cindex returning structures by value
-@cindex structures, returning by value
-
-Return non-zero if values of type TYPE are returned on the stack, using
-the ``struct convention'' (i.e., the caller provides a pointer to a
-buffer in which the callee should store the return value).  This
-controls how the @samp{finish} command finds a function's return value,
-and whether an inferior function call reserves space on the stack for
-the return value.
-
-The full logic @value{GDBN} uses here is kind of odd.  
-
-@itemize @bullet
-@item
-If the type being returned by value is not a structure, union, or array,
-and @code{RETURN_VALUE_ON_STACK} returns zero, then @value{GDBN}
-concludes the value is not returned using the struct convention.
-
-@item
-Otherwise, @value{GDBN} calls @code{USE_STRUCT_CONVENTION} (see below).
-If that returns non-zero, @value{GDBN} assumes the struct convention is
-in use.
-@end itemize
-
-In other words, to indicate that a given type is returned by value using
-the struct convention, that type must be either a struct, union, array,
-or something @code{RETURN_VALUE_ON_STACK} likes, @emph{and} something
-that @code{USE_STRUCT_CONVENTION} likes.
-
-Note that, in C and C@t{++}, arrays are never returned by value.  In those
-languages, these predicates will always see a pointer type, never an
-array type.  All the references above to arrays being returned by value
-apply only to other languages.
-
 @item SOFTWARE_SINGLE_STEP_P()
 @findex SOFTWARE_SINGLE_STEP_P
 Define this as 1 if the target does not have a hardware single-step
index 156f9c118a4fe7feae9a7e53afce3730056deeba..b101db8df02aeff70f2a0f3b9bea6e792b79ceee 100644 (file)
@@ -184,7 +184,6 @@ struct gdbarch
   gdbarch_deprecated_pop_frame_ftype *deprecated_pop_frame;
   gdbarch_deprecated_store_struct_return_ftype *deprecated_store_struct_return;
   gdbarch_return_value_ftype *return_value;
-  gdbarch_return_value_on_stack_ftype *return_value_on_stack;
   gdbarch_extract_return_value_ftype *extract_return_value;
   gdbarch_store_return_value_ftype *store_return_value;
   gdbarch_deprecated_extract_return_value_ftype *deprecated_extract_return_value;
@@ -333,7 +332,6 @@ struct gdbarch startup_gdbarch =
   0,  /* deprecated_pop_frame */
   0,  /* deprecated_store_struct_return */
   0,  /* return_value */
-  0,  /* return_value_on_stack */
   0,  /* extract_return_value */
   0,  /* store_return_value */
   0,  /* deprecated_extract_return_value */
@@ -463,7 +461,6 @@ gdbarch_alloc (const struct gdbarch_info *info,
   current_gdbarch->convert_register_p = generic_convert_register_p;
   current_gdbarch->pointer_to_address = unsigned_pointer_to_address;
   current_gdbarch->address_to_pointer = unsigned_address_to_pointer;
-  current_gdbarch->return_value_on_stack = generic_return_value_on_stack_not;
   current_gdbarch->extract_return_value = legacy_extract_return_value;
   current_gdbarch->store_return_value = legacy_store_return_value;
   current_gdbarch->use_struct_convention = generic_use_struct_convention;
@@ -611,7 +608,6 @@ verify_gdbarch (struct gdbarch *current_gdbarch)
   /* Skip verify of deprecated_pop_frame, has predicate */
   /* Skip verify of deprecated_store_struct_return, has predicate */
   /* Skip verify of return_value, has predicate */
-  /* Skip verify of return_value_on_stack, invalid_p == 0 */
   /* 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 */
@@ -1809,16 +1805,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file)
   fprintf_unfiltered (file,
                       "gdbarch_dump: remote_translate_xfer_address = 0x%08lx\n",
                       (long) current_gdbarch->remote_translate_xfer_address);
-#ifdef RETURN_VALUE_ON_STACK
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: %s # %s\n",
-                      "RETURN_VALUE_ON_STACK(type)",
-                      XSTRING (RETURN_VALUE_ON_STACK (type)));
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: RETURN_VALUE_ON_STACK = <0x%08lx>\n",
-                      (long) current_gdbarch->return_value_on_stack
-                      /*RETURN_VALUE_ON_STACK ()*/);
-#endif
 #ifdef SDB_REG_TO_REGNUM
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
@@ -3576,23 +3562,6 @@ set_gdbarch_return_value (struct gdbarch *gdbarch,
   gdbarch->return_value = return_value;
 }
 
-int
-gdbarch_return_value_on_stack (struct gdbarch *gdbarch, struct type *type)
-{
-  gdb_assert (gdbarch != NULL);
-  gdb_assert (gdbarch->return_value_on_stack != NULL);
-  if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_return_value_on_stack called\n");
-  return gdbarch->return_value_on_stack (type);
-}
-
-void
-set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch,
-                                   gdbarch_return_value_on_stack_ftype return_value_on_stack)
-{
-  gdbarch->return_value_on_stack = return_value_on_stack;
-}
-
 void
 gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, void *valbuf)
 {
index 6a0dbaa0237c0bd53a670b21373ec385b52e1047..6e05cab69682d69188310a73b65dda5055f961d6 100644 (file)
@@ -1155,19 +1155,8 @@ 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, void *readbuf, const void *writebuf);
 extern void set_gdbarch_return_value (struct gdbarch *gdbarch, gdbarch_return_value_ftype *return_value);
 
-/* The deprecated methods RETURN_VALUE_ON_STACK, EXTRACT_RETURN_VALUE,
-   STORE_RETURN_VALUE and USE_STRUCT_CONVENTION have all been folded
-   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);
-extern void set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch, gdbarch_return_value_on_stack_ftype *return_value_on_stack);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (RETURN_VALUE_ON_STACK)
-#error "Non multi-arch definition of RETURN_VALUE_ON_STACK"
-#endif
-#if !defined (RETURN_VALUE_ON_STACK)
-#define RETURN_VALUE_ON_STACK(type) (gdbarch_return_value_on_stack (current_gdbarch, type))
-#endif
+/* The deprecated methods EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE and
+   USE_STRUCT_CONVENTION have all been folded into RETURN_VALUE. */
 
 typedef void (gdbarch_extract_return_value_ftype) (struct type *type, struct regcache *regcache, void *valbuf);
 extern void gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, void *valbuf);
index 666d449e773dcb90190f46b9bae3636a72df1aff..7ee06dedcc31a13328def8115427e432f85da12f 100755 (executable)
@@ -562,11 +562,9 @@ F:2:DEPRECATED_STORE_STRUCT_RETURN:void:deprecated_store_struct_return:CORE_ADDR
 
 M:::enum return_value_convention:return_value:struct type *valtype, struct regcache *regcache, void *readbuf, const void *writebuf:valtype, regcache, readbuf, writebuf
 
-# The deprecated methods RETURN_VALUE_ON_STACK, EXTRACT_RETURN_VALUE,
-# STORE_RETURN_VALUE and USE_STRUCT_CONVENTION have all been folded
-# into RETURN_VALUE.
+# The deprecated methods EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE and
+# USE_STRUCT_CONVENTION have all been folded 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
 f:2:STORE_RETURN_VALUE:void:store_return_value:struct type *type, struct regcache *regcache, const void *valbuf:type, regcache, valbuf:::legacy_store_return_value::0
 f:2:DEPRECATED_EXTRACT_RETURN_VALUE:void:deprecated_extract_return_value:struct type *type, char *regbuf, char *valbuf:type, regbuf, valbuf
index 80480a6611b12ef2034b37001049e1f24afd63d6..43fce357871003dafe340eb4491919bd8504f874 100644 (file)
@@ -1332,31 +1332,24 @@ m68hc11_extract_return_value (struct type *type, struct regcache *regcache,
     }
 }
 
-/* Should call_function allocate stack space for a struct return?  */
-static int
-m68hc11_use_struct_convention (int gcc_p, struct type *type)
-{
-  return (TYPE_CODE (type) == TYPE_CODE_STRUCT
-          || TYPE_CODE (type) == TYPE_CODE_UNION
-          || TYPE_LENGTH (type) > 4);
-}
-
-static int
-m68hc11_return_value_on_stack (struct type *type)
+enum return_value_convention
+m68hc11_return_value (struct gdbarch *gdbarch, struct type *valtype,
+                     struct regcache *regcache, void *readbuf,
+                     const void *writebuf)
 {
-  return TYPE_LENGTH (type) > 4;
-}
-
-/* Extract from an array REGBUF containing the (raw) register state
-   the address in which a function should return its structure value,
-   as a CORE_ADDR (or an expression that can be used as one).  */
-static CORE_ADDR
-m68hc11_extract_struct_value_address (struct regcache *regcache)
-{
-  char buf[M68HC11_REG_SIZE];
-
-  regcache_cooked_read (regcache, HARD_D_REGNUM, buf);
-  return extract_unsigned_integer (buf, M68HC11_REG_SIZE);
+  if (TYPE_CODE (valtype) == TYPE_CODE_STRUCT
+      || TYPE_CODE (valtype) == TYPE_CODE_UNION
+      || TYPE_CODE (valtype) == TYPE_CODE_ARRAY 
+      || TYPE_LENGTH (valtype) > 4)
+    return RETURN_VALUE_STRUCT_CONVENTION;
+  else
+    {
+      if (readbuf != NULL)
+       m68hc11_extract_return_value (valtype, regcache, readbuf);
+      if (writebuf != NULL)
+       m68hc11_store_return_value (valtype, regcache, writebuf);
+      return RETURN_VALUE_REGISTER_CONVENTION;
+    }
 }
 
 /* Test whether the ELF symbol corresponds to a function using rtc or
@@ -1539,12 +1532,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
 
   set_gdbarch_push_dummy_call (gdbarch, m68hc11_push_dummy_call);
 
-  set_gdbarch_extract_return_value (gdbarch, m68hc11_extract_return_value);
-  set_gdbarch_return_value_on_stack (gdbarch, m68hc11_return_value_on_stack);
-
-  set_gdbarch_store_return_value (gdbarch, m68hc11_store_return_value);
-  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_return_value (gdbarch, m68hc11_return_value);
   set_gdbarch_skip_prologue (gdbarch, m68hc11_skip_prologue);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_breakpoint_from_pc (gdbarch, m68hc11_breakpoint_from_pc);
index 5ed10b56328fc1cc6bb338b86dfd598784b8b4dd..98631af1948191924bf964c1a19e22a521039fc6 100644 (file)
@@ -1254,8 +1254,7 @@ using_struct_return (struct type *value_type, int gcc_p)
         "struct return" vs "register return" conventions.  */
       if (code == TYPE_CODE_STRUCT
          || code == TYPE_CODE_UNION
-         || code == TYPE_CODE_ARRAY
-         || RETURN_VALUE_ON_STACK (value_type))
+         || code == TYPE_CODE_ARRAY)
        return USE_STRUCT_CONVENTION (gcc_p, value_type);
       else
        return 0;