]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Support for passing/returning parameters
authorLuis Machado <luis.machado@linaro.org>
Fri, 26 Feb 2021 16:34:12 +0000 (13:34 -0300)
committerLuis Machado <luis.machado@linaro.org>
Tue, 27 Apr 2021 23:47:40 +0000 (20:47 -0300)
This patch implements passing/returning of parameters for Morello.  It is
implemented based on the Morello AAPCS64 document and supports both the hybrid
AAPCS64 and Pure-Cap AAPCS64-CAP ABI's.

gdb/ChangeLog

2021-02-26  Luis Machado  <luis.machado@arm.com>

* aarch64-tdep.c (struct stack_item_t) <arg_value): New field.
(set_register_tag, pass_in_c, pass_in_c_or_stack,
pass_in_c_x_or_stack, type_fields_overlap_capabilities,
convert_pointer_to_capability,
morello_write_memory_with_capabilities,
morello_push_dummy_call, morello_extract_return_value,
morello_return_in_memory, morello_store_return_value,
morello_return_value): New functions.
(pass_in_x, pass_in_v, pass_on_stack, pass_in_x_or_stack,
pass_in_v_vfp_candidate): Update.
(aarch64_return_value): New argument value.
(aarch64_gdbarch_init): Conditionally set both gdbarch_push_dummy_call
and gdbarch_return_value.
* arch/aarch64.h (MORELLO_MEMORY_TAG_GRANULE_SIZE): New constant.
* dwarf2/read.c (handle_struct_member_die): Record whether the
composite type contains capabilities.
* gdbarch.sh (return_value): New argument value.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbtypes.c (recursive_dump_type): Dump extra information.
(append_composite_type_field_raw): Set whether the composite type
constains capabilities.
* gdbtypes.h (struct main_type) <m_flag_contains_capability>: New field.
<contains_capability>: New member function.
<set_contains_capability>: New member function.

* alpha-tdep.c: Update return_value hook prototype.
* amd64-tdep.c: Update return_value hook prototype.
* amd64-windows-tdep.c: Update return_value hook prototype.
* arc-tdep.c: Update return_value hook prototype.
* arm-tdep.c: Update return_value hook prototype.
* avr-tdep.c: Update return_value hook prototype.
* bfin-tdep.c: Update return_value hook prototype.
* bpf-tdep.c: Update return_value hook prototype.
* cris-tdep.c: Update return_value hook prototype.
* csky-tdep.c: Update return_value hook prototype.
* elfread.c: Update return_value hook prototype.
* frv-tdep.c: Update return_value hook prototype.
* ft32-tdep.c: Update return_value hook prototype.
* h8300-tdep.c: Update return_value hook prototype.
* hppa-tdep.c: Update return_value hook prototype.
* i386-tdep.c: Update return_value hook prototype.
* ia64-tdep.c: Update return_value hook prototype.
* infcall.c: Update return_value hook prototype.
* infcmd.c: Update return_value hook prototype.
* lm32-tdep.c: Update return_value hook prototype.
* m32c-tdep.c: Update return_value hook prototype.
* m32r-tdep.c: Update return_value hook prototype.
* m68hc11-tdep.c: Update return_value hook prototype.
* m68k-tdep.c: Update return_value hook prototype.
* mep-tdep.c: Update return_value hook prototype.
* microblaze-tdep.c: Update return_value hook prototype.
* mips-tdep.c: Update return_value hook prototype.
* mn10300-tdep.c: Update return_value hook prototype.
* moxie-tdep.c: Update return_value hook prototype.
* msp430-tdep.c: Update return_value hook prototype.
* nds32-tdep.c: Update return_value hook prototype.
* nios2-tdep.c: Update return_value hook prototype.
* or1k-tdep.c: Update return_value hook prototype.
* ppc-fbsd-tdep.c: Update return_value hook prototype.
* ppc-linux-tdep.c: Update return_value hook prototype.
* ppc-netbsd-tdep.c: Update return_value hook prototype.
* ppc-sysv-tdep.c: Update return_value hook prototype.
* riscv-tdep.c: Update return_value hook prototype.
* rl78-tdep.c: Update return_value hook prototype.
* rs6000-aix-tdep.c: Update return_value hook prototype.
* rs6000-lynx178-tdep.c: Update return_value hook prototype.
* rx-tdep.c: Update return_value hook prototype.
* s12z-tdep.c: Update return_value hook prototype.
* s390-tdep.c: Update return_value hook prototype.
* score-tdep.c: Update return_value hook prototype.
* sh-tdep.c: Update return_value hook prototype.
* sparc-tdep.c: Update return_value hook prototype.
* sparc64-tdep.c: Update return_value hook prototype.
* stack.c: Update return_value hook prototype.
* tic6x-tdep.c: Update return_value hook prototype.
* tilegx-tdep.c: Update return_value hook prototype.
* v850-tdep.c: Update return_value hook prototype.
* valprint.c: Update return_value hook prototype.
* value.c: Update return_value hook prototype.
* vax-tdep.c: Update return_value hook prototype.
* xstormy16-tdep.c: Update return_value hook prototype.
* xtensa-tdep.c: Update return_value hook prototype.

66 files changed:
gdb/ChangeLog
gdb/aarch64-tdep.c
gdb/alpha-tdep.c
gdb/amd64-tdep.c
gdb/amd64-windows-tdep.c
gdb/arc-tdep.c
gdb/arch/aarch64.h
gdb/arm-tdep.c
gdb/avr-tdep.c
gdb/bfin-tdep.c
gdb/bpf-tdep.c
gdb/cris-tdep.c
gdb/csky-tdep.c
gdb/dwarf2/read.c
gdb/elfread.c
gdb/frv-tdep.c
gdb/ft32-tdep.c
gdb/gdbarch.c
gdb/gdbarch.h
gdb/gdbarch.sh
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/h8300-tdep.c
gdb/hppa-tdep.c
gdb/i386-tdep.c
gdb/ia64-tdep.c
gdb/infcall.c
gdb/infcmd.c
gdb/lm32-tdep.c
gdb/m32c-tdep.c
gdb/m32r-tdep.c
gdb/m68hc11-tdep.c
gdb/m68k-tdep.c
gdb/mep-tdep.c
gdb/microblaze-tdep.c
gdb/mips-tdep.c
gdb/mn10300-tdep.c
gdb/moxie-tdep.c
gdb/msp430-tdep.c
gdb/nds32-tdep.c
gdb/nios2-tdep.c
gdb/or1k-tdep.c
gdb/ppc-fbsd-tdep.c
gdb/ppc-linux-tdep.c
gdb/ppc-netbsd-tdep.c
gdb/ppc-sysv-tdep.c
gdb/riscv-tdep.c
gdb/rl78-tdep.c
gdb/rs6000-aix-tdep.c
gdb/rs6000-lynx178-tdep.c
gdb/rx-tdep.c
gdb/s12z-tdep.c
gdb/s390-tdep.c
gdb/score-tdep.c
gdb/sh-tdep.c
gdb/sparc-tdep.c
gdb/sparc64-tdep.c
gdb/stack.c
gdb/tic6x-tdep.c
gdb/tilegx-tdep.c
gdb/v850-tdep.c
gdb/valprint.c
gdb/value.c
gdb/vax-tdep.c
gdb/xstormy16-tdep.c
gdb/xtensa-tdep.c

index 67c68e473adec34af1fedc69e5e17208552bdb45..a5f8f6d21f867e7f8d8c7b7d223b7e075f753369 100644 (file)
@@ -1,3 +1,89 @@
+2021-04-27  Luis Machado  <luis.machado@arm.com>
+
+       * aarch64-tdep.c (struct stack_item_t) <arg_value): New field.
+       (set_register_tag, pass_in_c, pass_in_c_or_stack,
+       pass_in_c_x_or_stack, type_fields_overlap_capabilities,
+       convert_pointer_to_capability,
+       morello_write_memory_with_capabilities,
+       morello_push_dummy_call, morello_extract_return_value,
+       morello_return_in_memory, morello_store_return_value,
+       morello_return_value): New functions.
+       (pass_in_x, pass_in_v, pass_on_stack, pass_in_x_or_stack,
+       pass_in_v_vfp_candidate): Update.
+       (aarch64_return_value): New argument value.
+       (aarch64_gdbarch_init): Conditionally set both gdbarch_push_dummy_call
+       and gdbarch_return_value.
+       * arch/aarch64.h (MORELLO_MEMORY_TAG_GRANULE_SIZE): New constant.
+       * dwarf2/read.c (handle_struct_member_die): Record whether the
+       composite type contains capabilities.
+       * gdbarch.sh (return_value): New argument value.
+       * gdbarch.c: Regenerate.
+       * gdbarch.h: Regenerate.
+       * gdbtypes.c (recursive_dump_type): Dump extra information.
+       (append_composite_type_field_raw): Set whether the composite type
+       constains capabilities.
+       * gdbtypes.h (struct main_type) <m_flag_contains_capability>: New field.
+       <contains_capability>: New member function.
+       <set_contains_capability>: New member function.
+
+       * alpha-tdep.c: Update return_value hook prototype.
+       * amd64-tdep.c: Update return_value hook prototype.
+       * amd64-windows-tdep.c: Update return_value hook prototype.
+       * arc-tdep.c: Update return_value hook prototype.
+       * arm-tdep.c: Update return_value hook prototype.
+       * avr-tdep.c: Update return_value hook prototype.
+       * bfin-tdep.c: Update return_value hook prototype.
+       * bpf-tdep.c: Update return_value hook prototype.
+       * cris-tdep.c: Update return_value hook prototype.
+       * csky-tdep.c: Update return_value hook prototype.
+       * elfread.c: Update return_value hook prototype.
+       * frv-tdep.c: Update return_value hook prototype.
+       * ft32-tdep.c: Update return_value hook prototype.
+       * h8300-tdep.c: Update return_value hook prototype.
+       * hppa-tdep.c: Update return_value hook prototype.
+       * i386-tdep.c: Update return_value hook prototype.
+       * ia64-tdep.c: Update return_value hook prototype.
+       * infcall.c: Update return_value hook prototype.
+       * infcmd.c: Update return_value hook prototype.
+       * lm32-tdep.c: Update return_value hook prototype.
+       * m32c-tdep.c: Update return_value hook prototype.
+       * m32r-tdep.c: Update return_value hook prototype.
+       * m68hc11-tdep.c: Update return_value hook prototype.
+       * m68k-tdep.c: Update return_value hook prototype.
+       * mep-tdep.c: Update return_value hook prototype.
+       * microblaze-tdep.c: Update return_value hook prototype.
+       * mips-tdep.c: Update return_value hook prototype.
+       * mn10300-tdep.c: Update return_value hook prototype.
+       * moxie-tdep.c: Update return_value hook prototype.
+       * msp430-tdep.c: Update return_value hook prototype.
+       * nds32-tdep.c: Update return_value hook prototype.
+       * nios2-tdep.c: Update return_value hook prototype.
+       * or1k-tdep.c: Update return_value hook prototype.
+       * ppc-fbsd-tdep.c: Update return_value hook prototype.
+       * ppc-linux-tdep.c: Update return_value hook prototype.
+       * ppc-netbsd-tdep.c: Update return_value hook prototype.
+       * ppc-sysv-tdep.c: Update return_value hook prototype.
+       * riscv-tdep.c: Update return_value hook prototype.
+       * rl78-tdep.c: Update return_value hook prototype.
+       * rs6000-aix-tdep.c: Update return_value hook prototype.
+       * rs6000-lynx178-tdep.c: Update return_value hook prototype.
+       * rx-tdep.c: Update return_value hook prototype.
+       * s12z-tdep.c: Update return_value hook prototype.
+       * s390-tdep.c: Update return_value hook prototype.
+       * score-tdep.c: Update return_value hook prototype.
+       * sh-tdep.c: Update return_value hook prototype.
+       * sparc-tdep.c: Update return_value hook prototype.
+       * sparc64-tdep.c: Update return_value hook prototype.
+       * stack.c: Update return_value hook prototype.
+       * tic6x-tdep.c: Update return_value hook prototype.
+       * tilegx-tdep.c: Update return_value hook prototype.
+       * v850-tdep.c: Update return_value hook prototype.
+       * valprint.c: Update return_value hook prototype.
+       * value.c: Update return_value hook prototype.
+       * vax-tdep.c: Update return_value hook prototype.
+       * xstormy16-tdep.c: Update return_value hook prototype.
+       * xtensa-tdep.c: Update return_value hook prototype.
+
 2021-03-17  Luis Machado  <luis.machado@arm.com>
 
        * aarch64-linux-nat.c (aarch64_linux_nat_target)
