aboutsummaryrefslogtreecommitdiff
path: root/gdb/arm-linux-nat.c
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2015-06-01 12:13:02 +0100
committerYao Qi <yao.qi@linaro.org>2015-06-01 12:13:02 +0100
commit7efe48d196f3fb6f55fc53b8021a410848c0a677 (patch)
tree41411952376be57249e526ac2a76835ae753ae79 /gdb/arm-linux-nat.c
parent433bbbf8574a04c1639c5466fd7c320b510b9512 (diff)
downloadgdb-7efe48d196f3fb6f55fc53b8021a410848c0a677.zip
gdb-7efe48d196f3fb6f55fc53b8021a410848c0a677.tar.gz
gdb-7efe48d196f3fb6f55fc53b8021a410848c0a677.tar.bz2
Check whether kernel supports PTRACE_GETREGSET
gdb: 2015-06-01 Yao Qi <yao.qi@linaro.org> * arm-linux-nat.c (arm_linux_read_description): Check whether kernel supports PTRACE_GETREGSET.
Diffstat (limited to 'gdb/arm-linux-nat.c')
-rw-r--r--gdb/arm-linux-nat.c16
1 files changed, 16 insertions, 0 deletions
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);