]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Don't ignore pointer sizes when printing
authorLuis Machado <luis.machado@arm.com>
Fri, 30 Oct 2020 13:06:33 +0000 (10:06 -0300)
committerJohn Baldwin <jhb@FreeBSD.org>
Thu, 1 Sep 2022 22:53:22 +0000 (15:53 -0700)
When displaying a capability pointer, don't truncate the length of the type.

Also, update the instance flags to mark capability pointers as
TYPE_INSTANCE_FLAG_CAPABILITY.

gdb/ChangeLog:

2020-11-11  Luis Machado  <luis.machado@arm.com>

* aarch64-tdep.c (aarch64_address_class_type_flags)
(aarch64_address_class_type_flags_to_name)
(aarch64_address_class_name_to_type_flags): Use
TYPE_INSTANCE_FLAG_CAPABILITY instead of
TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1.
* gdbtypes.h (TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL): Include
TYPE_INSTANCE_FLAG_CAPABILITY.
* printcmd.c (print_scalar_formatted): Don't truncate capability
pointers.

gdb/aarch64-tdep.c
gdb/gdbtypes.h
gdb/printcmd.c

index fd9120460bd20727ef661f0e958cc4f055ff2c29..02c845f2d9fad67ca81c4eb6034ef37247838c6c 100644 (file)
@@ -3834,7 +3834,7 @@ aarch64_address_class_type_flags (int byte_size, int dwarf2_addr_class)
      __capability qualifier, meaning a capability for Morello.  */
 
   if (dwarf2_addr_class == 1)
-    return TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1;
+    return TYPE_INSTANCE_FLAG_CAPABILITY;
   return 0;
 }
 
@@ -3846,7 +3846,7 @@ static const char*
 aarch64_address_class_type_flags_to_name (struct gdbarch *gdbarch,
                                          type_instance_flags type_flags)
 {
-  if (type_flags & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1)
+  if (type_flags & TYPE_INSTANCE_FLAG_CAPABILITY)
     return "__capability";
   else
     return NULL;
@@ -3863,7 +3863,7 @@ aarch64_address_class_name_to_type_flags (struct gdbarch *gdbarch,
 {
   if (strcmp (name, "__capability") == 0)
     {
-      *type_flags_ptr = TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1;
+      *type_flags_ptr = TYPE_INSTANCE_FLAG_CAPABILITY;
       return true;
     }
   else
index 72d3261532d1bb266b766fba1d0ea82bc4a819e2..f7e0793684ae9aea87b83b7a65a0a6a310a431f1 100644 (file)
@@ -321,7 +321,8 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
 #define TYPE_ADDRESS_CLASS_2(t) (((t)->instance_flags ()) \
                                 & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2)
 #define TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL \
-  (TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 | TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2)
+  (TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 | TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2 \
+   | TYPE_INSTANCE_FLAG_CAPABILITY)
 #define TYPE_ADDRESS_CLASS_ALL(t) (((t)->instance_flags ()) \
                                   & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL)
 
index 30de1927d391de3ef5573f795f68aaf8c5b7efa3..6af7e181ee00c49055ad243e622775f21c65160c 100644 (file)
@@ -378,7 +378,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
   /* If the value is a pointer, and pointers and addresses are not the
      same, then at this point, the value's length (in target bytes) is
      gdbarch_addr_bit/TARGET_CHAR_BIT, not TYPE_LENGTH (type).  */
-  if (type->code () == TYPE_CODE_PTR)
+  if (type->code () == TYPE_CODE_PTR && !TYPE_CAPABILITY (type))
     len = gdbarch_addr_bit (gdbarch) / TARGET_CHAR_BIT;
 
   /* If we are printing it as unsigned, truncate it in case it is actually