index fd3a8e8ae0d9e74a7d76a51b010d3318a95baee9..a6d694bb25d8bc4e0c4b6880824545eedd2681b7 100644 (file)
@@ -1771,6 +1771,9 @@ struct stack_item_t
 
   /* Size in bytes of value to pass on stack.  */
   int len;
+
+  /* The argument value, in case further processing is needed.  */
+  struct value *arg_value;
 };
 
 /* Implement the gdbarch type alignment method, overrides the generic
@@ -1965,6 +1968,109 @@ struct aarch64_call_info
   std::vector<stack_item_t> si;
 };
 
+/* Helper function to set a TAG for a particular register REGNUM.  */
+
+static void
+set_register_tag (struct gdbarch *gdbarch, struct regcache *regcache,
+                 int regnum, bool tag)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  CORE_ADDR tag_map = 0;
+
+  /* Read the tag register, adjust and write back.  */
+  regcache->cooked_read (tdep->cap_reg_last - 1, (gdb_byte *) &tag_map);
+
+  /* The CSP/PCC tags are swapped in the tag_map because the ordering of CSP/PCC
+     in struct user_morello_state is different from GDB's register description.
+
+     Make sure we account for that when setting the tag from those
+     registers.  */
+  if (regnum == tdep->cap_reg_pcc)
+    regnum = tdep->cap_reg_csp;
+  else if (regnum == tdep->cap_reg_csp)
+    regnum = tdep->cap_reg_pcc;
+
+  int shift = regnum - tdep->cap_reg_base;
+  tag_map |= (1 << shift);
+  regcache->cooked_write (tdep->cap_reg_last - 1, (gdb_byte *) &tag_map);
+}
+
+/* Pass a value in a sequence of consecutive C registers.  The caller
+   is responsible for ensuring sufficient registers are available.  */
+
+static void
+pass_in_c (struct gdbarch *gdbarch, struct regcache *regcache,
+          struct aarch64_call_info *info, struct type *type,
+          struct value *arg)
+{
+  if (aarch64_debug)
+    debug_printf ("aarch64: entering %s\n", __func__);
+
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  int regnum = tdep->cap_reg_base + info->ngrn;
+  const gdb_byte *buf = value_contents (arg);
+  gdb_byte tmpbuf[C_REGISTER_SIZE];
+  size_t len = TYPE_LENGTH (type);
+  size_t xfer_len = 0;
+  CORE_ADDR address = value_address (arg);
+
+  /* One more argument allocated.  */
+  info->argnum++;
+
+  while (len > 0)
+    {
+      /* Determine the transfer size.  */
+      xfer_len = len < C_REGISTER_SIZE ? len : C_REGISTER_SIZE;
+      /* Zero out any unspecified bytes.  */
+      memset (tmpbuf, 0, C_REGISTER_SIZE);
+      memcpy (tmpbuf, buf, xfer_len);
+
+      if (aarch64_debug)
+       {
+         enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+         CORE_ADDR regval
+           = extract_unsigned_integer (tmpbuf, xfer_len, byte_order);
+
+         CORE_ADDR regval2;
+         if (xfer_len > 8)
+           regval2
+             = extract_unsigned_integer (tmpbuf + 8, xfer_len, byte_order);
+         else
+           regval2 = 0;
+
+         debug_printf ("arg %d in %s = 0x%s 0x%s\n", info->argnum,
+                       gdbarch_register_name (gdbarch, regnum),
+                       phex (regval, X_REGISTER_SIZE),
+                       phex (regval2, X_REGISTER_SIZE));
+       }
+
+      /* Write the argument to the capability register.  */
+      regcache->raw_write (regnum, tmpbuf);
+
+      if (type->contains_capability ())
+       {
+         /* We need to read the tags from memory.  */
+         gdb::byte_vector cap = target_read_capability (address);
+         bool tag = cap[0] == 0 ? false : true;
+         set_register_tag (gdbarch, regcache, regnum, tag);
+
+         if (aarch64_debug)
+           debug_printf ("aarch64: %s Read tag %s from address %s\n",
+                         __func__, tag == true ? "true" : "false",
+                         paddress (gdbarch, address));
+
+         address += xfer_len;
+       }
+
+      len -= xfer_len;
+      buf += xfer_len;
+      regnum++;
+    }
+  if (aarch64_debug)
+    debug_printf ("aarch64: leaving %s\n", __func__);
+}
+
 /* Pass a value in a sequence of consecutive X registers.  The caller
    is responsible for ensuring sufficient registers are available.  */
 
