Check whether kernel supports PTRACE_GETREGSET
authorYao Qi <yao.qi@linaro.org>
Mon, 1 Jun 2015 11:13:02 +0000 (12:13 +0100)
committerYao Qi <yao.qi@linaro.org>
Mon, 1 Jun 2015 11:13:02 +0000 (12:13 +0100)
gdb:

2015-06-01  Yao Qi  <yao.qi@linaro.org>

* arm-linux-nat.c (arm_linux_read_description): Check whether
kernel supports PTRACE_GETREGSET.

gdb/ChangeLog
gdb/arm-linux-nat.c

index 2ed122d506a6502b23feb2285846da0eda018e9e..27b84382bbf70ed1bfc90c9c1fd5963a143aa8aa 100644 (file)
@@ -1,3 +1,8 @@
+2015-06-01  Yao Qi  <yao.qi@linaro.org>
+
+       * arm-linux-nat.c (arm_linux_read_description): Check whether
+       kernel supports PTRACE_GETREGSET.
+
 2015-06-01  Yao Qi  <yao.qi@linaro.org>
 
        * x86-linux-nat.c (have_ptrace_getregset): Move it to ...
index 7352841f5931ec83f0789750dc62e6c7fc5393f9..877559ed3e0b4efd3c96025e416a1185618d23a7 100644 (file)
@@ -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);
This page took 0.029647 seconds and 4 git commands to generate.