From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1585) id A86CD3849ACC; Fri, 19 Apr 2024 14:31:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A86CD3849ACC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1713537072; bh=SnPenHue82Wy5P+0hq3zEUVjTfCr4Q12nQCHMUrdxkc=; h=From:To:Subject:Date:From; b=DQgFyp8oNljamvtmRZUKNQbDbtaFkB/hveiC0fAzIVMOjCBeCoYnR5LNjITwks1cR rW1ortDldd5dZ7Fn8c5JGCq5+/zUoMrD1AKDAtAmGOc1rOvTyh2H1igPw2HtEsHwqX ZExF1pgtyZeINguxI7Er0mR2jd1IKxWtanP+HzOk= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Luis Machado To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: aarch64: Remove MTE address checking from memtag_matches_p X-Act-Checkin: binutils-gdb X-Git-Author: Gustavo Romero X-Git-Refname: refs/heads/master X-Git-Oldrev: f00fb5e1d1fc058700eac66eb483da2638493b98 X-Git-Newrev: 681ad8174d092fbbc54f5f9b2cf7024a1c990379 Message-Id: <20240419143112.A86CD3849ACC@sourceware.org> Date: Fri, 19 Apr 2024 14:31:12 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D681ad8174d09= 2fbbc54f5f9b2cf7024a1c990379 commit 681ad8174d092fbbc54f5f9b2cf7024a1c990379 Author: Gustavo Romero Date: Thu Apr 18 20:10:34 2024 +0000 gdb: aarch64: Remove MTE address checking from memtag_matches_p =20 This commit removes aarch64_linux_tagged_address_p from aarch64_linux_memtag_matches_p. aarch64_linux_tagged_address_p checks if an address is tagged (MTE) or not. =20 The check is redundant because aarch64_linux_memtag_matches_p is always called from the upper layers (i.e. from printcmd.c via gdbarch hook gdbarch_memtag_matches_p) 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: =20 a) in print_command_1, gdbarch_memtag_matches_p is called only after should_validate_memtags is called, which checks the address at its end; =20 b) in memory_tag_check_command, gdbarch_memtag_matches_p is called only after gdbarch_tagged_address_p is called directly. =20 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. =20 Signed-off-by: Gustavo Romero Approved-By: Luis Machado Tested-By: Luis Machado Diff: --- 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 8e6e63d4dcb..fc60e602748 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -2476,10 +2476,6 @@ aarch64_linux_memtag_matches_p (struct gdbarch *gdba= rch, { gdb_assert (address !=3D nullptr); =20 - /* Make sure we are dealing with a tagged address to begin with. */ - if (!aarch64_linux_tagged_address_p (gdbarch, address)) - return true; - CORE_ADDR addr =3D value_as_address (address); =20 /* Fetch the allocation tag for ADDRESS. */