From: John Baldwin Date: Thu, 17 Nov 2022 22:31:26 +0000 (-0800) Subject: make_pointer_type: Set TYPE_INSTANCE_FLAG_CAPABILITY on cap pointers. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3028b53283dd3f971b109c5eade6bf8f04c3fc43;p=thirdparty%2Fbinutils-gdb.git make_pointer_type: Set TYPE_INSTANCE_FLAG_CAPABILITY on cap pointers. For purecap this isn't always set by DWARF attributes, and in particular it isn't for CHERI-RISC-V. --- diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index d18d7f0a0a4..858219c5953 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -377,6 +377,8 @@ make_pointer_type (struct type *type, struct type **typeptr) ntype->set_tagged (gdbarch_ptr_bit (type->arch ()) == gdbarch_capability_bit (type->arch ())); ntype->set_code (TYPE_CODE_PTR); + if (ntype->is_tagged ()) + ntype->set_instance_flags (TYPE_INSTANCE_FLAG_CAPABILITY); /* Mark pointers as unsigned. The target converts between pointers and addresses (CORE_ADDRs) using gdbarch_pointer_to_address and @@ -389,6 +391,12 @@ make_pointer_type (struct type *type, struct type **typeptr) { TYPE_LENGTH (chain) = TYPE_LENGTH (ntype); chain->set_tagged (ntype->is_tagged ()); + if (ntype->is_tagged ()) + chain->set_instance_flags (chain->instance_flags () + | TYPE_INSTANCE_FLAG_CAPABILITY); + else + chain->set_instance_flags (chain->instance_flags () + & ~TYPE_INSTANCE_FLAG_CAPABILITY); chain = TYPE_CHAIN (chain); }