* m68klinux-nat.c: Include "gdb_proc_service.h".
authorAndreas Schwab <schwab@linux-m68k.org>
Thu, 8 Mar 2012 13:35:41 +0000 (13:35 +0000)
committerAndreas Schwab <schwab@linux-m68k.org>
Thu, 8 Mar 2012 13:35:41 +0000 (13:35 +0000)
(PTRACE_GET_THREAD_AREA): Define.
(ps_get_thread_area): New function.

gdb/ChangeLog
gdb/m68klinux-nat.c

index a824d2d6666fac48cf32a1cd5ec7f8810848453b..0680f00d69e53048380686cba6f057f8c32cd94d 100644 (file)
@@ -1,3 +1,9 @@
+2012-03-08  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * m68klinux-nat.c: Include "gdb_proc_service.h".
+       (PTRACE_GET_THREAD_AREA): Define.
+       (ps_get_thread_area): New function.
+
 2012-03-08  Yao Qi  <yao@codesourcery.com>
 
        * remote.c (remote_get_noisy_reply): Replace `sprintf' with
index c7137c0414b25bbd674270da623b0d8048653385..d4410e68034d398862836113b6d499e038669727 100644 (file)
 
 /* Prototypes for supply_gregset etc.  */
 #include "gregset.h"
+
+/* Defines ps_err_e, struct ps_prochandle.  */
+#include "gdb_proc_service.h"
+
+#ifndef PTRACE_GET_THREAD_AREA
+#define PTRACE_GET_THREAD_AREA 25
+#endif
 \f
 /* This table must line up with gdbarch_register_name in "m68k-tdep.c".  */
 static const int regmap[] =
@@ -556,6 +563,24 @@ fetch_core_registers (struct regcache *regcache,
 }
 \f
 
+/* Fetch the thread-local storage pointer for libthread_db.  */
+
+ps_err_e
+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)
+    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 = (char *) *base - idx;
+
+  return PS_OK;
+}
+\f
+
 /* Register that we are able to handle GNU/Linux ELF core file
    formats.  */
 
This page took 0.02846 seconds and 4 git commands to generate.