]> 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)
committerLuis Machado <luis.machado@linaro.org>
Tue, 8 Dec 2020 18:02:58 +0000 (15:02 -0300)
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/ChangeLog
gdb/aarch64-tdep.c
gdb/gdbtypes.h
gdb/printcmd.c

index b596c7571d36b29e555b1104c3382a78d12389ed..9bb826821fab4c3fb90dc4a951324bb848d24061 100644 (file)
@@ -1,3 +1,15 @@
+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.
+
 2020-11-11  Luis Machado  <luis.machado@arm.com>
 
        * aarch64-linux-nat.c (fetch_cregs_from_thread): Invert pcc/csp
index c8ca8ac73685b733467dff742ef51c2847f334ea..6fab1cc2fbea702bcc15765a15ad79efd41ec1bb 100644 (file)
@@ -3767,7 +3767,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;
 }
 
@@ -3779,7 +3779,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;
@@ -3796,7 +3796,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 fb2062d8d593e9f1bccd02b85cd8f97ec57b73a8..a876cebcd1e24dd51aad14a4ab4d20e9286e44fa 100644 (file)
@@ -324,7 +324,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 f9b42cfda7140fe7a07ac286c4d7ea88f161a62e..c0e59301dbb9cb0c0a146d166d86d125425e5d60 100644 (file)
@@ -362,7 +362,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