]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* alpha-tdep.h (struct gdbarch_tdep): Add return_in_memory.
authorRichard Henderson <rth@redhat.com>
Mon, 10 Jul 2006 15:28:02 +0000 (15:28 +0000)
committerRichard Henderson <rth@redhat.com>
Mon, 10 Jul 2006 15:28:02 +0000 (15:28 +0000)
* alpha-tdep.c (alpha_register_byte): Remove.
(alpha_extract_struct_value_address): Remove.
(alpha_return_value): New.
(alpha_return_in_memory_always): New.
(alpha_gdbarch_init): Set tdep->return_in_memory.  Don't call
set_gdbarch_deprecated_register_byte.  Do call set_gdbarch_return_value
instead of set_gdbarch_deprecated_use_struct_convention,
set_gdbarch_extract_return_value, set_gdbarch_store_return_value,
or set_gdbarch_deprecated_extract_struct_value_address.
* alphafbsd-tdep.c (alphafbsd_return_in_memory): Rename from
alphafbsd_use_struct_convention, remove gcc_p argument.
(alphafbsd_init_abi): Set tdep->return_in_memory instead of
set_gdbarch_deprecated_use_struct_convention.

gdb/ChangeLog
gdb/alpha-tdep.c
gdb/alpha-tdep.h
gdb/alphafbsd-tdep.c

index a9aab62f586a8f4b0681261bb648bce22cfc7d3e..5ee097d2278501e8427cab289b494ee27d27ddc7 100644 (file)
@@ -1,3 +1,20 @@
+2006-07-10  Richard Henderson  <rth@redhat.com>
+
+       * alpha-tdep.h (struct gdbarch_tdep): Add return_in_memory.
+       * alpha-tdep.c (alpha_register_byte): Remove.
+       (alpha_extract_struct_value_address): Remove.
+       (alpha_return_value): New.
+       (alpha_return_in_memory_always): New.
+       (alpha_gdbarch_init): Set tdep->return_in_memory.  Don't call
+       set_gdbarch_deprecated_register_byte.  Do call set_gdbarch_return_value
+       instead of set_gdbarch_deprecated_use_struct_convention,
+       set_gdbarch_extract_return_value, set_gdbarch_store_return_value,
+       or set_gdbarch_deprecated_extract_struct_value_address.
+       * alphafbsd-tdep.c (alphafbsd_return_in_memory): Rename from
+       alphafbsd_use_struct_convention, remove gcc_p argument.
+       (alphafbsd_init_abi): Set tdep->return_in_memory instead of
+       set_gdbarch_deprecated_use_struct_convention.
+
 2006-07-09  Mark Kettenis  <kettenis@gnu.org>
 
        * alphabsd-tdep.h (alphanbsd_regset_from_core_section): New
index 4480b21164e3306454800657b53bcd725fc2dd40..afe1d2fc47a224abce588fe80cbb47cae5a2f04e 100644 (file)
@@ -149,12 +149,6 @@ alpha_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
     return group == general_reggroup;
 }
 
-static int
-alpha_register_byte (int regno)
-{
-  return (regno * 8);
-}
-
 /* The following represents exactly the conversion performed by
    the LDS instruction.  This applies to both single-precision
    floating point and 32-bit integers.  */
@@ -501,17 +495,6 @@ alpha_extract_return_value (struct type *valtype, struct regcache *regcache,
     }
 }
 
-/* Extract from REGCACHE the address of a structure about to be returned
-   from a function.  */
-
-static CORE_ADDR
-alpha_extract_struct_value_address (struct regcache *regcache)
-{
-  ULONGEST addr;
-  regcache_cooked_read_unsigned (regcache, ALPHA_V0_REGNUM, &addr);
-  return addr;
-}
-
 /* Insert the given value into REGCACHE as if it was being 
    returned by a function.  */
 
@@ -585,6 +568,41 @@ alpha_store_return_value (struct type *valtype, struct regcache *regcache,
     }
 }
 