@@ -1973,6 +2079,9 @@ pass_in_x (struct gdbarch *gdbarch, struct regcache *regcache,
           struct aarch64_call_info *info, struct type *type,
           struct value *arg)
 {
+  if (aarch64_debug)
+    debug_printf ("aarch64: entering %s\n", __func__);
+
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int len = TYPE_LENGTH (type);
   enum type_code typecode = type->code ();
@@ -2005,6 +2114,8 @@ pass_in_x (struct gdbarch *gdbarch, struct regcache *regcache,
       buf += partial_len;
       regnum++;
     }
+  if (aarch64_debug)
+    debug_printf ("aarch64: leaving %s\n", __func__);
 }
 
 /* Attempt to marshall a value in a V register.  Return 1 if
@@ -2018,6 +2129,9 @@ pass_in_v (struct gdbarch *gdbarch,
           struct aarch64_call_info *info,
           int len, const bfd_byte *buf)
 {
+  if (aarch64_debug)
+    debug_printf ("aarch64: entering %s\n", __func__);
+
   if (info->nsrn < 8)
     {
       int regnum = AARCH64_V0_REGNUM + info->nsrn;
@@ -2039,9 +2153,16 @@ pass_in_v (struct gdbarch *gdbarch,
          debug_printf ("arg %d in %s\n", info->argnum,
                        gdbarch_register_name (gdbarch, regnum));
        }
+      if (aarch64_debug)
+       debug_printf ("aarch64: leaving %s\n", __func__);
+
       return 1;
     }
   info->nsrn = 8;
+
+  if (aarch64_debug)
+    debug_printf ("aarch64: leaving %s\n", __func__);
+
   return 0;
 }
 
@@ -2051,6 +2172,9 @@ static void
 pass_on_stack (struct aarch64_call_info *info, struct type *type,
               struct value *arg)
 {
+  if (aarch64_debug)
+    debug_printf ("aarch64: entering %s\n", __func__);
+
   const bfd_byte *buf = value_contents (arg);
   int len = TYPE_LENGTH (type);
   int align;
@@ -2076,6 +2200,7 @@ pass_on_stack (struct aarch64_call_info *info, struct type *type,
 
   item.len = len;
   item.data = buf;
+  item.arg_value = arg;
   info->si.push_back (item);
 
   info->nsaa += len;
@@ -2090,6 +2215,38 @@ pass_on_stack (struct aarch64_call_info *info, struct type *type,
       info->si.push_back (item);
       info->nsaa += pad;
     }
+  if (aarch64_debug)
+    debug_printf ("aarch64: leaving %s\n", __func__);
+}
+
+/* Marshall an argument into a sequence of one or more consecutive C
+   registers or, if insufficient C registers are available then onto
+   the stack.  */
+
+static void
+pass_in_c_or_stack (struct gdbarch *gdbarch, struct regcache *regcache,
+                   struct aarch64_call_info *info, struct type *type,
+                   struct value *arg)
+{
+  if (aarch64_debug)
+    debug_printf ("aarch64: entering %s\n", __func__);
+
+  int len = TYPE_LENGTH (type);
+  int nregs = (len + C_REGISTER_SIZE - 1) / C_REGISTER_SIZE;
+
+  if (info->ngrn + nregs <= 8)
+    {
+      pass_in_c (gdbarch, regcache, info, type, arg);
+      info->ngrn += nregs;
+    }
+  else
+    {
+      info->ngrn = 8;
+      pass_on_stack (info, type, arg);
+    }
+
+  if (aarch64_debug)
+    debug_printf ("aarch64: leaving %s\n", __func__);
 }
 
 /* Marshall an argument into a sequence of one or more consecutive X
@@ -2101,6 +2258,9 @@ pass_in_x_or_stack (struct gdbarch *gdbarch, struct regcache *regcache,
                    struct aarch64_call_info *info, struct type *type,
                    struct value *arg)
 {
+  if (aarch64_debug)
+    debug_printf ("aarch64: entering %s\n", __func__);
+
   int len = TYPE_LENGTH (type);
   int nregs = (len + X_REGISTER_SIZE - 1) / X_REGISTER_SIZE;
 
@@ -2115,6 +2275,32 @@ pass_in_x_or_stack (struct gdbarch *gdbarch, struct regcache *regcache,
       info->ngrn = 8;
       pass_on_stack (info, type, arg);
     }
+
+  if (aarch64_debug)
+    debug_printf ("aarch64: leaving %s\n", __func__);
+}
+
+/* Morello: Marshall an argument into a sequence of one or more C registers.
+   If we should not pass arguments in C registers, then try X registers or
+   the stack.  */
+
+static void
+pass_in_c_x_or_stack (struct gdbarch *gdbarch, struct regcache *regcache,
+                     struct aarch64_call_info *info, struct type *type,
+                     struct value *arg)
+{
+  if (aarch64_debug)
+    debug_printf ("aarch64: entering %s\n", __func__);
+
+  /* Check if we have a case where we need to pass arguments via the C
+     registers.  */
+  if (TYPE_CAPABILITY (type) || type->contains_capability ())
+    pass_in_c_or_stack (gdbarch, regcache, info, type, arg);
+  else
+    pass_in_x_or_stack (gdbarch, regcache, info, type, arg);
+
+  if (aarch64_debug)
+    debug_printf ("aarch64: leaving %s\n", __func__);
 }
 
 /* Pass a value, which is of type arg_type, in a V register.  Assumes value is a
@@ -2126,6 +2312,9 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache,
                         struct aarch64_call_info *info, struct type *arg_type,
                         struct value *arg)
 {
+  if (aarch64_debug)
+    debug_printf ("aarch64: entering %s\n", __func__);
+
   switch (arg_type->code ())
     {
     case TYPE_CODE_FLT:
@@ -2174,7 +2363,443 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache,
     }
 }
 
-/* Implement the "push_dummy_call" gdbarch method.  */
+static bool
+type_fields_overlap_capabilities (struct type *type)
+{
+  if (aarch64_debug)
+    debug_printf ("aarch64: entering %s\n", __func__);
+
+  /* Types not containing capabilities and having sizes smaller than
+     8 bytes don't have members overlapping capabilities.  */
+  if (!type->contains_capability () || TYPE_LENGTH (type) < 8)
+    return false;
+
+  /* Byte range 8~15 */
+  int range_1_position = 8 * TARGET_CHAR_BIT;
+  /* Byte range 24~31 */
+  int range_2_position = 192 * TARGET_CHAR_BIT;
+  int range_bitsize = 8 * TARGET_CHAR_BIT;
+
+  for (int index = 0; index < type->num_fields (); index++)
+    {
+      if (type->field (index).type ()->code () == TYPE_CODE_CAPABILITY
+         || type->field (index).type ()->code () == TYPE_CODE_PTR)
+       continue;
+
+      int bitpos = TYPE_FIELD_BITPOS (type, index);
+      int bitsize = TYPE_FIELD_BITSIZE (type, index);
+
+      /* Test bytes 8~15.  */
+      if (range_1_position <= (bitpos + bitsize)
+         && bitpos <= (range_1_position + range_bitsize))
+       return true;
+
+      /* Test bytes 24~31.  */
+      if (range_2_position <= (bitpos + bitsize)
+         && bitpos <= (range_2_position + range_bitsize))
+       return true;
+    }
+  return false;
+}
+
+/* Convert a 64-bit pointer to a capability using the SOURCE capability.  */
+
+static struct value *
+convert_pointer_to_capability (struct gdbarch *gdbarch, struct value *source,
+                              CORE_ADDR pointer)
+{
+  if (aarch64_debug)
+    debug_printf ("aarch64: entering %s\n", __func__);
+
+  gdb_assert (TYPE_CAPABILITY (value_type (source)));
+
+  if (source == nullptr)
+    return nullptr;
+
+  if (value_contents (source) == nullptr)
+    return nullptr;
+
+  capability cap;
+
+  memcpy (&cap.m_cap, value_contents (source), sizeof (cap.m_cap));
+
+  if (value_tagged (source))
+    cap.set_tag (value_tag (source));
+
+  /* Adjust the capability value to that of the pointer.  This assumes the
+     capability has enough bounds to honor this value.  */
+  cap.set_value (pointer);
+
+  struct value *result = value_copy (source);
+
+  /* Adjust the contents of the new capability.  */
+  memcpy (value_contents_writeable (result), &cap.m_cap, sizeof (cap.m_cap));
+  set_value_tag (result, cap.get_tag ());
+
+  return result;
+}
+
+/* Write the contents of ARG to DESTINATION, also taking care of copying the
+   tags from ARG's source location to the destination location.  */
+
+static void
+morello_write_memory_with_capabilities (CORE_ADDR destination,
+                                       struct value *arg)
+{
+  if (aarch64_debug)
+    debug_printf ("aarch64: entering %s\n", __func__);
+
+  gdb_assert (arg != nullptr);
+
+  struct type *type = value_type (arg);
+  const gdb_byte *buffer = value_contents (arg);
+  size_t size = TYPE_LENGTH (type);
+  CORE_ADDR source = value_address (arg);
+
+  write_memory (destination, buffer, size);
+
+  if (!type->contains_capability ())
+    return;
+
+  /* If the type contains capabilities, we need to copy the tags as well.
+     Given this type contains capabilities, the data should be aligned to
+     16-bytes, which matches the tag granule.  */
+  int granules = size / MORELLO_MEMORY_TAG_GRANULE_SIZE;
+
+  while (granules != 0)
+    {
+      /* Read both the source capability and the destination capability.  */
+      gdb::byte_vector source_cap = target_read_capability (source);
+      gdb::byte_vector dest_cap = target_read_capability (destination);
+
+      /* Copy the source tag granule to the destination tag granule.  */
+      dest_cap[0] = source_cap[0];
+      target_write_capability (destination, dest_cap);
+      granules--;
+
+      source += MORELLO_MEMORY_TAG_GRANULE_SIZE;
+      destination += MORELLO_MEMORY_TAG_GRANULE_SIZE;
+    }
+
+  if (aarch64_debug)
+    debug_printf ("aarch64: Exiting %s\n", __func__);
+}
+
+/* Implement the "push_dummy_call" gdbarch method for Morello.  */
+
+static CORE_ADDR
+morello_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
+                        struct regcache *regcache, CORE_ADDR bp_addr,
+                        int nargs,
+                        struct value **args, CORE_ADDR sp,
+                        function_call_return_method return_method,
+                        CORE_ADDR struct_addr)
+{
+  int argnum;
+  struct aarch64_call_info info;
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  /* We should only be here if this is a Morello architecture.  */
+  gdb_assert (tdep->has_capability ());
+
+  if (aarch64_debug)
+    debug_printf ("aarch64: entering %s\n", __func__);
+
+  if (aarch64_debug)
+    debug_printf ("aarch64: %s Number of arguments: %s\n", __func__,
+                 pulongest (nargs));
+
+  /* Morello AAPCS64-cap ABI.  */
+  bool aapcs64_cap = (tdep->abi == AARCH64_ABI_AAPCS64_CAP);
+
+  if (aarch64_debug)
+    {
+      if (aapcs64_cap)
+       debug_printf ("aarch64: %s ABI is AAPCS64-CAP\n", __func__);
+      else
+       debug_printf ("aarch64: %s ABI is AAPCS64\n", __func__);
+    }
+
+  /* We need to know what the type of the called function is in order
+     to determine the number of named/anonymous arguments for the
+     actual argument placement, and the return type in order to handle
+     return value correctly.
+
+     The generic code above us views the decision of return in memory
+     or return in registers as a two stage processes.  The language
+     handler is consulted first and may decide to return in memory (eg
+     class with copy constructor returned by value), this will cause
+     the generic code to allocate space AND insert an initial leading
+     argument.
+
+     If the language code does not decide to pass in memory then the
+     target code is consulted.
+
+     If the language code decides to pass in memory we want to move
+     the pointer inserted as the initial argument from the argument
+     list and into X8, the conventional AArch64 struct return pointer
+     register.  */
+
+  /* Set the return address.  For the AArch64, the return breakpoint
+     is always at BP_ADDR.  */
+
+  /* We should use CLR for AARCH64-CAP and LR for AAPCS64.  */
+  int regnum = AARCH64_LR_REGNUM;
+
+  if (aapcs64_cap)
+    {
+      regnum = tdep->cap_reg_clr;
+
+      /* For now, assume BP_ADDR is within the bounds of the CLR
+        capability.  */
+      struct value *clr = regcache->cooked_read_value (regnum);
+      regcache->cooked_write (regnum, value_contents (clr));
+      set_register_tag (gdbarch, regcache, regnum, value_tag (clr));
+    }
+
+  if (aarch64_debug)
+    debug_printf ("aarch64: Breakpoint address in %s is %s\n",
+                 gdbarch_register_name (gdbarch, regnum),
+                 paddress (gdbarch, bp_addr));
+
+  regcache_cooked_write_unsigned (regcache, AARCH64_LR_REGNUM, bp_addr);
+
+  /* If we were given an initial argument for the return slot, lose it.  */
+  if (return_method == return_method_hidden_param)
+    {
+      args++;
+      nargs--;
+    }
+
+  /* The struct_return pointer occupies X8.  */
+  if (return_method != return_method_normal)
+    {
+      /* We should use C8 for AARCH64-CAP and X8 for AAPCS64.  */
+      regnum = AARCH64_STRUCT_RETURN_REGNUM;
+
+      if (aapcs64_cap)
+       {
+         regnum = tdep->cap_reg_base + AARCH64_STRUCT_RETURN_REGNUM;
+
+         /* For now, assume STRUCT_ADDR is within the bounds of the CSP
+            capability.  */
+         struct value *csp = regcache->cooked_read_value (regnum);
+         regcache->cooked_write (regnum, value_contents (csp));
+         set_register_tag (gdbarch, regcache, regnum, value_tag (csp));
+       }
+
+      if (aarch64_debug)
+       {
+         debug_printf ("aarch64: struct return in %s = 0x%s\n",
+                       gdbarch_register_name (gdbarch,
+                                              regnum),
+                       paddress (gdbarch, struct_addr));
+       }
+
+      regcache_cooked_write_unsigned (regcache, AARCH64_STRUCT_RETURN_REGNUM,
+                                     struct_addr);
+    }
+
+  for (argnum = 0; argnum < nargs; argnum++)
+    {
+      struct value *arg = args[argnum];
+      struct type *arg_type, *fundamental_type;
+      int len, elements;
+
+      if (aarch64_debug)
+       debug_printf ("aarch64: %s Processing argument %s\n", __func__,
+                     pulongest (argnum));
+
+      arg_type = check_typedef (value_type (arg));
+      len = TYPE_LENGTH (arg_type);
+
+      /* If arg can be passed in v registers as per the AAPCS64, then do so if
+        if there are enough spare registers.  */
+      if (aapcs_is_vfp_call_or_return_candidate (arg_type, &elements,
+                                                &fundamental_type))
+       {
+         if (info.nsrn + elements <= 8)
+           {
+             /* We know that we have sufficient registers available therefore
+                this will never need to fallback to the stack.  */
+             if (!pass_in_v_vfp_candidate (gdbarch, regcache, &info, arg_type,
+                                           arg))
+               gdb_assert_not_reached ("Failed to push args");
+           }
+         else
+           {
+             info.nsrn = 8;
+             pass_on_stack (&info, arg_type, arg);
+           }
+         continue;
+       }
+
+      switch (arg_type->code ())
+       {
+       case TYPE_CODE_INT:
+       case TYPE_CODE_BOOL:
+       case TYPE_CODE_CHAR:
+       case TYPE_CODE_RANGE:
+       case TYPE_CODE_ENUM:
+         if (len < 4)
+           {
+             if (aarch64_debug)
+               debug_printf ("aarch64: %s Handling types with length < 4\n",
+                             __func__);
+
+             /* Promote to 32 bit integer.  */
+             if (arg_type->is_unsigned ())
+               arg_type = builtin_type (gdbarch)->builtin_uint32;
+             else
+               arg_type = builtin_type (gdbarch)->builtin_int32;
+             arg = value_cast (arg_type, arg);
+           }
+         if (aarch64_debug && len >= 4)
+           debug_printf ("aarch64: %s Handling types with length >= 4\n",
+                         __func__);
+         pass_in_x_or_stack (gdbarch, regcache, &info, arg_type, arg);
+         break;
+
+       case TYPE_CODE_STRUCT:
+       case TYPE_CODE_ARRAY:
+       case TYPE_CODE_UNION:
+         /* Morello AAPCS: B.5:  */
+         if (arg_type->contains_capability ()
+             && (len > 32 || type_fields_overlap_capabilities (arg_type)))
+           {
+             if (aarch64_debug)
+               debug_printf ("aarch64: %s Composite type with capabilities "
+                             "and len > 32 or overlapping types\n", __func__);
+             /* If the argument is a Composite Type containing Capabilities
+                and the size is larger than 32 bytes or there are
+                addressable members which are not Capabilities that
+                overlap bytes 8-15 or 24-31 of the argument (if such bytes
+                exist) then the argument is copied to memory allocated by
+                the caller and the argument is replaced by a pointer to
+                the copy in AAPCS64 or a capability to a copy in
+                AAPCS64-cap.  */
+
+             /* Allocate aligned storage.  */
+             sp = align_down (sp - len, 16);
+
+             /* Write the real data into the stack.  Since this type contains
+                capabilities, we need to handle writing the capabilities and
+                adjusting the memory tags.  */
+             morello_write_memory_with_capabilities (sp, arg);
+
+             /* Construct the indirection.  Create a capability or a pointer
+                depending on the ELF ABI being used (AAPCS64-cap or
+                AAPCS64).  */
+             if (aapcs64_cap)
+               {
+                 /* Derive a capability from CSP and forge the indirection
+                    capability.  */
+                 struct value *csp
+                   = regcache->cooked_read_value (tdep->cap_reg_csp);
+                 arg = convert_pointer_to_capability (gdbarch, csp, sp);
+                 arg_type = value_type (csp);
+               }
+             else
+               {
+                 /* Use a regular pointer.  */
+                 arg_type = lookup_pointer_type (arg_type);
+                 arg = value_from_pointer (arg_type, sp);
+               }
+             pass_in_c_x_or_stack (gdbarch, regcache, &info, arg_type, arg);
+           }
+         else if (len > 16 && !arg_type->contains_capability ())
+           {
+             if (aarch64_debug)
+               debug_printf ("aarch64: %s Composite type without capabilities "
+                             "and len > 16\n", __func__);
+             /* Morello AAPCS B.3: Aggregates larger than 16 bytes, not
+                containing capabilities, are passed by invisible reference.  */
+
+             /* Allocate aligned storage.  */
+             sp = align_down (sp - len, 16);
+
+             /* Write the real data into the stack.  */
+             write_memory (sp, value_contents (arg), len);
+
+             /* Construct the indirection.  Create a capability or a pointer
+                depending on the ELF ABI being used (AAPCS64-cap or
+                AAPCS64).  */
+             if (aapcs64_cap)
+               {
+                 /* Derive a capability from CSP and forge the indirection
+                    capability.  */
+                 struct value *csp
+                   = regcache->cooked_read_value (tdep->cap_reg_csp);
+                 arg = convert_pointer_to_capability (gdbarch, csp, sp);
+                 arg_type = value_type (csp);
+               }
+             else
+               {
+                 /* Use a regular pointer.  */
+                 arg_type = lookup_pointer_type (arg_type);
+                 arg = value_from_pointer (arg_type, sp);
+               }
+             pass_in_c_x_or_stack (gdbarch, regcache, &info, arg_type, arg);
+           }
+         else
+           {
+             /* PCS C.15 / C.18 multiple values pass.  */
+             /* Morello AAPCS C.16 / C.8.  */
+             if (aarch64_debug)
+               debug_printf ("aarch64: %s Composite type default case "
+                             "len is %s\n", __func__, pulongest (len));
+             pass_in_c_x_or_stack (gdbarch, regcache, &info, arg_type, arg);
+           }
+         break;
+
+       default:
+         if (aarch64_debug)
+           debug_printf ("aarch64: %s default case\n", __func__);
+         pass_in_c_x_or_stack (gdbarch, regcache, &info, arg_type, arg);
+         break;
+       }
+    }
+
+  /* Make sure stack retains 16 byte alignment.  */
+  if (info.nsaa & 15)
+    sp -= 16 - (info.nsaa & 15);
+
+  while (!info.si.empty ())
+    {
+      const stack_item_t &si = info.si.back ();
+
+      sp -= si.len;
+      if (si.data != NULL)
+       morello_write_memory_with_capabilities (sp, si.arg_value);
+      info.si.pop_back ();
+    }
+
+  regnum = AARCH64_SP_REGNUM;
+
+  /* We should use CSP for AARCH64-CAP and SP for AAPCS64.  */
+  if (aapcs64_cap)
+    {
+      regnum = tdep->cap_reg_csp;
+
+      struct value *csp = regcache->cooked_read_value (regnum);
+      regcache->cooked_write (regnum, value_contents (csp));
+      set_register_tag (gdbarch, regcache, regnum, value_tag (csp));
+    }
+
+    if (aarch64_debug)
+      debug_printf ("aarch64: Adjusting stack pointer in %s to %s\n",
+                   gdbarch_register_name (gdbarch, regnum),
+                   paddress (gdbarch, sp));
+
+  regcache_cooked_write_unsigned (regcache, AARCH64_SP_REGNUM, sp);
+
+  if (aarch64_debug)
+    debug_printf ("aarch64: Exiting %s\n", __func__);
+
+  return sp;
+}
+
+/* Implement the "push_dummy_call" gdbarch method for generic AARCH64.  */
 
 static CORE_ADDR
 aarch64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
