This is the mail archive of the gdb-patches@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]

[PATCH] gdbserver switch ps_get_thread_area to PTRACE_GETREGSET


This patch switches the aarch64 gdbserver ps_get_thread_area() implementation from PTRACE_GET_THREAD_AREA to PTRACE_GETREGSET.

OK?

/Marcus

2013-02-06 Marcus Shawcroft <marcus.shawcroft@arm.com>

       * linux-aarch64-low.c (ps_get_thread_area): Replace
       PTRACE_GET_THREAD_AREA with PTRACE_GETREGSET.
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
index 7f99887..e56ea80 100644
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -1089,16 +1089,22 @@ aarch64_stopped_by_watchpoint (void)
 /* Fetch the thread-local storage pointer for libthread_db.  */
 
 ps_err_e
-ps_get_thread_area (const struct ps_prochandle * ph,
+ps_get_thread_area (const struct ps_prochandle *ph,
 		    lwpid_t lwpid, int idx, void **base)
 {
-  if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
+  struct iovec iovec;
+  CORE_ADDR reg;
+
+  iovec.iov_base = &reg;
+  iovec.iov_len = sizeof (reg);
+
+  if (ptrace (PTRACE_GETREGSET, lwpid, NT_ARM_TLS, &iovec) != 0)
     return PS_ERR;
 
   /* IDX is the bias from the thread pointer to the beginning of the
      thread descriptor.  It has to be subtracted due to implementation
      quirks in libthread_db.  */
-  *base = (void *) ((char *) *base - idx);
+  *base = (void *) (reg - idx);
 
   return PS_OK;
 }
-- 
1.7.9.5

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