aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2022-11-17 14:31:26 -0800
committerJohn Baldwin <jhb@FreeBSD.org>2022-11-17 14:31:26 -0800
commit3028b53283dd3f971b109c5eade6bf8f04c3fc43 (patch)
treea2c3d65b5d72c993df8b052c0f5617d90124b896
parent4695a547e1f2f7b25598a43544707a3f7651ec9d (diff)
downloadfsf-binutils-gdb-3028b53283dd3f971b109c5eade6bf8f04c3fc43.zip
fsf-binutils-gdb-3028b53283dd3f971b109c5eade6bf8f04c3fc43.tar.gz
fsf-binutils-gdb-3028b53283dd3f971b109c5eade6bf8f04c3fc43.tar.bz2
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.
-rw-r--r--gdb/gdbtypes.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index d18d7f0..858219c 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);
}