This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/2] Add linux_get_hwcap
- From: Simon Marchi <simark at simark dot ca>
- To: Alan Hayward <Alan dot Hayward at arm dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Cc: nd <nd at arm dot com>
- Date: Mon, 25 Mar 2019 11:18:02 -0400
- Subject: Re: [PATCH 1/2] Add linux_get_hwcap
- References: <20190325120542.92123-1-alan.hayward@arm.com>
On 2019-03-25 8:05 a.m., Alan Hayward wrote:
Tidy up calls to read HWCAP (and HWCAP2) by adding common functions,
removing the PPC and AArch64 specific versions.
The only function difference is in aarch64_linux_core_read_description - if
the hwcap read fails it now return a valid description instead of nullptr.
ARM also seems to have changed behavior, both the native target and core
target. It's not necessarily, a problem, as long as it's a conscious
change.
diff --git a/gdb/linux-tdep.h b/gdb/linux-tdep.h
index 824ba3afaf..ee9c2bcc90 100644
--- a/gdb/linux-tdep.h
+++ b/gdb/linux-tdep.h
@@ -61,4 +61,10 @@ extern void linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch);
extern int linux_is_uclinux (void);
+/* Fetch the AT_HWCAP entry from the auxv vector for the given TARGET. */
+extern CORE_ADDR linux_get_hwcap (struct target_ops *target);
+
+/* Fetch the AT_HWCAP2 entry from the auxv vector for the given TARGET. */
+extern CORE_ADDR linux_get_hwcap2 (struct target_ops *target);
For these two functions, can you mention that 0 is returned if the
search in the AUXV vector fails?
I was a bit surprised you didn't keep your version returning a bool to
indicate whether the search succeeded or failed, but if this version is
good enough, I am fine with it. If we ever have a target that really
needs to differentiate between a lookup failure and a lookup success
that returns the value 0, we can change it back or add another overload.
This patch LGTM with the comment above updated.
Simon