From: Gustavo Romero <gustavo.romero@linaro.org>
To: gdb-patches@sourceware.org
Cc: luis.machado@arm.com, thiago.bauermann@linaro.org,
gustavo.romero@linaro.org
Subject: [PATCH v3 1/7] gdb: aarch64: Remove MTE address checking from get_memtag
Date: Thu, 4 Apr 2024 06:48:13 +0000 [thread overview]
Message-ID: <20240404064819.2848899-2-gustavo.romero@linaro.org> (raw)
In-Reply-To: <20240404064819.2848899-1-gustavo.romero@linaro.org>
This commit removes aarch64_linux_tagged_address_p from
aarch64_linux_get_memtag. aarch64_linux_tagged_address_p checks if an
address is tagged (MTE) or not.
The check is redundant because aarch64_linux_get_memtag is always called
from the upper layers (i.e. from printcmd.c via gdbarch hook
gdbarch_get_memtag) after either gdbarch_tagged_address_p (that already
points to aarch64_linux_tagged_address_p) has been called or
after should_validate_memtags (that calls gdbarch_tagged_address_p at
the end) has been called, so the address is already checked. Hence:
a) in print_command_1, aarch64_linux_get_memtag (via gdbarch_get_memtag
hook) is called but only after should_validate_memtags, which calls
gdbarch_tagged_address_p;
b) in do_examine, aarch64_linux_get_memtag is also called only after
gdbarch_tagged_address_p is directly called;
c) in memory_tag_check_command, gdbarch_get_memtag is called -- tags
matching or not -- after the initial check via direct call to
gdbarch_tagged_address_p;
d) in memory_tag_print_tag_command, address is checked directly via
gdbarch_tagged_address_p before gdbarch_get_memtag is called.
Also, because after this change the address checking only happens at the
upper layer it now allows the address checking to be specialized easily
per target, via a target hook.
Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
---
gdb/aarch64-linux-tdep.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index 0b9784f38e4..50055ac3f48 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -2575,10 +2575,6 @@ aarch64_linux_get_memtag (struct gdbarch *gdbarch, struct value *address,
tag = aarch64_mte_get_ltag (addr);
else
{
- /* Make sure we are dealing with a tagged address to begin with. */
- if (!aarch64_linux_tagged_address_p (gdbarch, address))
- return nullptr;
-
/* Remove the top byte. */
addr = gdbarch_remove_non_address_bits (gdbarch, addr);
std::optional<CORE_ADDR> atag = aarch64_mte_get_atag (addr);
--
2.34.1
next prev parent reply other threads:[~2024-04-04 6:48 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-04 6:48 [PATCH v3 0/7] Add another way to check tagged addresses on remote targets Gustavo Romero
2024-04-04 6:48 ` Gustavo Romero [this message]
2024-04-04 14:11 ` [PATCH v3 1/7] gdb: aarch64: Remove MTE address checking from get_memtag Luis Machado
2024-04-04 6:48 ` [PATCH v3 2/7] gdb: aarch64: Move MTE address check out of set_memtag Gustavo Romero
2024-04-04 14:17 ` Luis Machado
2024-04-06 23:07 ` Gustavo Romero
2024-04-04 6:48 ` [PATCH v3 3/7] gdb: aarch64: Remove MTE address checking from memtag_matches_p Gustavo Romero
2024-04-04 14:19 ` Luis Machado
2024-04-04 6:48 ` [PATCH v3 4/7] gdb: Use passed gdbarch instead of calling current_inferior Gustavo Romero
2024-04-04 14:20 ` Luis Machado
2024-04-04 6:48 ` [PATCH v3 5/7] gdb: Introduce is_address_tagged target hook Gustavo Romero
2024-04-04 15:45 ` Luis Machado
2024-04-04 16:12 ` Gustavo Romero
2024-04-04 16:20 ` Luis Machado
2024-04-08 20:47 ` Gustavo Romero
2024-04-04 6:48 ` [PATCH v3 6/7] gdb: Add qMemTagAddrCheck packet Gustavo Romero
2024-04-04 16:18 ` Luis Machado
2024-04-04 6:48 ` [PATCH v3 7/7] gdb: Document qMemTagCheckAddr packet Gustavo Romero
2024-04-04 7:40 ` Eli Zaretskii
2024-04-08 19:37 ` Tom Tromey
2024-04-09 13:23 ` Gustavo Romero
2024-04-09 15:33 ` Tom Tromey
2024-04-09 15:52 ` Luis Machado
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=20240404064819.2848899-2-gustavo.romero@linaro.org \
--to=gustavo.romero@linaro.org \
--cc=gdb-patches@sourceware.org \
--cc=luis.machado@arm.com \
--cc=thiago.bauermann@linaro.org \
/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).