public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Luis Machado <luis.machado@arm.com>
To: Gustavo Romero <gustavo.romero@linaro.org>, gdb-patches@sourceware.org
Cc: thiago.bauermann@linaro.org, eliz@gnu.org, tom@tromey.com
Subject: Re: [PATCH v4 2/8] gdb: aarch64: Move MTE address check out of set_memtag
Date: Tue, 16 Apr 2024 17:30:59 +0100	[thread overview]
Message-ID: <79ba204e-edca-49f6-895e-76b6806197ba@arm.com> (raw)
In-Reply-To: <20240416140728.198163-3-gustavo.romero@linaro.org>

On 4/16/24 15:07, Gustavo Romero wrote:
> Remove check in parse_set_allocation_tag_input as it is redundant:
> currently the check happens at the end of parse_set_allocation_tag_input
> and also in set_memtag (called after parse_set_allocation_tag_input).
> 
> After it, 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
> on MTE address checks.
> 
> Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
> ---
>  gdb/aarch64-linux-tdep.c |  4 ----
>  gdb/printcmd.c           | 10 +++++-----
>  2 files changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
> index 50055ac3f48..8e6e63d4dcb 100644
> --- a/gdb/aarch64-linux-tdep.c
> +++ b/gdb/aarch64-linux-tdep.c
> @@ -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:
>  
> diff --git a/gdb/printcmd.c b/gdb/printcmd.c
> index cb0d32aa4bc..5635f605314 100644
> --- a/gdb/printcmd.c
> +++ b/gdb/printcmd.c
> @@ -3101,11 +3101,6 @@ parse_set_allocation_tag_input (const char *args, struct value **val,
>      error (_("Error parsing tags argument. Tags should be 2 digits per byte."));
>  
>    tags = hex2bin (tags_string.c_str ());
> -
> -  /* If the address is not in a region memory mapped with a memory tagging
> -     flag, it is no use trying to access/manipulate its allocation tag.  */
> -  if (!gdbarch_tagged_address_p (current_inferior ()->arch (), *val))
> -    show_addr_not_tagged (value_as_address (*val));
>  }
>  
>  /* Implement the "memory-tag set-allocation-tag" command.
> @@ -3127,6 +3122,11 @@ 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"));

Thanks.

Approved-By: Luis Machado <luis.machado@arm.com>

  reply	other threads:[~2024-04-16 16:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-16 14:07 [PATCH v4 0/8] Add another way to check tagged addresses on remote targets Gustavo Romero
2024-04-16 14:07 ` [PATCH v4 1/8] gdb: aarch64: Remove MTE address checking from get_memtag Gustavo Romero
2024-04-16 14:07 ` [PATCH v4 2/8] gdb: aarch64: Move MTE address check out of set_memtag Gustavo Romero
2024-04-16 16:30   ` Luis Machado [this message]
2024-04-16 14:07 ` [PATCH v4 3/8] gdb: aarch64: Remove MTE address checking from memtag_matches_p Gustavo Romero
2024-04-16 14:07 ` [PATCH v4 4/8] gdb: Use passed gdbarch instead of calling current_inferior Gustavo Romero
2024-04-16 14:07 ` [PATCH v4 5/8] gdb: Introduce is_address_tagged target hook Gustavo Romero
2024-04-17  9:22   ` Luis Machado
2024-04-16 14:07 ` [PATCH v4 6/8] gdb: Add qIsAddressTagged packet Gustavo Romero
2024-04-16 18:04   ` Luis Machado
2024-04-17 20:57     ` Gustavo Romero
2024-04-16 14:07 ` [PATCH v4 7/8] gdb/testsuite: Add unittest for " Gustavo Romero
2024-04-17  9:38   ` Luis Machado
2024-04-17 19:03     ` Gustavo Romero
2024-04-17 19:11       ` Gustavo Romero
2024-04-16 14:07 ` [PATCH v4 8/8] gdb: Document " Gustavo Romero
2024-04-16 14:34   ` Eli Zaretskii
2024-04-16 23:10     ` Gustavo Romero
2024-04-17 12:09       ` Eli Zaretskii
2024-04-17 18:21         ` Gustavo Romero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=79ba204e-edca-49f6-895e-76b6806197ba@arm.com \
    --to=luis.machado@arm.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=gustavo.romero@linaro.org \
    --cc=thiago.bauermann@linaro.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).