From: <Ezra.Sitorus@arm.com>
To: <gdb-patches@sourceware.org>
Cc: <luis.machado.foss@gmail.com>, Ezra Sitorus <ezra.sitorus@arm.com>
Subject: [RFC PATCH 4/5] gdb/aarch64: core file support for FPMR
Date: Fri, 5 Sep 2025 14:17:06 +0100 [thread overview]
Message-ID: <20250905131707.77027-5-Ezra.Sitorus@arm.com> (raw)
In-Reply-To: <20250905131707.77027-1-Ezra.Sitorus@arm.com>
From: Ezra Sitorus <ezra.sitorus@arm.com>
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)
+{
+ /* 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<aarch64_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)
+{
+ /* 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<aarch64_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));
+}
+
/* 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. */
--
2.45.2
next prev parent reply other threads:[~2025-09-05 13:20 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-05 13:17 [RFC PATCH 0/5] gdb/aarch64: Support " Ezra.Sitorus
2025-09-05 13:17 ` [RFC PATCH 1/5] gdb/aarch64: Enable FPMR for AArch64 in gdb on Linux Ezra.Sitorus
2025-09-07 22:55 ` Luis
2025-09-10 23:56 ` Thiago Jung Bauermann
2025-09-10 23:45 ` Thiago Jung Bauermann
2025-09-05 13:17 ` [RFC PATCH 2/5] gdbserver/aarch64: Enable FPMR for AArch64 in gdbserver " Ezra.Sitorus
2025-09-07 22:55 ` Luis
2025-09-10 23:46 ` Thiago Jung Bauermann
2025-09-05 13:17 ` [RFC PATCH 3/5] gdb/aarch64: signal frame support for fpmr Ezra.Sitorus
2025-09-07 22:56 ` Luis
2025-09-11 0:03 ` Thiago Jung Bauermann
2025-09-10 23:47 ` Thiago Jung Bauermann
2025-09-05 13:17 ` Ezra.Sitorus [this message]
2025-09-07 22:56 ` [RFC PATCH 4/5] gdb/aarch64: core file support for FPMR Luis
2025-09-10 23:48 ` Thiago Jung Bauermann
2025-09-05 13:17 ` [RFC PATCH 5/5] gdb/aarch64: Tests for fpmr Ezra.Sitorus
2025-09-07 22:56 ` Luis
2025-09-16 11:09 ` Ezra Sitorus
2025-09-16 23:50 ` Luis
2025-09-10 23:53 ` Thiago Jung Bauermann
2025-09-10 23:39 ` [RFC PATCH 0/5] gdb/aarch64: Support for FPMR Thiago Jung Bauermann
2025-09-11 15:52 ` Ezra Sitorus
2025-09-12 3:17 ` Thiago Jung Bauermann
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=20250905131707.77027-5-Ezra.Sitorus@arm.com \
--to=ezra.sitorus@arm.com \
--cc=gdb-patches@sourceware.org \
--cc=luis.machado.foss@gmail.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