[PATCH v2 18/24] AArch64: Add MTE register set support for core files

Luis Machado via Gdb-patches
2020-10-22T20:01:56Z

This patch handles the tagged_addr_ctrl register that is exported when
generating a core file.

gdb/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* aarch64-linux-tdep.c
(aarch64_linux_iterate_over_regset_sections): Handle MTE register set.
* aarch64-linux-tdep.h (AARCH64_LINUX_SIZEOF_MTE_REGSET): Define.
---
gdb/aarch64-linux-tdep.c | 20 ++++++++++++++++++++
gdb/aarch64-linux-tdep.h | 3 +++
2 files changed, 23 insertions(+)

diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index 0084717c0e..1eec0be28e 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -651,6 +651,26 @@ aarch64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
AARCH64_LINUX_SIZEOF_PAUTH, &aarch64_linux_pauth_regset,
"pauth registers", cb_data);
}
+
+ /* Handle MTE registers. */
+ if (tdep->has_mte ())
+ {
+ /* Create this on the fly in order to handle the variable location. */
+ const struct regcache_map_entry mte_regmap[] =
+ {
+ { 1, tdep->mte_reg_base, 4},
+ { 0 }
+ };
+
+ const struct regset aarch64_linux_mte_regset =
+ {
+ mte_regmap, regcache_supply_regset, regcache_collect_regset
+ };
+
+ cb (".reg-aarch-mte", AARCH64_LINUX_SIZEOF_MTE_REGSET,
+ AARCH64_LINUX_SIZEOF_MTE_REGSET, &aarch64_linux_mte_regset,
+ "MTE registers", cb_data);
+ }
}

/* Implement the "core_read_description" gdbarch method. */
diff --git a/gdb/aarch64-linux-tdep.h b/gdb/aarch64-linux-tdep.h
index a7094bb7c0..2495379d5b 100644
--- a/gdb/aarch64-linux-tdep.h
+++ b/gdb/aarch64-linux-tdep.h
@@ -36,6 +36,9 @@
/* The pauth regset consists of 2 X sized registers. */
#define AARCH64_LINUX_SIZEOF_PAUTH (2 * X_REGISTER_SIZE)

+/* The MTE regset consists of a 32-bit register. */
+#define AARCH64_LINUX_SIZEOF_MTE_REGSET (4)
+
extern const struct regset aarch64_linux_gregset;
extern const struct regset aarch64_linux_fpregset;

--
2.17.1