This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 3/6] Check whether kernel supports PTRACE_GETREGSET
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 28 May 2015 15:20:13 +0100
- Subject: [PATCH 3/6] Check whether kernel supports PTRACE_GETREGSET
- Authentication-results: sourceware.org; auth=none
- References: <1432822816-32327-1-git-send-email-yao dot qi at linaro dot org>
gdb:
2015-05-28 Yao Qi <yao.qi@linaro.org>
* arm-linux-nat.c (arm_linux_read_description): Check whether
kernel supports PTRACE_GETREGSET.
---
gdb/arm-linux-nat.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index 7352841..877559e 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -634,6 +634,22 @@ arm_linux_read_description (struct target_ops *ops)
{
CORE_ADDR arm_hwcap = 0;
+ if (have_ptrace_getregset == -1)
+ {
+ elf_gregset_t gpregs;
+ struct iovec iov;
+ int tid = GET_THREAD_ID (inferior_ptid);
+
+ iov.iov_base = &gpregs;
+ iov.iov_len = sizeof (gpregs);
+
+ /* Check if PTRACE_GETREGSET works. */
+ if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iov) < 0)
+ have_ptrace_getregset = 0;
+ else
+ have_ptrace_getregset = 1;
+ }
+
if (target_auxv_search (ops, AT_HWCAP, &arm_hwcap) != 1)
{
return ops->beneath->to_read_description (ops->beneath);
--
1.9.1