From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id wXCGOWwOwmgabT8AWB0awg (envelope-from ) for ; Wed, 10 Sep 2025 19:49:00 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=ARx4D4ck; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id E79ED1E0BA; Wed, 10 Sep 2025 19:49:00 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 667C91E047 for ; Wed, 10 Sep 2025 19:49:00 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EFD673858C60 for ; Wed, 10 Sep 2025 23:48:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EFD673858C60 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=ARx4D4ck Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by sourceware.org (Postfix) with ESMTPS id A67843858D35 for ; Wed, 10 Sep 2025 23:48:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A67843858D35 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 A67843858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::102b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1757548108; cv=none; b=xiQgNvkXJux5BXPyhhZZqKb7RerlpHxdZ9RDS8XWtN1AWRJTVxZf3pjUomzoAHT1D86hZ4TGu4PbGdgsr+IHhd9Qs0Kyjge7cbE1AqPxADPzmeC478JYO4yY13lvq9wq7oEIPGU2W6mLXmHvIR8a3GMr2FaiO2DnCANahbA6/es= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1757548108; c=relaxed/simple; bh=THpHXWvJQvCulEF69b3PUG6RWdRY7iUpZL2RLHILVCg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=RIWvMjGUVjM4CYgQJjTFw2W6rXftbwLDtc6Rva7KuJumQH3zAbBodlYAc6Ko/uE74wnJA9SkBTpFyEh4EocYI+64wFYleFVsj37VYBxwzlOMcuJKq5IaNAT2OYAQpslDq7LvtR52RlZ6+DZVVi2EZuuQHPwSgEF08nm02Gvktyc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A67843858D35 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-32b02d88d80so98995a91.0 for ; Wed, 10 Sep 2025 16:48:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1757548108; x=1758152908; darn=sourceware.org; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=cn7oxzU9vbneBZs0gXxuUNn3syNr6+/JLJ38kFkG040=; b=ARx4D4cktLKvr2kJv7fb8m2xFUF21H6sEcDmDdh/r/rqCU1jfeih6kXWFU7jBAZsN7 robfeX4DP/06n+ah8SjXR4zTaehK2whNp2WcursLZ4Z9UJAvzZYcwdR7h6N8N7y8pZBs 1P9s76RQxbEWMf5k+AaaRVJtWTR5+/LOpyszrspvqcH25rjb/xFsK/9eoKK6KmkVCiin 2aojQXZcFSpGqfOYS7G2NDpbU1Z4DkaLmVyVQokSrSUd1ZI1aw1qbhELaUMkSBj/6za/ 0WiQwW/0lbydSpV1Rlh/JwPtcN4WFiYNe1ydm+KUUqFy06NMwU1bUgv+NRlO10MzS+ae hgcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757548108; x=1758152908; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=cn7oxzU9vbneBZs0gXxuUNn3syNr6+/JLJ38kFkG040=; b=CHkmObYAmH9Sj5cE2wwwkOy8CVyohXjilzzQ9To7zNUs3j5zELEe3ralkY1bKWLkp5 IQZgzgYVOra5SRQqpRTvgHH/Xo4Cu0SYOobL3WbxjleAgkY0Pqcf8w75vsawYMFgCMfw f1FO7gSg3EhznKg0CRvCx+fEgghXV91LVo3/fQtpO5DXkl1RcMw/96DRq8q9UocATg5/ 0SoMQvy8i+nGFTzmjwTm+EEK+lUN3I6dufcFs2Jigw6A8NqhcfNoqKvdpuwV2ZKM73ib Vfu7DOASWgA14tErjFrsghMw9Hu10gZEG4kNZTsnFsK47hZNvqUajO5ddz3FvRwxCe8C wEhg== X-Gm-Message-State: AOJu0YzpVZD8zvt+Xakp+u+ggLiBhry3eprc/T2BA7P75dpP+qBS0EXc kJXSWNgsBuOno2eo25kDT09R++6oJ2h6WBh4KGOEF0wUQIG/9xFbfuI/LVXQlqveNA31nixKerM ZTYRc X-Gm-Gg: ASbGncsN3530XLQn3W9OTG3hSktvh6pdG23Bv7QtkydlF0Yp4NGS9i/fey/+kZW+RfP CWaxk2HPCqdmNGlmvzVCpzH3i8Z/7H1XHIPllZkY6lbcmWpjOdI4SN5zouY/zP0p53ZFZV8Q0qI YuEev32JCge+2S6rDMSFgMU0CJk1Vcb06Qw4veklGieAUuICoCek03A42pOcDQwKmlntGx5C1t8 +ohos5eV/jZTmOt75Cm8rDltfuD/uzzWL7QD9q58U50anXDJsxjAmzWpeoUS6g+9xfxHDmOkn/p YS6hwxvgsW2MlgzCZWLFTcS6ILeeHxQhonxZmHijA/EisJE42AqHOFCx73M9+ozJDx5dD5aJ084 OPewe/S3ezs/f09FXJFZHWKVkti8zGEnb X-Google-Smtp-Source: AGHT+IGAfyciCRJsLD7QLVEzAH1MLUPH88vMSc5m0/b7F118AfJ6uIlG3IWmKVASOE6p6iWyq0PePw== X-Received: by 2002:a17:90b:4c0c:b0:32b:5d8b:ea43 with SMTP id 98e67ed59e1d1-32d43ef6d3cmr23058821a91.6.1757548107566; Wed, 10 Sep 2025 16:48:27 -0700 (PDT) Received: from localhost ([2804:14d:7e39:88d6:e23e:713e:98d0:a6b4]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b548a6bc792sm3733280a12.42.2025.09.10.16.48.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Sep 2025 16:48:27 -0700 (PDT) From: Thiago Jung Bauermann To: Cc: , Subject: Re: [RFC PATCH 4/5] gdb/aarch64: core file support for FPMR In-Reply-To: <20250905131707.77027-5-Ezra.Sitorus@arm.com> (Ezra Sitorus's message of "Fri, 5 Sep 2025 14:17:06 +0100") References: <20250905131707.77027-1-Ezra.Sitorus@arm.com> <20250905131707.77027-5-Ezra.Sitorus@arm.com> User-Agent: mu4e 1.12.11; emacs 30.1 Date: Wed, 10 Sep 2025 20:48:24 -0300 Message-ID: <87ms7150on.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org writes: > From: Ezra Sitorus > > Add support for FPMR dumps/reads for core files. > > Manually validated with Shrinkwrap (Arm FVP). > --- > gdb/aarch64-linux-tdep.c | 67 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 67 insertions(+) > > diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c > index b4911d36410..731f05bae5a 100644 > --- a/gdb/aarch64-linux-tdep.c > +++ b/gdb/aarch64-linux-tdep.c > @@ -1519,6 +1519,56 @@ aarch64_linux_collect_zt_regset (const struct regset *regset, > AARCH64_SME2_ZT0_SIZE); > } > > +/* Supply register REGNUM from BUF to REGCACHE, using the register map > + in REGSET. If REGNUM is -1, do this for all registers in REGSET. > + If BUF is NULL, set the registers to "unavailable" status. */ > + > +static void > +aarch64_linux_supply_fpmr_regset (const struct regset *regset, > + struct regcache *regcache, > + int regnum, const void *buf, size_t size) The indentation of the arguments is missing 2 spaces. > +{ > + /* Read the FPMR note from a core file into the register buffer. */ > + > + /* Make sure the buffer contains at least the expected amount of data we are > + supposed to get. */ > + gdb_assert (size >= sizeof (uint64_t)); > + > + /* Handle an empty buffer. */ > + if (buf == nullptr) > + return regcache->supply_regset (regset, regnum, nullptr, size); > + > + aarch64_gdbarch_tdep *tdep > + = gdbarch_tdep (regcache->arch ()); > + > + /* Supply the ZT0 register contents. */ > + regcache->raw_supply (tdep->fpmr_regnum, buf); > +} > + > +/* Collect register REGNUM from REGCACHE to BUF, using the register > + map in REGSET. If REGNUM is -1, do this for all registers in > + REGSET. */ > + > +static void > +aarch64_linux_collect_fpmr_regset (const struct regset *regset, > + const struct regcache *regcache, > + int regnum, void *buf, size_t size) The indentation of the arguments is missing 2 spaces. > +{ > + /* Read the FPMR contents from the register buffer into the core > + file section. */ > + > + /* Make sure the buffer can hold the data we need to return. */ > + gdb_assert (size >= sizeof (uint64_t)); > + gdb_assert (buf != nullptr); > + > + aarch64_gdbarch_tdep *tdep > + = gdbarch_tdep (regcache->arch ()); > + > + /* Dump the register cache contents for the FPMR to the buffer. */ > + regcache->collect_regset (regset, tdep->fpmr_regnum, buf, > + sizeof (uint64_t)); This fits in one line, no need to break it. > +} > + > /* Implement the "iterate_over_regset_sections" gdbarch method. */ > > static void > @@ -1636,6 +1686,23 @@ aarch64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch, > } > } > > + if (tdep->has_fpmr ()) > + { > + const struct regcache_map_entry fpmr_regmap[] = > + { > + { 1, tdep->fpmr_regnum, sizeof (uint64_t) } > + }; > + > + const struct regset aarch64_linux_fpmr_regset = > + { > + fpmr_regmap, aarch64_linux_supply_fpmr_regset, > + aarch64_linux_collect_fpmr_regset > + }; > + > + cb (".reg-aarch-fpmr", sizeof (uint64_t), sizeof (uint64_t), > + &aarch64_linux_fpmr_regset, "FPMR", cb_data); > + } > + > if (tdep->has_pauth ()) > { > /* Create this on the fly in order to handle the variable location. */ -- Thiago