From: Luis Machado Date: Fri, 30 Oct 2020 13:06:33 +0000 (-0300) Subject: Don't ignore pointer sizes when printing X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f49d244ad43e60bdfdc73646cc38703d4218769f;p=thirdparty%2Fbinutils-gdb.git Don't ignore pointer sizes when printing 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 * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b596c7571d3..9bb826821fa 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2020-11-11 Luis Machado + + * 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 * aarch64-linux-nat.c (fetch_cregs_from_thread): Invert pcc/csp diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index c8ca8ac7368..6fab1cc2fbe 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -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 diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index fb2062d8d59..a876cebcd1e 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -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) diff --git a/gdb/printcmd.c b/gdb/printcmd.c index f9b42cfda71..c0e59301dbb 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -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