@@ -2648,77 +3273,249 @@ aarch64_find_mapping_symbol (CORE_ADDR memaddr, CORE_ADDR *start)
                }
            }
 
-         if (it > map.begin ())
-           {
-             aarch64_mapping_symbol_vec::const_iterator prev_it
-               = it - 1;
+         if (it > map.begin ())
+           {
+             aarch64_mapping_symbol_vec::const_iterator prev_it
+               = it - 1;
+
+             if (start)
+               *start = prev_it->value + obj_section_addr (sec);
+             return prev_it->type;
+           }
+       }
+    }
+
+  return 0;
+}
+
+/* Determine if the program counter specified in MEMADDR is in a C64
+   function.  This function should be called for addresses unrelated to
+   any executing frame.  */
+
+static bool
+aarch64_pc_is_c64 (struct gdbarch *gdbarch, CORE_ADDR memaddr)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  /* If we're using the AAPCS64-CAP ABI, then this is pure-cap and it is
+     always C64.  */
+  if (tdep->abi == AARCH64_ABI_AAPCS64_CAP)
+    return true;
+
+  /* If there are mapping symbols, consult them.  */
+  char type = aarch64_find_mapping_symbol (memaddr, NULL);
+  if (type)
+    return type == 'c';
+
+  /* C64 functions have a "special" bit set in minimal symbols.  */
+  struct bound_minimal_symbol sym;
+  sym = lookup_minimal_symbol_by_pc (memaddr);
+  if (sym.minsym)
+    return (MSYMBOL_IS_SPECIAL (sym.minsym));
+
+  /* Otherwise we're out of luck; we assume A64.  */
+  return false;
+}
+
+/* Implement the "print_insn" gdbarch method.  */
+
+static int
+aarch64_gdb_print_insn (bfd_vma memaddr, disassemble_info *info)
+{
+  gdb_disassembler *di
+    = static_cast<gdb_disassembler *>(info->application_data);
+  struct gdbarch *gdbarch = di->arch ();
+  struct aarch64_private_data data;
+
+  info->private_data = static_cast<void *> (&data);
+
+  if (aarch64_pc_is_c64 (gdbarch, memaddr))
+    data.instruction_type = MAP_TYPE_C64;
+
+  info->symbols = NULL;
+
+  return default_print_insn (memaddr, info);
+}
+
+/* AArch64 BRK software debug mode instruction.
+   Note that AArch64 code is always little-endian.
+   1101.0100.0010.0000.0000.0000.0000.0000 = 0xd4200000.  */
+constexpr gdb_byte aarch64_default_breakpoint[] = {0x00, 0x00, 0x20, 0xd4};
+
+typedef BP_MANIPULATION (aarch64_default_breakpoint) aarch64_breakpoint;
+
+/* Extract from an array REGS containing the (raw) register state a
+   function return value of type TYPE, and copy that, in virtual
+   format, into VALBUF.  Morello version.  */
+
+static void
+morello_extract_return_value (struct value *value, struct regcache *regs,
+                             gdb_byte *valbuf)
+{
+  if (aarch64_debug)
+    debug_printf ("aarch64: entering %s\n", __func__);
+
+  struct type *type = value_type (value);
+  struct gdbarch *gdbarch = regs->arch ();
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+  int elements;
+  struct type *fundamental_type;
+  /* Morello AAPCS64-cap ABI.  */
+  bool aapcs64_cap = (tdep->abi == AARCH64_ABI_AAPCS64_CAP);
+
+  if (aarch64_debug)
+    debug_printf ("aarch64: %s: ABI is %s\n", __func__,
+                 aapcs64_cap ? "AAPCS64-CAP" : "AAPCS64");
+
+  if (aapcs_is_vfp_call_or_return_candidate (type, &elements,
+                                            &fundamental_type))
+    {
+      int len = TYPE_LENGTH (fundamental_type);
+
+      for (int i = 0; i < elements; i++)
+       {
+         int regno = AARCH64_V0_REGNUM + i;
+         /* Enough space for a full vector register.  */
+         gdb_byte buf[register_size (gdbarch, regno)];
+         gdb_assert (len <= sizeof (buf));
+
+         if (aarch64_debug)
+           {
+             debug_printf ("read HFA or HVA return value element %d from %s\n",
+                           i + 1,
+                           gdbarch_register_name (gdbarch, regno));
+           }
+         regs->cooked_read (regno, buf);
+
+         memcpy (valbuf, buf, len);
+         valbuf += len;
+       }
+    }
+  else if (type->code () == TYPE_CODE_PTR
+          || type->code () == TYPE_CODE_CAPABILITY
+          || TYPE_IS_REFERENCE (type))
+    {
+      if (aarch64_debug)
+       debug_printf ("aarch64: %s: Pointer/Capability types\n", __func__);
+
+      int regno;
+
+      if (aapcs64_cap)
+       {
+         regno = tdep->cap_reg_base + AARCH64_X0_REGNUM;
+         set_value_tagged (value, true);
+         set_value_tag (value, true);
+       }
+      else
+       regno = AARCH64_X0_REGNUM;
+
+      regs->cooked_read (regno, valbuf);
+    }
+  else if (type->code () == TYPE_CODE_INT
+          || type->code () == TYPE_CODE_CHAR
+          || type->code () == TYPE_CODE_BOOL
+          || type->code () == TYPE_CODE_ENUM)
+    {
+      if (aarch64_debug)
+       debug_printf ("aarch64: %s: Integral types, size %s\n", __func__,
+                     pulongest (TYPE_LENGTH (type)));
+
+      /* If the type is a plain integer, then the access is
+        straight-forward.  Otherwise we have to play around a bit
+        more.  */
+      int len = TYPE_LENGTH (type);
+      int regno = AARCH64_X0_REGNUM;
+      ULONGEST tmp;
 
-             if (start)
-               *start = prev_it->value + obj_section_addr (sec);
-             return prev_it->type;
-           }
+      while (len > 0)
+       {
+         /* By using store_unsigned_integer we avoid having to do
+            anything special for small big-endian values.  */
+         regcache_cooked_read_unsigned (regs, regno++, &tmp);
+         store_unsigned_integer (valbuf,
+                                 (len > X_REGISTER_SIZE
+                                  ? X_REGISTER_SIZE : len), byte_order, tmp);
+         len -= X_REGISTER_SIZE;
+         valbuf += X_REGISTER_SIZE;
        }
     }
+  else
+    {
+      if (aarch64_debug)
+       debug_printf ("aarch64: %s: Composite types, size %s\n", __func__,
+                     pulongest (TYPE_LENGTH (type)));
+      /* For a structure or union the behaviour is as if the value had
+         been stored to word-aligned memory and then loaded into
+         registers with 64-bit load instruction(s).  */
+      int len = TYPE_LENGTH (type);
+      int regno = tdep->cap_reg_base + AARCH64_X0_REGNUM;
+      bfd_byte buf[C_REGISTER_SIZE];
 
-  return 0;
+      while (len > 0)
+       {
+         memset (valbuf, 0, C_REGISTER_SIZE);
+         regs->cooked_read (regno++, buf);
+         memcpy (valbuf, buf, len > C_REGISTER_SIZE ? C_REGISTER_SIZE : len);
+         len -= C_REGISTER_SIZE;
+         valbuf += C_REGISTER_SIZE;
+       }
+    }
+  if (aarch64_debug)
+    debug_printf ("aarch64: leaving %s\n", __func__);
 }
 
-/* Determine if the program counter specified in MEMADDR is in a C64
-   function.  This function should be called for addresses unrelated to
-   any executing frame.  */
+
+/* Will a function return an aggregate type in memory or in a
+   register?  Return 0 if an aggregate type can be returned in a
+   register, 1 if it must be returned in memory.  Morello implementation.  */
 
 static bool
-aarch64_pc_is_c64 (struct gdbarch *gdbarch, CORE_ADDR memaddr)
+morello_return_in_memory (struct gdbarch *gdbarch, struct type *type)
 {
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  if (aarch64_debug)
+    debug_printf ("aarch64: entering %s\n", __func__);
 
-  /* If we're using the AAPCS64-CAP ABI, then this is pure-cap and it is
-     always C64.  */
-  if (tdep->abi == AARCH64_ABI_AAPCS64_CAP)
-    return true;
+  type = check_typedef (type);
+  int elements;
+  struct type *fundamental_type;
 
-  /* If there are mapping symbols, consult them.  */
-  char type = aarch64_find_mapping_symbol (memaddr, NULL);
-  if (type)
-    return type == 'c';
+  if (aapcs_is_vfp_call_or_return_candidate (type, &elements,
+                                            &fundamental_type))
+    {
+      /* v0-v7 are used to return values and one register is allocated
+        for one member.  However, HFA or HVA has at most four members.  */
 
-  /* C64 functions have a "special" bit set in minimal symbols.  */
-  struct bound_minimal_symbol sym;
-  sym = lookup_minimal_symbol_by_pc (memaddr);
-  if (sym.minsym)
-    return (MSYMBOL_IS_SPECIAL (sym.minsym));
+      if (aarch64_debug)
+       debug_printf ("aarch64: %s: Morello AAPCS VFP\n", __func__);
 
-  /* Otherwise we're out of luck; we assume A64.  */
-  return false;
-}
+      return false;
+    }
 
