]> 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)
committerLuis Machado <luis.machado@linaro.org>
Fri, 14 Jan 2022 14:30:25 +0000 (11:30 -0300)
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 5371cb75e687ddf2cb490b1f40e3a129df736ad7..587ccf5dbc3ba580e0d1d62eef337529ed79f8e6 100644 (file)
@@ -2086,7 +2086,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);