From: Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Cc: "Carl E . Love" <cel@us.ibm.com>, Ulrich Weigand <uweigand@de.ibm.com>
Subject: [PATCH] Fix checks for VSX and Altivec availability on Power
Date: Fri, 15 Apr 2016 21:48:00 -0000 [thread overview]
Message-ID: <1460756881-25422-1-git-send-email-emachado@linux.vnet.ibm.com> (raw)
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;
next reply other threads:[~2016-04-15 21:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-15 21:48 Edjunior Barbosa Machado [this message]
2016-04-16 10:38 ` Ulrich Weigand
2016-04-22 22:51 ` Edjunior Barbosa Machado
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=1460756881-25422-1-git-send-email-emachado@linux.vnet.ibm.com \
--to=emachado@linux.vnet.ibm.com \
--cc=cel@us.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=uweigand@de.ibm.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