-/* Implement the "print_insn" gdbarch method.  */
+  size_t length = TYPE_LENGTH (type);
 
-static int
-aarch64_gdb_print_insn (bfd_vma memaddr, disassemble_info *info)
-{
-  gdb_disassembler *di
-    = static_cast<gdb_disassembler *>(info->application_data);
-  struct gdbarch *gdbarch = di->arch ();
-  struct aarch64_private_data data;
+  /* Morello AAPCS B.5 */
+  if (type->contains_capability ()
+      && (length > 32 || type_fields_overlap_capabilities (type)))
+    {
+      if (aarch64_debug)
+       debug_printf ("aarch64: %s: Morello AAPCS B.5\n", __func__);
 
-  info->private_data = static_cast<void *> (&data);
+      return true;
+    }
 
-  if (aarch64_pc_is_c64 (gdbarch, memaddr))
-    data.instruction_type = MAP_TYPE_C64;
+  /* Morello AAPCS B.3 */
+  if (length > 16 && !type->contains_capability ())
+    {
+      if (aarch64_debug)
+       debug_printf ("aarch64: %s: Morello AAPCS B.3\n", __func__);
 
-  info->symbols = NULL;
+      return true;
+    }
 
-  return default_print_insn (memaddr, info);
+  return false;
 }
 
-/* AArch64 BRK software debug mode instruction.
-   Note that AArch64 code is always little-endian.
-   1101.0100.0010.0000.0000.0000.0000.0000 = 0xd4200000.  */
-constexpr gdb_byte aarch64_default_breakpoint[] = {0x00, 0x00, 0x20, 0xd4};
-
-typedef BP_MANIPULATION (aarch64_default_breakpoint) aarch64_breakpoint;
-
 /* Extract from an array REGS containing the (raw) register state a
    function return value of type TYPE, and copy that, in virtual
    format, into VALBUF.  */
@@ -2801,7 +3598,6 @@ aarch64_extract_return_value (struct type *type, struct regcache *regs,
     }
 }
 
-
 /* Will a function return an aggregate type in memory or in a
    register?  Return 0 if an aggregate type can be returned in a
    register, 1 if it must be returned in memory.  */
@@ -2832,6 +3628,167 @@ aarch64_return_in_memory (struct gdbarch *gdbarch, struct type *type)
   return 0;
 }
 
+/* Write into appropriate registers a function return value of type
+   TYPE, given in virtual format.  Morello version.  */
+
+static void
+morello_store_return_value (struct value *value, struct regcache *regs,
+                           const gdb_byte *valbuf)
+{
+  if (aarch64_debug)
+    debug_printf ("aarch64: entering %s\n", __func__);
+
+  struct type *type = value_type (value);
+  struct gdbarch *gdbarch = regs->arch ();
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+  int elements;
+  struct type *fundamental_type;
+  /* Morello AAPCS64-cap ABI.  */
+  bool aapcs64_cap = (tdep->abi == AARCH64_ABI_AAPCS64_CAP);
+
+  if (aarch64_debug)
+    debug_printf ("aarch64: %s: ABI is %s\n", __func__,
+                 aapcs64_cap ? "AAPCS64-CAP" : "AAPCS64");
+
+  if (aapcs_is_vfp_call_or_return_candidate (type, &elements,
+                                            &fundamental_type))
+    {
+      int len = TYPE_LENGTH (fundamental_type);
+
+      for (int i = 0; i < elements; i++)
+       {
+         int regno = AARCH64_V0_REGNUM + i;
+         /* Enough space for a full vector register.  */
+         gdb_byte tmpbuf[register_size (gdbarch, regno)];
+         gdb_assert (len <= sizeof (tmpbuf));
+
+         if (aarch64_debug)
+           {
+             debug_printf ("write HFA or HVA return value element %d to %s\n",
+                           i + 1,
+                           gdbarch_register_name (gdbarch, regno));
+           }
+
+         memcpy (tmpbuf, valbuf,
+                 len > V_REGISTER_SIZE ? V_REGISTER_SIZE : len);
+         regs->cooked_write (regno, tmpbuf);
+         valbuf += len;
+       }
+    }
+  else if (type->code () == TYPE_CODE_PTR
+          || type->code () == TYPE_CODE_CAPABILITY
+          || TYPE_IS_REFERENCE (type))
+    {
+      int regno;
+
+      if (aarch64_debug)
+       debug_printf ("aarch64: %s: Pointer/Capability types\n", __func__);
+
+      if (aapcs64_cap || type->code () == TYPE_CODE_CAPABILITY)
+       regno = tdep->cap_reg_base + AARCH64_X0_REGNUM;
+      else
+       regno = AARCH64_X0_REGNUM;
+
+      regs->cooked_write (regno, valbuf);
+
+      /* Also store the tag if we are dealing with a capability.  */
+      if (aapcs64_cap || type->code () == TYPE_CODE_CAPABILITY)
+       set_register_tag (gdbarch, regs, regno, value_tag (value));
+    }
+  else if (type->code () == TYPE_CODE_INT
+          || type->code () == TYPE_CODE_CHAR
+          || type->code () == TYPE_CODE_BOOL
+          || type->code () == TYPE_CODE_ENUM)
+    {
+      if (aarch64_debug)
+       debug_printf ("aarch64: %s: Integral types, size %s\n", __func__,
+                     pulongest (TYPE_LENGTH (type)));
+
+      if (TYPE_LENGTH (type) <= X_REGISTER_SIZE)
+       {
+         /* Values of one word or less are zero/sign-extended and
+            returned in r0.  */
+         int regno = AARCH64_X0_REGNUM;
+         bfd_byte tmpbuf[X_REGISTER_SIZE];
+         LONGEST val = unpack_long (type, valbuf);
+
+         memset (tmpbuf, 0, X_REGISTER_SIZE);
+         store_signed_integer (tmpbuf, X_REGISTER_SIZE, byte_order, val);
+         regs->cooked_write (regno, tmpbuf);
+       }
+      else
+       {
+         /* Integral values greater than one word are stored in
+            consecutive registers starting with r0.  This will always
+            be a multiple of the register size.  */
+         int len = TYPE_LENGTH (type);
+         int regno = tdep->cap_reg_base + AARCH64_X0_REGNUM;
+
+         while (len > 0)
+           {
+             regs->cooked_write (regno++, valbuf);
+             len -= X_REGISTER_SIZE;
+             valbuf += X_REGISTER_SIZE;
+           }
+       }
+    }
+  else
+    {
+      if (aarch64_debug)
+       debug_printf ("aarch64: %s: Composite types, size %s\n", __func__,
+                     pulongest (TYPE_LENGTH (type)));
+      /* For a structure or union the behaviour is as if the value had
+        been stored to word-aligned memory and then loaded into
+        registers with 64-bit load instruction(s).  */
+
+      int regno;
+      size_t buffer_size;
+
+      if (aapcs64_cap || type->contains_capability ())
+       {
+         regno = tdep->cap_reg_base + AARCH64_X0_REGNUM;
+         buffer_size = C_REGISTER_SIZE;
+       }
+      else
+       {
+         regno = AARCH64_X0_REGNUM;
+         buffer_size = X_REGISTER_SIZE;
+       }
+
+      int len = TYPE_LENGTH (type);
+      bfd_byte tmpbuf[buffer_size];
+      CORE_ADDR address = value_address (value);
+
+      while (len > 0)
+       {
+         memset (tmpbuf, 0, buffer_size);
+         memcpy (tmpbuf, valbuf,
+                 len > buffer_size ? buffer_size : len);
+         regs->cooked_write (regno++, tmpbuf);
+
+         if (aapcs64_cap || type->contains_capability ())
+           {
+             /* We need to read the tags from memory.  */
+             gdb::byte_vector cap = target_read_capability (address);
+             bool tag = cap[0] == 0 ? false : true;
+             set_register_tag (gdbarch, regs, regno, tag);
+
+             if (aarch64_debug)
+               debug_printf ("aarch64: %s Read tag %s from address %s\n",
+                             __func__, tag == true ? "true" : "false",
+                             paddress (gdbarch, address));
+             address += buffer_size;
+           }
+
+         len -= buffer_size;
+         valbuf += buffer_size;
+       }
+    }
+  if (aarch64_debug)
+    debug_printf ("aarch64: leaving %s\n", __func__);
+}
+
 /* Write into appropriate registers a function return value of type
    TYPE, given in virtual format.  */
 
@@ -2922,11 +3879,54 @@ aarch64_store_return_value (struct type *type, struct regcache *regs,
     }
 }
 
