From: Luis Machado Date: Thu, 30 Dec 2021 13:45:11 +0000 (-0300) Subject: Preserve tag when passing pointers/capabilities as parameters X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2cf167f926836d7e40931e064ed4441208b7b38f;p=thirdparty%2Fbinutils-gdb.git Preserve tag when passing pointers/capabilities as parameters 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. --- diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 5371cb75e68..587ccf5dbc3 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -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);