+static enum return_value_convention
+alpha_return_value (struct gdbarch *gdbarch, struct type *type,
+                   struct regcache *regcache, gdb_byte *readbuf,
+                   const gdb_byte *writebuf)
+{
+  enum type_code code = TYPE_CODE (type);
+
+  if ((code == TYPE_CODE_STRUCT
+       || code == TYPE_CODE_UNION
+       || code == TYPE_CODE_ARRAY)
+      && gdbarch_tdep (gdbarch)->return_in_memory (type))
+    {
+      if (readbuf)
+       {
+         ULONGEST addr;
+         regcache_raw_read_unsigned (regcache, ALPHA_V0_REGNUM, &addr);
+         read_memory (addr, readbuf, TYPE_LENGTH (type));
+       }
+
+      return RETURN_VALUE_ABI_RETURNS_ADDRESS;
+    }
+
+  if (readbuf)
+    alpha_extract_return_value (type, regcache, readbuf);
+  if (writebuf)
+    alpha_store_return_value (type, regcache, writebuf);
+
+  return RETURN_VALUE_REGISTER_CONVENTION;
+}
+
+static int
+alpha_return_in_memory_always (struct type *type)
+{
+  return 1;
+}
 \f
 static const unsigned char *
 alpha_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
@@ -1551,6 +1569,8 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   tdep->jb_pc = -1;    /* longjmp support not enabled by default  */
 
+  tdep->return_in_memory = alpha_return_in_memory_always;
+
   /* Type sizes */
   set_gdbarch_short_bit (gdbarch, 16);
   set_gdbarch_int_bit (gdbarch, 32);
@@ -1568,7 +1588,6 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_fp0_regnum (gdbarch, ALPHA_FP0_REGNUM);
 
   set_gdbarch_register_name (gdbarch, alpha_register_name);
-  set_gdbarch_deprecated_register_byte (gdbarch, alpha_register_byte);
   set_gdbarch_register_type (gdbarch, alpha_register_type);
 
   set_gdbarch_cannot_fetch_register (gdbarch, alpha_cannot_fetch_register);
@@ -1588,10 +1607,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Call info.  */
 
-  set_gdbarch_deprecated_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_deprecated_extract_struct_value_address (gdbarch, alpha_extract_struct_value_address);
+  set_gdbarch_return_value (gdbarch, alpha_return_value);
 
   /* Settings for calling functions in the inferior.  */
   set_gdbarch_push_dummy_call (gdbarch, alpha_push_dummy_call);
index ab6be39125b27516c2837cbdf332ffa549fd35a0..9ac564ef5744e52a6559ed99aae9a4b8ea7c582c 100644 (file)
@@ -88,6 +88,9 @@ struct gdbarch_tdep
      sigtramp unwinders.  */
   int (*pc_in_sigtramp) (CORE_ADDR pc, char *name);
 
+  /* If TYPE will be returned in memory, return true.  */
+  int (*return_in_memory) (struct type *type);
+
   /* Offset of registers in `struct sigcontext'.  */
   int sc_pc_offset;
   int sc_regs_offset;
index 08d38629e10e589cb760ca01b4f117ac5e30acc1..4ea9625eccecb93c3b44795f0101599286e632ff 100644 (file)
@@ -27,7 +27,7 @@
 #include "solib-svr4.h"
 
 static int
-alphafbsd_use_struct_convention (int gcc_p, struct type *type)
+alphafbsd_return_in_memory (struct type *type)
 {
   enum type_code code;
   int i;
@@ -104,12 +104,10 @@ alphafbsd_init_abi (struct gdbarch_info info,
   set_solib_svr4_fetch_link_map_offsets
     (gdbarch, svr4_lp64_fetch_link_map_offsets);
 
-  set_gdbarch_deprecated_use_struct_convention
-    (gdbarch, alphafbsd_use_struct_convention);
-
   tdep->dynamic_sigtramp_offset = alphafbsd_sigtramp_offset;
   tdep->sigcontext_addr = alphafbsd_sigcontext_addr;
   tdep->pc_in_sigtramp = alphafbsd_pc_in_sigtramp;
+  tdep->return_in_memory = alphafbsd_return_in_memory;
   tdep->sc_pc_offset = 288;
   tdep->sc_regs_offset = 24;
   tdep->sc_fpregs_offset = 320;