Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix checks for VSX and Altivec availability on Power
@ 2016-04-15 21:48 Edjunior Barbosa Machado
  2016-04-16 10:38 ` Ulrich Weigand
  0 siblings, 1 reply; 3+ messages in thread
From: Edjunior Barbosa Machado @ 2016-04-15 21:48 UTC (permalink / raw)
  To: gdb-patches; +Cc: Carl E . Love, Ulrich Weigand

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;
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-22 22:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-15 21:48 [PATCH] Fix checks for VSX and Altivec availability on Power Edjunior Barbosa Machado
2016-04-16 10:38 ` Ulrich Weigand
2016-04-22 22:51   ` Edjunior Barbosa Machado

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox