This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Check whether kernel supports PTRACE_GETREGSET


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7efe48d196f3fb6f55fc53b8021a410848c0a677

commit 7efe48d196f3fb6f55fc53b8021a410848c0a677
Author: Yao Qi <yao.qi@linaro.org>
Date:   Mon Jun 1 12:13:02 2015 +0100

    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.

Diff:
---
 gdb/ChangeLog       |  5 +++++
 gdb/arm-linux-nat.c | 16 ++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2ed122d..27b8438 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 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 ...
 	* linux-nat.c: ... here.
 	* x86-linux-nat.h (have_ptrace_getregset): Move the declaration
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);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]