From: Matthieu Longo <matthieu.longo@arm.com>
To: <gdb-patches@sourceware.org>
Cc: Luis Machado <luis.machado@amd.com>,
Luis Machado <luis.machado.foss@gmail.com>,
Andrew Burgess <aburgess@redhat.com>,
"Matthieu Longo" <matthieu.longo@arm.com>
Subject: [PATCH v1 8/8] gdb/linux: add helpers to read AT_HWCAP3
Date: Fri, 3 Jul 2026 19:58:53 +0100 [thread overview]
Message-ID: <20260703185853.450440-9-matthieu.longo@arm.com> (raw)
In-Reply-To: <20260703185853.450440-1-matthieu.longo@arm.com>
Add linux_get_hwcap3 helpers to GDB and gdbserver, mirroring the
existing linux_get_hwcap and linux_get_hwcap2 interfaces.
The new helpers retrieve the AT_HWCAP3 auxiliary vector entry either
from explicitly supplied auxv data or from the current inferior.
This prepares for future features that depend on HWCAP3 capability
bits.
---
gdb/linux-tdep.c | 19 +++++++++++++++++++
gdb/linux-tdep.h | 11 +++++++++++
gdbserver/linux-low.cc | 10 ++++++++++
gdbserver/linux-low.h | 4 ++++
4 files changed, 44 insertions(+)
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 5312dad176f..e00a9786f0b 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -3138,6 +3138,25 @@ linux_get_hwcap2 ()
current_inferior ()->arch ());
}
+/* See linux-tdep.h. */
+
+CORE_ADDR
+linux_get_hwcap3 (const std::optional<gdb::byte_vector> &auxv,
+ target_ops *target, gdbarch *gdbarch)
+{
+ return linux_get_hwcap_helper (auxv, target, gdbarch, AT_HWCAP3);
+}
+
+/* See linux-tdep.h. */
+
+CORE_ADDR
+linux_get_hwcap3 ()
+{
+ return linux_get_hwcap3 (target_read_auxv (),
+ current_inferior ()->top_target (),
+ current_inferior ()->arch ());
+}
+
/* Display whether the gcore command is using the
/proc/PID/coredump_filter file. */
diff --git a/gdb/linux-tdep.h b/gdb/linux-tdep.h
index c19839fde2c..01c81d26691 100644
--- a/gdb/linux-tdep.h
+++ b/gdb/linux-tdep.h
@@ -91,6 +91,17 @@ extern CORE_ADDR linux_get_hwcap2 (const std::optional<gdb::byte_vector> &auxv,
extern CORE_ADDR linux_get_hwcap2 ();
+/* Fetch the AT_HWCAP3 entry from auxv data AUXV. Use TARGET and GDBARCH to
+ parse auxv entries.
+
+ On error, 0 is returned. */
+extern CORE_ADDR linux_get_hwcap3 (const std::optional<gdb::byte_vector> &auxv,
+ struct target_ops *target, gdbarch *gdbarch);
+
+/* Same as the above, but obtain all the inputs from the current inferior. */
+
+extern CORE_ADDR linux_get_hwcap3 ();
+
/* Returns true if ADDR belongs to a shadow stack memory range. If this
is the case, assign the shadow stack memory range to RANGE
[start_address, end_address). */
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index ade5e9e2a1c..7b29b3ddf7f 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -7198,6 +7198,16 @@ linux_get_hwcap2 (int pid, int wordsize)
return hwcap2;
}
+/* See linux-low.h. */
+
+CORE_ADDR
+linux_get_hwcap3 (int pid, int wordsize)
+{
+ CORE_ADDR hwcap3 = 0;
+ linux_get_auxv (pid, wordsize, AT_HWCAP3, &hwcap3);
+ return hwcap3;
+}
+
#ifdef HAVE_LINUX_REGSETS
void
initialize_regsets_info (struct regsets_info *info)
diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h
index 03e11202955..276d60eafd6 100644
--- a/gdbserver/linux-low.h
+++ b/gdbserver/linux-low.h
@@ -977,4 +977,8 @@ CORE_ADDR linux_get_hwcap (int pid, int wordsize);
CORE_ADDR linux_get_hwcap2 (int pid, int wordsize);
+/* Fetch the AT_HWCAP3 entry from the auxv vector, where entries are length
+ WORDSIZE, of process with pid PID. If no entry was found, return 0. */
+CORE_ADDR linux_get_hwcap3 (int pid, int wordsize);
+
#endif /* GDBSERVER_LINUX_LOW_H */
--
2.55.0
next prev parent reply other threads:[~2026-07-03 19:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-03 18:58 [PATCH v1 0/8] gdb: various refactoring in linux-tdep Matthieu Longo
2026-07-03 18:58 ` [PATCH v1 1/8] gdb/linux-tdep: use pid_t consistently for process IDs Matthieu Longo
2026-07-05 21:22 ` Tom Tromey
2026-07-06 9:30 ` Matthieu Longo
2026-07-03 18:58 ` [PATCH v1 2/8] gdb/linux-tdep: change linux_fill_prpsinfo to return bool Matthieu Longo
2026-07-03 18:58 ` [PATCH v1 3/8] target_fileio_read_stralloc: add an optional length parameter Matthieu Longo
2026-07-03 18:58 ` [PATCH v1 4/8] gdb support: add index_type to array_view for documentation purpose Matthieu Longo
2026-07-03 19:55 ` Pedro Alves
2026-07-06 10:51 ` Matthieu Longo
2026-07-03 18:58 ` [PATCH v1 5/8] gdb support: add gdb::replace algorithm for iterators and ranges Matthieu Longo
2026-07-03 18:58 ` [PATCH v1 6/8] gdb: introduce helper class file_reader_t Matthieu Longo
2026-07-03 18:58 ` [PATCH v1 7/8] gdb/linux-tdep: parse ProtectionKey in /proc/PID/smaps Matthieu Longo
2026-07-03 18:58 ` Matthieu Longo [this message]
2026-07-07 10:39 ` [PATCH v1 8/8] gdb/linux: add helpers to read AT_HWCAP3 Yury Khrustalev
2026-07-07 15:51 ` Matthieu Longo
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=20260703185853.450440-9-matthieu.longo@arm.com \
--to=matthieu.longo@arm.com \
--cc=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=luis.machado.foss@gmail.com \
--cc=luis.machado@amd.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