]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Preserve tag when passing pointers/capabilities as parameters
authorLuis Machado <luis.machado@linaro.org>
Thu, 30 Dec 2021 13:45:11 +0000 (10:45 -0300)
committerJohn Baldwin <jhb@FreeBSD.org>
Thu, 1 Sep 2022 22:59:24 +0000 (15:59 -0700)
Fix a bug where Morello GDB wasn't setting the capability tag when calling a
function by hand, and said function received a pointer/capability as
parameter.

This was observed when attempting to call strlen by hand and passing the
argv[] entries.

gdb/aarch64-tdep.c

index 83b2c59e35d8e39b973346ef19811f66fdd56e26..125145b410279a050f0c1e13ac31ec61c9b13517 100644 (file)
@@ -2127,7 +2127,8 @@ pass_in_c (struct gdbarch *gdbarch, struct regcache *regcache,
       /* Write the argument to the capability register.  */
       regcache->raw_write (regnum, tmpbuf);
 
-      if (type->contains_capability ())
+      if (type->contains_capability () || type->code () == TYPE_CODE_CAPABILITY
+         || TYPE_CAPABILITY (type))
        {
          /* We need to read the tags from memory.  */
          gdb::byte_vector cap = target_read_capability (address);