This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Fix checks for VSX and Altivec availability on Power
- From: Edjunior Barbosa Machado <emachado at linux dot vnet dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Cc: "Carl E . Love" <cel at us dot ibm dot com>, Ulrich Weigand <uweigand at de dot ibm dot com>
- Date: Fri, 15 Apr 2016 18:48:01 -0300
- Subject: [PATCH] Fix checks for VSX and Altivec availability on Power
- Authentication-results: sourceware.org; auth=none
Hi,
in order to identify if it is running in a machine with VSX available, current
GDB is relying only on the ptrace call using PTRACE_GETVSXREGS, which is
successful in some kernels even if the processor version does not have such
feature (as Power6 and previous), leading to show registers that actually do
not exist. This simple patch fixes this issue adding checks using
PPC_FEATURE_HAS_VSX and PPC_FEATURE_HAS_ALTIVEC from ppc hwcap to assure these
features are available. OK?
Thanks and regards,
--
Edjunior
gdb/ChangeLog
2016-04-15 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
* ppc-linux-nat.c (ppc_linux_read_description): Use PPC_FEATURE_HAS_VSX
and PPC_FEATURE_HAS_ALTIVEC to check if such features are available.
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index bf91462..84c14a1 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -2419,7 +2419,8 @@ ppc_linux_read_description (struct target_ops *ops)
perror_with_name (_("Unable to fetch SPE registers"));
}
- if (have_ptrace_getsetvsxregs)
+ if (have_ptrace_getsetvsxregs
+ && (ppc_linux_get_hwcap () & PPC_FEATURE_HAS_VSX))
{
gdb_vsxregset_t vsxregset;
@@ -2432,7 +2433,8 @@ ppc_linux_read_description (struct target_ops *ops)
perror_with_name (_("Unable to fetch VSX registers"));
}
- if (have_ptrace_getvrregs)
+ if (have_ptrace_getvrregs
+ && (ppc_linux_get_hwcap () & PPC_FEATURE_HAS_ALTIVEC))
{
gdb_vrregset_t vrregset;