From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id C5C8F3858C50 for ; Thu, 4 Apr 2024 06:48:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C5C8F3858C50 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C5C8F3858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::429 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712213331; cv=none; b=aVdSjAO7B2lfUs+pEQ6UO7KL8G4l07onsy/Npt+t+0J3KK6S5SzZAShvGPOszyNic7TlCLspI/BKWVYCPp/1YLdJGmlee7CW5ov8YYo+EhqCvA/xqToHGnybH+cPasNib2sqJUbbG6eyva9XTKdHzqfODYa6V+JHuxEady6UCWY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712213331; c=relaxed/simple; bh=lVZNgHHbt9wy4pZkjHuJ9gFQRh1DGKSeSPidKtEJSbA=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=auL1QaSfq0KE8fxniXrbmVHKUNiYJZIKwDjjiSvFDarTXz+UWBQL1HdGN95hOAWbYU8HAr651ya7tHOjqHxttgZER3i/dqDIQbbsM9dVdHj+eFycPVZ/ooT+Yni4tfUn6HdOM1j69hFTxjhxYJyjQCE5pqDEp9qCxc/Ci3gES6s= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6eced1dab1fso243899b3a.1 for ; Wed, 03 Apr 2024 23:48:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712213328; x=1712818128; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DWYOE8EpQChfa8uCdhk5+693ODj8bGW6P79IkUH3wv8=; b=rZ1O04RUtNflKQWdunKkvDOo58I1YiDrZ6L6GaWwd3BiIv3qDC0Q8mNlq3T2plo+5E AQ9fg6JPamUfoWj7DLSL4t8lxCs02a4NZwmh/PTMNoY4qdcwagc1KgYFf0xKVHdQff9D Wzks25MWEPuEFHpADbSOPfL8/a/qtMdoAn7QdEKCelpcZJruCKwleqjxrNBytd2Gkgur eeObViy5y7daEnU+l2UufiOEGuqMIDNBqis5bd9T4kAC1K9QN73xBdpwLwaG7RbuTva1 Jmrlevz2ZmIxhU6ICtmmMvsuYMsSdpwRE9+f0ToHnaHyGT48LKSHY3M4bUv5vLyNkmyq 9XBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712213328; x=1712818128; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DWYOE8EpQChfa8uCdhk5+693ODj8bGW6P79IkUH3wv8=; b=hl+nsEz6+TuVOsGfOVO0Ez3ByY7WSfd2O45yVFE0V2qchdIPbktz7BEEFzYzVuwyRz E9UrhAt8FxBmC2LWKN2iOxlpgW0OujjqfTH8Zr6z2zut+AiRdftUzSuv2KkhhcHcaNYY UheZwbQ2CLAlJKk+EBEC2S2W2BILIVfWoEFsL3zn9FFUZ6TLonz1n26ckHQSCJAgi+Cz +WT5p9Fy+ER6wUodZbnbekFvEelEjLgxebKGkaHJ6J967Ki+pqCrffW7sSrMGCHNAQt7 oohmrh4241Ksjb+rcUt6BTVDRUeCEylZK3SBhdZGPhuSlpiHOJdzFrbm0ASHp135Uo0V /Idw== X-Gm-Message-State: AOJu0YzlVRt/g0clDy8vvq0DHXZkaBvQUYIO80vmW4tQiyndLSms+I6D /xh3Si44Ki/26hYxvDEc0zd8rPf55GK3DvbuE/k3kTHuEXSL3S8O0E3D6zPC2ObYgFMBRYXmPwM y X-Google-Smtp-Source: AGHT+IH9GCMwYWaHqYQlrC06DaMrnKWt18M/bDaLf+7I4rMmDqo5flKbG6LCFM4tNhvl1AGFmy84sw== X-Received: by 2002:a05:6a00:1886:b0:6ea:be87:fd36 with SMTP id x6-20020a056a00188600b006eabe87fd36mr1708798pfh.1.1712213328218; Wed, 03 Apr 2024 23:48:48 -0700 (PDT) Received: from amd.. ([2804:7f0:b402:d0dc:3e7c:3fff:fe7a:e83b]) by smtp.gmail.com with ESMTPSA id n16-20020aa79850000000b006e64ddfa71asm13218899pfq.170.2024.04.03.23.48.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 23:48:47 -0700 (PDT) From: Gustavo Romero To: gdb-patches@sourceware.org Cc: luis.machado@arm.com, thiago.bauermann@linaro.org, gustavo.romero@linaro.org Subject: [PATCH v3 2/7] gdb: aarch64: Move MTE address check out of set_memtag Date: Thu, 4 Apr 2024 06:48:14 +0000 Message-Id: <20240404064819.2848899-3-gustavo.romero@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240404064819.2848899-1-gustavo.romero@linaro.org> References: <20240404064819.2848899-1-gustavo.romero@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 --- gdb/aarch64-linux-tdep.c | 4 ---- gdb/printcmd.c | 5 +++++ 2 files changed, 5 insertions(+), 4 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..774e3ec74ae 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -3127,6 +3127,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")); -- 2.34.1