From: Luis Machado Date: Thu, 28 Jul 2022 02:52:26 +0000 (+0100) Subject: [Morello GDB] Fix a couple hardware watchpoint issues around capabilities X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=022cd04c691472786eb5924e13f3c30210e19485;p=thirdparty%2Fbinutils-gdb.git [Morello GDB] Fix a couple hardware watchpoint issues around capabilities This patch fixes a couple issues around hardware watchpoint triggers related to capabilities. 1 - When a capability changes and the hardware watchpoint triggers, Morello GDB should display the tag state for new/old values correctly. 2 - Take the capability tag into consideration when checking for content changes to the watched area. The 128 bits may be the same, but the tag state may differ. --- diff --git a/gdb/valarith.c b/gdb/valarith.c index 36d30f161f6..6e31b5fb0b2 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -1713,7 +1713,10 @@ value_equal_contents (struct value *arg1, struct value *arg2) && TYPE_LENGTH (type1) == TYPE_LENGTH (type2) && memcmp (value_contents (arg1).data (), value_contents (arg2).data (), - TYPE_LENGTH (type1)) == 0); + TYPE_LENGTH (type1)) == 0 + && ((!value_tagged (arg1) && !value_tagged (arg2)) + || (value_tagged (arg1) && value_tagged (arg2) + && value_tag (arg1) == value_tag (arg2)))); } /* Simulate the C operator < by returning 1 diff --git a/gdb/valprint.c b/gdb/valprint.c index 65f446cda29..6a33e011e59 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -529,8 +529,14 @@ generic_value_print_capability (struct value *val, struct ui_file *stream, break; case lval_memory: { - struct gdbarch *gdbarch = type->arch (); - tag = gdbarch_get_cap_tag_from_address (gdbarch, value_address (val)); + if (!value_lazy (val) && value_tagged (val)) + tag = value_tag (val); + else + { + struct gdbarch *gdbarch = type->arch (); + tag = gdbarch_get_cap_tag_from_address (gdbarch, + value_address (val)); + } } break; default: