[2/4] gdb: aarch64: Move MTE address check out of set_memtag
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Testing passed
|
Commit Message
Move MTE address check out of set_memtag and add this check to the
upper layer, before set_memtag is called. This is a preparation for
using a target hook instead of a gdbarch hook MTE address checks.
Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
---
gdb/aarch64-linux-tdep.c | 4 ----
gdb/printcmd.c | 6 ++++++
2 files changed, 6 insertions(+), 4 deletions(-)
@@ -2525,10 +2525,6 @@ aarch64_linux_set_memtags (struct gdbarch *gdbarch, struct value *address,
/* Remove the top byte. */
addr = gdbarch_remove_non_address_bits (gdbarch, addr);
- /* Make sure we are dealing with a tagged address to begin with. */
- if (!aarch64_linux_tagged_address_p (gdbarch, address))
- return false;
-
/* With G being the number of tag granules and N the number of tags
passed in, we can have the following cases:
@@ -3127,6 +3127,12 @@ memory_tag_set_allocation_tag_command (const char *args, int from_tty)
/* Parse the input. */
parse_set_allocation_tag_input (args, &val, &length, tags);
+ /* If the address is not in a region memory mapped with a memory tagging
+ flag, it is no use trying to manipulate its allocation tag. */
+ if (!gdbarch_tagged_address_p (current_inferior ()->arch (), val)) {
+ show_addr_not_tagged (value_as_address(val));
+ }
+
if (!gdbarch_set_memtags (current_inferior ()->arch (), val, length, tags,
memtag_type::allocation))
gdb_printf (_("Could not update the allocation tag(s).\n"));