-/* Implement the "return_value" gdbarch method.  */
+/* Implement the "return_value" gdbarch method for Morello.  */
+
+static enum return_value_convention
+morello_return_value (struct gdbarch *gdbarch, struct value *func_value,
+                     struct type *valtype, struct regcache *regcache,
+                     struct value *value,
+                     gdb_byte *readbuf, const gdb_byte *writebuf)
+{
+  if (aarch64_debug)
+    debug_printf ("aarch64: entering %s\n", __func__);
+
+  if (valtype->code () == TYPE_CODE_STRUCT
+      || valtype->code () == TYPE_CODE_UNION
+      || valtype->code () == TYPE_CODE_ARRAY)
+    {
+      if (morello_return_in_memory (gdbarch, valtype))
+       {
+         if (aarch64_debug)
+           debug_printf ("return value in memory\n");
+
+         if (aarch64_debug)
+           debug_printf ("aarch64: exiting %s\n", __func__);
+
+         return RETURN_VALUE_STRUCT_CONVENTION;
+       }
+    }
+
+  if (writebuf)
+    morello_store_return_value (value, regcache, writebuf);
+
+  if (readbuf)
+    morello_extract_return_value (value, regcache, readbuf);
+
+  if (aarch64_debug)
+    debug_printf ("return value in registers\n");
+
+  if (aarch64_debug)
+    debug_printf ("aarch64: exiting %s\n", __func__);
+
+  return RETURN_VALUE_REGISTER_CONVENTION;
+}
+
+/* Implement the "return_value" gdbarch method for generic AARCH64.  */
 
 static enum return_value_convention
 aarch64_return_value (struct gdbarch *gdbarch, struct value *func_value,
                      struct type *valtype, struct regcache *regcache,
+                     struct value *value,
                      gdb_byte *readbuf, const gdb_byte *writebuf)
 {
 
@@ -4446,6 +5446,11 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
       set_gdbarch_sp_regnum (gdbarch, tdep->cap_reg_csp);
       set_gdbarch_pc_regnum (gdbarch, tdep->cap_reg_pcc);
 
+      /* Morello-specific implementations for function calls and returning
+        of results.  */
+      set_gdbarch_push_dummy_call (gdbarch, morello_push_dummy_call);
+      set_gdbarch_return_value (gdbarch, morello_return_value);
+
       /* Address manipulation.  */
       set_gdbarch_addr_bits_remove (gdbarch, aarch64_addr_bits_remove);
 
index 377d7b1ac1a3db90d78f846eddf506488a7fb3da..f2496f6f5d2bd635eadfd3ab70a41ef1cd2bdbbd 100644 (file)
@@ -612,6 +612,7 @@ alpha_store_return_value (struct type *valtype, struct regcache *regcache,
 static enum return_value_convention
 alpha_return_value (struct gdbarch *gdbarch, struct value *function,
                    struct type *type, struct regcache *regcache,
+                   struct value *value,
                    gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   enum type_code code = type->code ();
index e801f83ddbc7d3b787aec621db8c28079c9a4846..9194c0d7db23bcae6a298a28db11ba9f461c20e3 100644 (file)
@@ -773,6 +773,7 @@ amd64_classify (struct type *type, enum amd64_reg_class theclass[2])
 static enum return_value_convention
 amd64_return_value (struct gdbarch *gdbarch, struct value *function,
                    struct type *type, struct regcache *regcache,
+                   struct value *value,
                    gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   enum amd64_reg_class theclass[2];
index 48cd009553858ecd4a57368193b969afe6f0331f..fa065b1e2ab8ee8ca5f591d78404b891d0acf88d 100644 (file)
@@ -355,6 +355,7 @@ amd64_windows_push_dummy_call
 static enum return_value_convention
 amd64_windows_return_value (struct gdbarch *gdbarch, struct value *function,
                            struct type *type, struct regcache *regcache,
+                           struct value *value,
                            gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   int len = TYPE_LENGTH (type);
index 3b7a419dfc18cac4aaebda4b4999ee26c00adce1..d68a157e95f549bc0a41e5b3cfd03ac9b894df8a 100644 (file)
@@ -1035,6 +1035,7 @@ arc_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
 static enum return_value_convention
 arc_return_value (struct gdbarch *gdbarch, struct value *function,
                  struct type *valtype, struct regcache *regcache,
+                 struct value *value,
                  gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   /* If the return type is a struct, or a union, or would occupy more than two
index 1db0fac6b859fdaf12b9723518c08cdea5645383..ffd62252f569bb455d3756e11cf82903d5f98945 100644 (file)
@@ -59,6 +59,9 @@ enum aarch64_regnum
   AARCH64_LAST_V_ARG_REGNUM = AARCH64_V0_REGNUM + 7
 };
 
+/* Size of a memory tag granule for Morello.  */
+#define MORELLO_MEMORY_TAG_GRANULE_SIZE 16
+
 /* Pseudo register base numbers.  */
 #define AARCH64_Q0_REGNUM 0
 #define AARCH64_D0_REGNUM (AARCH64_Q0_REGNUM + AARCH64_D_REGISTER_COUNT)
index a214f22d7ad10740c67509c4018b4494c5e7f7fe..a2e68cbca3645627a0423038c42c50b2b421d3bd 100644 (file)
@@ -8213,6 +8213,7 @@ arm_store_return_value (struct type *type, struct regcache *regs,
 static enum return_value_convention
 arm_return_value (struct gdbarch *gdbarch, struct value *function,
                  struct type *valtype, struct regcache *regcache,
+                 struct value *value,
                  gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
index 68b8487de79bb0d418e4530d2731723a3432f28d..a93a2c7c5dacf751a77c79b0411153d3b970338d 100644 (file)
@@ -930,6 +930,7 @@ typedef BP_MANIPULATION (avr_break_insn) avr_breakpoint;
 static enum return_value_convention
 avr_return_value (struct gdbarch *gdbarch, struct value *function,
                  struct type *valtype, struct regcache *regcache,
+                 struct value *value,
                  gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   int i;
index 55fb6a61d6d6d5484678ee58003c5d7e14525669..932809eac8c3573ce18e2b6a1f344100628442b5 100644 (file)
@@ -664,6 +664,7 @@ bfin_return_value (struct gdbarch *gdbarch,
                   struct value *function,
                   struct type *type,
                   struct regcache *regcache,
+                  struct value *value,
                   gdb_byte *readbuf,
                   const gdb_byte *writebuf)
 {
index 4854325cd1542a3f63b8a764c68ec6c6911eb8d6..7db6dc46d2f09b4971920f71cd79069732101251 100644 (file)
@@ -291,6 +291,7 @@ bpf_store_return_value (struct type *type, struct regcache *regcache,
 static enum return_value_convention
 bpf_return_value (struct gdbarch *gdbarch, struct value *function,
                  struct type *type, struct regcache *regcache,
+                 struct value *value,
                  gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   int len = TYPE_LENGTH (type);
index 068ae9908d734dcdf659b17c3fb94610cb626ee3..f6aed7c459f2eff5289eb054a8203dac0c32c6dc 100644 (file)
@@ -1803,6 +1803,7 @@ cris_extract_return_value (struct type *type, struct regcache *regcache,
 static enum return_value_convention
 cris_return_value (struct gdbarch *gdbarch, struct value *function,
                   struct type *type, struct regcache *regcache,
+                  struct value *value,
                   gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   if (type->code () == TYPE_CODE_STRUCT
index f2015a40ac3245fba03281df21dae0200e887278..55d62b0853597f371ec05cda815f4057744661fe 100644 (file)
@@ -428,6 +428,7 @@ csky_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 static enum return_value_convention
 csky_return_value (struct gdbarch *gdbarch, struct value *function,
                   struct type *valtype, struct regcache *regcache,
+                  struct value *value,
                   gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   CORE_ADDR regval;
index d3cab7f61903902092c66903791802b8908156dd..cea532e129cfe4006bb6994d6583ab0b5894be5b 100644 (file)
@@ -16249,6 +16249,15 @@ handle_struct_member_die (struct die_info *child_die, struct type *type,
     handle_variant_part (child_die, type, fi, template_args, cu);
   else if (child_die->tag == DW_TAG_variant)
     handle_variant (child_die, type, fi, template_args, cu);
+
+  struct type *child_type = die_type (child_die, cu);
+
+  /* If the composite type contains capabilities, cache that information.  */
+  if (child_type != nullptr
+      && (child_type->contains_capability ()
+         || child_type->code () == TYPE_CODE_CAPABILITY
+         || TYPE_CAPABILITY (child_type)))
+    type->set_contains_capability (true);
 }
 
 /* Finish creating a structure or union type, including filling in
index 5dad3ddd94041ab60d05d63d150467627df8a8f3..ae5fa8b9b01ea81e47402e5dc036270f82ed7e75 100644 (file)
@@ -1019,7 +1019,7 @@ elf_gnu_ifunc_resolver_return_stop (struct breakpoint *b)
 
   value = allocate_value (value_type);
   gdbarch_return_value (gdbarch, func_func, value_type, regcache,
-                       value_contents_raw (value), NULL);
+                       value, value_contents_raw (value), NULL);
   resolved_address = value_as_address (value);
   resolved_pc = gdbarch_convert_from_func_ptr_addr (gdbarch,
                                                    resolved_address,
index fd76e522ba50fd8c3d7ca11d1cbe2a7b2a65bac8..7605b7921a0ebca8c251e9a0f530b6cf4e02c702 100644 (file)
@@ -1343,6 +1343,7 @@ frv_store_return_value (struct type *type, struct regcache *regcache,
 static enum return_value_convention
 frv_return_value (struct gdbarch *gdbarch, struct value *function,
                  struct type *valtype, struct regcache *regcache,
+                 struct value *value,
                  gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   int struct_return = valtype->code () == TYPE_CODE_STRUCT
index 57c1bbba0c4d7c3519846e02abff07d69172f78e..35c447edef4a3459643c21dbc9392f073e320599 100644 (file)
@@ -416,6 +416,7 @@ ft32_extract_return_value (struct type *type, struct regcache *regcache,
 static enum return_value_convention
 ft32_return_value (struct gdbarch *gdbarch, struct value *function,
                   struct type *valtype, struct regcache *regcache,
+                  struct value *value,
                   gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   if (TYPE_LENGTH (valtype) > 8)
index b79a1bcd492e7a9ec33f2a31c347217c8631a4c2..51db02361f6fe1f874d9dc7510eeda00cdd0d10d 100644 (file)
@@ -2782,13 +2782,13 @@ gdbarch_return_value_p (struct gdbarch *gdbarch)
 }
 
 enum return_value_convention
-gdbarch_return_value (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
+gdbarch_return_value (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, struct value *value, gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   gdb_assert (gdbarch != NULL);
   gdb_assert (gdbarch->return_value != NULL);
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_return_value called\n");
-  return gdbarch->return_value (gdbarch, function, valtype, regcache, readbuf, writebuf);
+  return gdbarch->return_value (gdbarch, function, valtype, regcache, value, readbuf, writebuf);
 }
 
 void
index a1d9895c967ae4f538447e2171c263ab853b8c7b..ec32bf50f01a1ef78f37bdf5b176a2b336ec75fa 100644 (file)
@@ -532,8 +532,8 @@ extern void set_gdbarch_integer_to_address (struct gdbarch *gdbarch, gdbarch_int
 
 extern int gdbarch_return_value_p (struct gdbarch *gdbarch);
 
-typedef enum return_value_convention (gdbarch_return_value_ftype) (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf);
-extern enum return_value_convention gdbarch_return_value (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf);
+typedef enum return_value_convention (gdbarch_return_value_ftype) (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, struct value *value, gdb_byte *readbuf, const gdb_byte *writebuf);
+extern enum return_value_convention gdbarch_return_value (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, struct value *value, gdb_byte *readbuf, const gdb_byte *writebuf);
 extern void set_gdbarch_return_value (struct gdbarch *gdbarch, gdbarch_return_value_ftype *return_value);
 
 /* Return true if the return value of function is stored in the first hidden
index 9aabc1eda42fc939a4c36b2c4ba38c43d8a2efa4..09881fb5aad7f321abcf7e5410df2fa4f0cafa34 100755 (executable)
@@ -512,7 +512,7 @@ M;CORE_ADDR;integer_to_address;struct type *type, const gdb_byte *buf;type, buf
 # stored into the appropriate register.  This can be used when we want
 # to force the value returned by a function (see the "return" command
 # for instance).
-M;enum return_value_convention;return_value;struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf;function, valtype, regcache, readbuf, writebuf
+M;enum return_value_convention;return_value;struct value *function, struct type *valtype, struct regcache *regcache, struct value *value, gdb_byte *readbuf, const gdb_byte *writebuf;function, valtype, regcache, value, readbuf, writebuf
 
 # Return true if the return value of function is stored in the first hidden
 # parameter.  In theory, this feature should be language-dependent, specified
index b8d90fb75c2f55a6aaf81abb69a79460171754a9..06f42a101d5a707ebd3ba008117be7d49bb54de5 100644 (file)
@@ -5120,6 +5120,10 @@ recursive_dump_type (struct type *type, int spaces)
     {
       puts_filtered (" TYPE_ENDIANITY_NOT_DEFAULT");
     }
+  if (type->contains_capability ())
+    {
+      puts_filtered (" TYPE_CONTAINS_CAPABILITY");
+    }
   if (type->is_stub ())
     {
       puts_filtered (" TYPE_STUB");
@@ -5727,6 +5731,11 @@ append_composite_type_field_raw (struct type *t, const char *name,
   memset (f, 0, sizeof f[0]);
   f[0].set_type (field);
   FIELD_NAME (f[0]) = name;
+
+  if (field->contains_capability ()
+      || field->code () == TYPE_CODE_CAPABILITY)
+    t->set_contains_capability (true);
+
   return f;
 }
 
index 36e44d0b398a298fc5cc16f7284fc537d5ffbcdd..165011c10b6c8d8b732d267f0f88f24d7e87d042 100644 (file)
@@ -820,6 +820,7 @@ struct main_type
   unsigned int m_flag_fixed_instance : 1;
   unsigned int flag_objfile_owned : 1;
   unsigned int m_flag_endianity_not_default : 1;
+  unsigned int m_flag_contains_capability : 1;
 
   /* * True if this type was declared with "class" rather than
      "struct".  */
@@ -1196,6 +1197,18 @@ struct type
     this->main_type->m_flag_endianity_not_default = endianity_is_not_default;
   }
 
+  /* Indicates whether this type contains a capability.  */
+
+  bool contains_capability () const
+  {
+    return this->main_type->m_flag_contains_capability;
+  }
+
+  void set_contains_capability (bool contains_capability)
+  {
+    this->main_type->m_flag_contains_capability = contains_capability;
+  }
+
   /* * Return the dynamic property of the requested KIND from this type's
      list of dynamic properties.  */
   dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const;
index b569a23f2631cfb1f69d16e639734070b2b24cca..63a0c04fe189b2c56c7c0a7958f568fd1566309f 100644 (file)
@@ -878,6 +878,7 @@ h8300h_store_return_value (struct type *type, struct regcache *regcache,
 static enum return_value_convention
 h8300_return_value (struct gdbarch *gdbarch, struct value *function,
                    struct type *type, struct regcache *regcache,
+                   struct value *value,
                    gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   if (h8300_use_struct_convention (type))
@@ -892,6 +893,7 @@ h8300_return_value (struct gdbarch *gdbarch, struct value *function,
 static enum return_value_convention
 h8300h_return_value (struct gdbarch *gdbarch, struct value *function,
                     struct type *type, struct regcache *regcache,
+                    struct value *value,
                     gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   if (h8300h_use_struct_convention (type))
index b063cf1b575687c48f7297bb91bce522699af765..d71ff52c5a05ecb329108dd69ed724c78a9bfd33 100644 (file)
@@ -1137,6 +1137,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 static enum return_value_convention
 hppa32_return_value (struct gdbarch *gdbarch, struct value *function,
                     struct type *type, struct regcache *regcache,
+                    struct value *value,
                     gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   if (TYPE_LENGTH (type) <= 2 * 4)
@@ -1175,6 +1176,7 @@ hppa32_return_value (struct gdbarch *gdbarch, struct value *function,
 static enum return_value_convention
 hppa64_return_value (struct gdbarch *gdbarch, struct value *function,
                     struct type *type, struct regcache *regcache,
+                    struct value *value,
                     gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   int len = TYPE_LENGTH (type);
index b485f0b296a9488a66a5965d6e17686c103944c2..6526c4e8c5dd75fad94e2192f3bd1b397b361cd6 100644 (file)
@@ -2992,6 +2992,7 @@ i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
 static enum return_value_convention
 i386_return_value (struct gdbarch *gdbarch, struct value *function,
                   struct type *type, struct regcache *regcache,
+                  struct value *value,
                   gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   enum type_code code = type->code ();
index 7a1d6ebca999eb83a78a6f70c41f9caff3d64d63..8f468c2deb4a8a7c36dac63a8955a1a52102d07b 100644 (file)
@@ -3295,6 +3295,7 @@ ia64_store_return_value (struct type *type, struct regcache *regcache,
 static enum return_value_convention
 ia64_return_value (struct gdbarch *gdbarch, struct value *function,
                   struct type *valtype, struct regcache *regcache,
+                  struct value *value,
                   gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   int struct_return = ia64_use_struct_convention (valtype);
index 399b1724ea22ddd23b1ccabc51dd58870dbea5c8..b886b64bbf10d03af97b7c9fc1c92d48990b192a 100644 (file)
@@ -460,7 +460,7 @@ get_call_return_value (struct call_return_meta_info *ri)
     {
       retval = allocate_value (ri->value_type);
       gdbarch_return_value (ri->gdbarch, ri->function, ri->value_type,
-                           get_current_regcache (),
+                           get_current_regcache (), retval,
                            value_contents_raw (retval), NULL);
       if (stack_temporaries && class_or_union_p (ri->value_type))
        {
index 498089fdb529cfa3286fef894816c985cdab0ae2..a507c298a7b059a2e833194bc03a59c601e00c0f 100644 (file)
@@ -1452,14 +1452,14 @@ get_return_value (struct value *function, struct type *value_type)
      calls are made async, this will likely be made the norm.  */
 
   switch (gdbarch_return_value (gdbarch, function, value_type,
-                               NULL, NULL, NULL))
+                               NULL, NULL, NULL, NULL))
     {
     case RETURN_VALUE_REGISTER_CONVENTION:
     case RETURN_VALUE_ABI_RETURNS_ADDRESS:
     case RETURN_VALUE_ABI_PRESERVES_ADDRESS:
       value = allocate_value (value_type);
       gdbarch_return_value (gdbarch, function, value_type, stop_regs,
-                           value_contents_raw (value), NULL);
+                           value, value_contents_raw (value), NULL);
       break;
     case RETURN_VALUE_STRUCT_CONVENTION:
       value = NULL;
index 73f8ae746f7861cadd0ffa9989fe2fe1c78ca65e..7c94804977ca1cfbb72a39df55da4873c7fd471c 100644 (file)
@@ -366,6 +366,7 @@ lm32_store_return_value (struct type *type, struct regcache *regcache,
 static enum return_value_convention
 lm32_return_value (struct gdbarch *gdbarch, struct value *function,
                   struct type *valtype, struct regcache *regcache,
+                  struct value *value,
                   gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   enum type_code code = valtype->code ();
index d579616b06aa4a14b99362e78e50aa962fa09167..e2cb326d8dc841c6e113189e8d8bad7ad8c9d143 100644 (file)
@@ -2164,6 +2164,7 @@ m32c_return_value (struct gdbarch *gdbarch,
                   struct value *function,
                   struct type *valtype,
                   struct regcache *regcache,
+                  struct value *value,
                   gdb_byte *readbuf,
                   const gdb_byte *writebuf)
 {
index e8bf33dda173810a34dc1b8c8ac25a6f637cc36e..95363bcdc3487b0b54a8b1bc452cc4a9e18ba124 100644 (file)
@@ -777,6 +777,7 @@ m32r_extract_return_value (struct type *type, struct regcache *regcache,
 static enum return_value_convention
 m32r_return_value (struct gdbarch *gdbarch, struct value *function,
                   struct type *valtype, struct regcache *regcache,
+                  struct value *value,
                   gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   if (TYPE_LENGTH (valtype) > 8)
index 84d475b5f7a46df7a4e9484aa53a8c6bb3438a20..f25213a1004533f967f549e485af5365b2f2a008 100644 (file)
@@ -1288,6 +1288,7 @@ m68hc11_extract_return_value (struct type *type, struct regcache *regcache,
 static enum return_value_convention
 m68hc11_return_value (struct gdbarch *gdbarch, struct value *function,
                      struct type *valtype, struct regcache *regcache,
+                     struct value *value,
                      gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   if (valtype->code () == TYPE_CODE_STRUCT
index 193916d38145037c8a92f94bec8f84aa2ef2f8a9..bb90c8ee4e93f80e23583aa4a4808219e2830ad1 100644 (file)
@@ -424,6 +424,7 @@ m68k_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
 static enum return_value_convention
 m68k_return_value (struct gdbarch *gdbarch, struct value *function,
                   struct type *type, struct regcache *regcache,
+                  struct value *value,
                   gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   enum type_code code = type->code ();
@@ -460,6 +461,7 @@ m68k_return_value (struct gdbarch *gdbarch, struct value *function,
 static enum return_value_convention
 m68k_svr4_return_value (struct gdbarch *gdbarch, struct value *function,
                        struct type *type, struct regcache *regcache,
+                       struct value *value,
                        gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   enum type_code code = type->code ();
index 0efcf8598f94eba7537841077163743ec7849979..f9ab6f4371be2438ec0174dac014cc5edee23b52 100644 (file)
@@ -2138,6 +2138,7 @@ Try using the 'return' command with no argument."));
 static enum return_value_convention
 mep_return_value (struct gdbarch *gdbarch, struct value *function,
                  struct type *type, struct regcache *regcache,
+                 struct value *value,
                  gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   if (mep_use_struct_convention (type))
index b5da32e61b5d30e981f00a5ebc696aca096fbd07..3630b07ecf1dab1c6c42e285225ad871925f4573 100644 (file)
@@ -586,6 +586,7 @@ microblaze_store_return_value (struct type *type, struct regcache *regcache,
 static enum return_value_convention
 microblaze_return_value (struct gdbarch *gdbarch, struct value *function,
                         struct type *type, struct regcache *regcache,
+                        struct value *value,
                         gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   if (readbuf)
index 317c7d092f1a9abbab9f784297658ce36c39310c..f27704df9b0a2f89c8720eca46f25ded143933ea 100644 (file)
@@ -4770,6 +4770,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 static enum return_value_convention
 mips_eabi_return_value (struct gdbarch *gdbarch, struct value *function,
                        struct type *type, struct regcache *regcache,
+                       struct value *value,
                        gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
@@ -5161,6 +5162,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 static enum return_value_convention
 mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
                          struct type *type, struct regcache *regcache,
+                         struct value *value,
                          gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
@@ -5655,6 +5657,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 static enum return_value_convention
 mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
                       struct type *type, struct regcache *regcache,
+                      struct value *value,
                       gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   CORE_ADDR func_addr = function ? find_function_addr (function, NULL) : 0;
@@ -6102,6 +6105,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 static enum return_value_convention
 mips_o64_return_value (struct gdbarch *gdbarch, struct value *function,
                       struct type *type, struct regcache *regcache,
+                      struct value *value,
                       gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   CORE_ADDR func_addr = function ? find_function_addr (function, NULL) : 0;
index 5d960347d21c9a41fdc810fdab5a320ab689ec65..8b9138f0b726f5f662e3a265b3d07232de7a9980 100644 (file)
@@ -236,6 +236,7 @@ mn10300_extract_return_value (struct gdbarch *gdbarch, struct type *type,
 static enum return_value_convention
 mn10300_return_value (struct gdbarch *gdbarch, struct value *function,
                      struct type *type, struct regcache *regcache,
+                     struct value *value,
                      gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   if (mn10300_use_struct_convention (type))
index e5d3c52190ba4a2e0d82084817e55f3f6a5739a2..28cbf13d8811614a163bf1247ef6e290b7ea633f 100644 (file)
@@ -478,6 +478,7 @@ moxie_extract_return_value (struct type *type, struct regcache *regcache,
 static enum return_value_convention
 moxie_return_value (struct gdbarch *gdbarch, struct value *function,
                   struct type *valtype, struct regcache *regcache,
+                  struct value *value,
                   gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   if (TYPE_LENGTH (valtype) > 8)
index 9119b5f2429725f60bfb5136c1bdd661da7157de..6e7acedba8370d155a5f00f06b499db31d232acb 100644 (file)
@@ -563,6 +563,7 @@ msp430_return_value (struct gdbarch *gdbarch,
                     struct value *function,
                     struct type *valtype,
                     struct regcache *regcache,
+                    struct value *value,
                     gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
index afc7c6124209688f167e70746c2240db6383a0b1..26a539b8aa151faaa35a1b9f527bfeb551b178c3 100644 (file)
@@ -1813,6 +1813,7 @@ nds32_store_return_value (struct gdbarch *gdbarch, struct type *type,
 static enum return_value_convention
 nds32_return_value (struct gdbarch *gdbarch, struct value *func_type,
                    struct type *type, struct regcache *regcache,
+                   struct value *value,
                    gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   if (TYPE_LENGTH (type) > 8)
index 09eb6fcb5dd6b261f861d4dd5fe7378824b344d1..b5c15fdb22e5fa4e6442807634f143c6b9a8a33e 100644 (file)
@@ -1784,6 +1784,7 @@ nios2_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
 static enum return_value_convention
 nios2_return_value (struct gdbarch *gdbarch, struct value *function,
                    struct type *type, struct regcache *regcache,
+                   struct value *value,
                    gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   if (TYPE_LENGTH (type) > 8)
index 7b16cdbba263257af6c92f04432245fa43e69f09..283e9fa92b1ea16a5f73d0de335353c53319e424 100644 (file)
@@ -242,6 +242,7 @@ or1k_analyse_l_sw (uint32_t inst, int *simm_ptr, unsigned int *ra_ptr,
 static enum return_value_convention
 or1k_return_value (struct gdbarch *gdbarch, struct value *functype,
                   struct type *valtype, struct regcache *regcache,
+                  struct value *value,
                   gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
index 349396f52b2c66538555a99af948d0c5bf761ff0..e00a2d8c70e7df2bb568640059749a36c714ded9 100644 (file)
@@ -274,6 +274,7 @@ static const struct frame_unwind ppcfbsd_sigtramp_frame_unwind = {
 static enum return_value_convention
 ppcfbsd_return_value (struct gdbarch *gdbarch, struct value *function,
                      struct type *valtype, struct regcache *regcache,
+                     struct value *value,
                      gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   return ppc_sysv_abi_broken_return_value (gdbarch, function, valtype,
index 91b206681250bc1d7ee5552a386c508f6c01205a..7a1fd4b095278a73eb257ddbcb902d9e9c34cca2 100644 (file)
@@ -248,6 +248,7 @@ ppc_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
 static enum return_value_convention
 ppc_linux_return_value (struct gdbarch *gdbarch, struct value *function,
                        struct type *valtype, struct regcache *regcache,
+                       struct value *value,
                        gdb_byte *readbuf, const gdb_byte *writebuf)
 {  
   if ((valtype->code () == TYPE_CODE_STRUCT
index 64f2b402cad2dbee24446fb1023c4d9005ad5aa1..66bacf33b427fbc8e71507a672967a6041eec1dc 100644 (file)
@@ -72,6 +72,7 @@ ppcnbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
 static enum return_value_convention
 ppcnbsd_return_value (struct gdbarch *gdbarch, struct value *function,
                      struct type *valtype, struct regcache *regcache,
+                     struct value *value,
                      gdb_byte *readbuf, const gdb_byte *writebuf)
 {
 #if 0
index 08c65cff2ffd7b4ba697b24e9196b48f658d14e2..d1778c0eb99c6b90f1531963d8c6703b39e724b8 100644 (file)
@@ -1003,6 +1003,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
 enum return_value_convention
 ppc_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
                           struct type *valtype, struct regcache *regcache,
+                          struct value *value,
                           gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   return do_ppc_sysv_return_value (gdbarch,
@@ -1015,6 +1016,7 @@ ppc_sysv_abi_broken_return_value (struct gdbarch *gdbarch,
                                  struct value *function,
                                  struct type *valtype,
                                  struct regcache *regcache,
+                                 struct value *value,
                                  gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   return do_ppc_sysv_return_value (gdbarch,
@@ -1903,6 +1905,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype,
 enum return_value_convention
 ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
                             struct type *valtype, struct regcache *regcache,
+                            struct value *value,
                             gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
index 2c4eeab720be469d08634527911e3c81161d3162..eb8a63d4e09b47d835039a56a92bbf65e1bdc9f7 100644 (file)
@@ -2748,6 +2748,7 @@ riscv_return_value (struct gdbarch  *gdbarch,
                    struct value *function,
                    struct type *type,
                    struct regcache *regcache,
+                   struct value *value,
                    gdb_byte *readbuf,
                    const gdb_byte *writebuf)
 {
index ba54454c74277503a92f4cebcf347e012f186c93..95dce4900911a20865e4c8004385741489df803f 100644 (file)
@@ -1242,6 +1242,7 @@ rl78_return_value (struct gdbarch *gdbarch,
                   struct value *function,
                   struct type *valtype,
                   struct regcache *regcache,
+                  struct value *value,
                   gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
index 730dd98f67cc128a8a4bdeb6dd12672f47afcac0..bc5a9a111c6768c014e0f2997279048ba63f3e50 100644 (file)
@@ -515,6 +515,7 @@ ran_out_of_registers_for_arguments:
 static enum return_value_convention
 rs6000_return_value (struct gdbarch *gdbarch, struct value *function,
                     struct type *valtype, struct regcache *regcache,
+                    struct value *value,
                     gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
index 54a1bdcb9526ec0e8bed0dc362379beda4f4a87e..532098d94c1b10b2a61a3d2186636a9c4844891f 100644 (file)
@@ -262,6 +262,7 @@ ran_out_of_registers_for_arguments:
 static enum return_value_convention
 rs6000_lynx178_return_value (struct gdbarch *gdbarch, struct value *function,
                             struct type *valtype, struct regcache *regcache,
+                            struct value *value,
                             gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
index 46963272f9c842757ed9c213ce3ca7f9f3c66742..f4c12aa1190561ccfa6aaea18595d26e6dd4c647 100644 (file)
@@ -868,6 +868,7 @@ rx_return_value (struct gdbarch *gdbarch,
                 struct value *function,
                 struct type *valtype,
                 struct regcache *regcache,
+                struct value *value,
                 gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
index 607652c61a32ade9c3c4591481b91cfda49a04da..1d9385206525698875a3a398875bb7b750e95896 100644 (file)
@@ -612,6 +612,7 @@ s12z_extract_return_value (struct type *type, struct regcache *regcache,
 static enum return_value_convention
 s12z_return_value (struct gdbarch *gdbarch, struct value *function,
                    struct type *type, struct regcache *regcache,
+                  struct value *value,
                    gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   if (type->code () == TYPE_CODE_STRUCT
index 4d3644e5a7608f9c238750fb6470a3e8049e35ad..67f9bce9d3d886de8615ac50a4ca5c1069d1b84f 100644 (file)
@@ -2079,6 +2079,7 @@ s390_register_return_value (struct gdbarch *gdbarch, struct type *type,
 static enum return_value_convention
 s390_return_value (struct gdbarch *gdbarch, struct value *function,
                   struct type *type, struct regcache *regcache,
+                  struct value *value,
                   gdb_byte *out, const gdb_byte *in)
 {
   enum return_value_convention rvc;
index 72cba90a27ca986e59d7fdcd78a79ef12e0d66d6..e297e5b7fc1299c045ab4f39fbeded103ad3b1f8 100644 (file)
@@ -440,6 +440,7 @@ score_xfer_register (struct regcache *regcache, int regnum, int length,
 static enum return_value_convention
 score_return_value (struct gdbarch *gdbarch, struct value *function,
                     struct type *type, struct regcache *regcache,
+                   struct value *value,
                     gdb_byte * readbuf, const gdb_byte * writebuf)
 {
   if (type->code () == TYPE_CODE_STRUCT
index 2c3342156f41dbb11f2a1ff4a7c0723ddcae19b1..23cd85cab2ebef6006ca3be00b4d0c9d6c523f3e 100644 (file)
@@ -1419,6 +1419,7 @@ sh_return_value_nofpu (struct gdbarch *gdbarch, struct value *function,
 static enum return_value_convention
 sh_return_value_fpu (struct gdbarch *gdbarch, struct value *function,
                     struct type *type, struct regcache *regcache,
+                    struct value *value,
                     gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   struct type *func_type = function ? value_type (function) : NULL;
index 8417a47855fa6c05d2b9ba3af6562c7a885d84d7..65192bbce78e80c528f5f6b77380768f10f1d76a 100644 (file)
@@ -1505,6 +1505,7 @@ sparc32_store_return_value (struct type *type, struct regcache *regcache,
 static enum return_value_convention
 sparc32_return_value (struct gdbarch *gdbarch, struct value *function,
                      struct type *type, struct regcache *regcache,
+                     struct value *value,
                      gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
index a6e46570437c369c33a75f54e6da072922363100..70824a0ad4321cea7e3ef041542ba0bc7d8d05b9 100644 (file)
@@ -1750,6 +1750,7 @@ sparc64_store_return_value (struct type *type, struct regcache *regcache,
 static enum return_value_convention
 sparc64_return_value (struct gdbarch *gdbarch, struct value *function,
                      struct type *type, struct regcache *regcache,
+                     struct value *value,
                      gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   if (TYPE_LENGTH (type) > 32)
index 4ba5500b31c9e0735e57611816536c9cc76e6f74..aa41d95eaca7470625d3e480ab9816337a45ba19 100644 (file)
@@ -2845,7 +2845,8 @@ return_command (const char *retval_exp, int from_tty)
       gdb_assert (rv_conv != RETURN_VALUE_STRUCT_CONVENTION
                  && rv_conv != RETURN_VALUE_ABI_RETURNS_ADDRESS);
       gdbarch_return_value (cache_arch, function, return_type,
-                           get_current_regcache (), NULL /*read*/,
+                           get_current_regcache (), return_value,
+                           NULL /*read*/,
                            value_contents (return_value) /*write*/);
     }
 
index 17e6e658cf39168a248fd83f770199b5683d2bd2..005e1807d4ef7e90a004b7ac9164a8c3a21586fe 100644 (file)
@@ -774,6 +774,7 @@ tic6x_store_return_value (struct type *valtype, struct regcache *regcache,
 static enum return_value_convention
 tic6x_return_value (struct gdbarch *gdbarch, struct value *function,
                    struct type *type, struct regcache *regcache,
+                   struct value *value,
                    gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   /* In C++, when function returns an object, even its size is small
index 4e46d098c735e3d4a6fa9fd82caac47ac6dd46ac..cd522b02ce4964a5b561c0c850182cce3afe53a7 100644 (file)
@@ -253,6 +253,7 @@ tilegx_store_return_value (struct type *type, struct regcache *regcache,
 static enum return_value_convention
 tilegx_return_value (struct gdbarch *gdbarch, struct value *function,
                     struct type *type, struct regcache *regcache,
+                    struct value *value,
                     gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   if (tilegx_use_struct_convention (type))
index cba662c862d94b4afc316fd08a82b8de182419ac..5b86a74691c977f2b69c1508fc20735fcb6f881a 100644 (file)
@@ -1157,6 +1157,7 @@ v850_store_return_value (struct type *type, struct regcache *regcache,
 static enum return_value_convention
 v850_return_value (struct gdbarch *gdbarch, struct value *function,
                   struct type *type, struct regcache *regcache,
+                  struct value *value,
                   gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   if (v850_use_struct_convention (gdbarch, type))
index 8c0a72c40aef3cb90115652bbb803360c14c3eea..b5bbbab3d3907744d5a17db2127ba2c31681a3f1 100644 (file)
@@ -506,6 +506,7 @@ generic_value_print_capability (struct value *val, struct ui_file *stream,
 
   switch (VALUE_LVAL (val))
     {
+      case not_lval:
       case lval_register:
        if (value_tagged (val))
          tag = value_tag (val);
index bea273ab7d11e65dcfaf142b531b0972996c6572..fde31dbe70f067ce9a3ba6da8893fad11a9f98cc 100644 (file)
@@ -3782,7 +3782,7 @@ struct_return_convention (struct gdbarch *gdbarch,
 
   /* Probe the architecture for the return-value convention.  */
   return gdbarch_return_value (gdbarch, function, value_type,
-                              NULL, NULL, NULL);
+                              NULL, NULL, NULL, NULL);
 }
 
 /* Return true if the function returning the specified type is using
index 1e60fba5101d952251207e4a57f09043d17a82a8..e0b09eaa17a29af332115e2d1788ce7902e66e86 100644 (file)
@@ -201,6 +201,7 @@ vax_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 static enum return_value_convention
 vax_return_value (struct gdbarch *gdbarch, struct value *function,
                  struct type *type, struct regcache *regcache,
+                 struct value *value,
                  gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   int len = TYPE_LENGTH (type);
index 9818d97d44a768fa9c33e6d0f8971cc6588e1b63..957eeff4f6a5dfde42f172baae7dc42a21b3a9e3 100644 (file)
@@ -196,6 +196,7 @@ xstormy16_store_return_value (struct type *type, struct regcache *regcache,
 static enum return_value_convention
 xstormy16_return_value (struct gdbarch *gdbarch, struct value *function,
                        struct type *type, struct regcache *regcache,
+                       struct value *value,
                        gdb_byte *readbuf, const gdb_byte *writebuf)
 {
   if (xstormy16_use_struct_convention (type))
index 97486dea602231b3fbd90529c36c600633122e2b..214db8c83dfb697b4d4e7d9cd2c524501a422399 100644 (file)
@@ -1646,6 +1646,7 @@ xtensa_return_value (struct gdbarch *gdbarch,
                     struct value *function,
                     struct type *valtype,
                     struct regcache *regcache,
+                    struct value *value,
                     gdb_byte *readbuf,
                     const gdb_byte *writebuf)
 {