*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / arm-linux-nat.c
index 16298cc284b8c8f8d909103079f71b3a13b8b830..0cfec203f5e46c8c86a7f3ddd35f7804d2b17102 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU/Linux on ARM native support.
-   Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005
+   Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005, 2006
    Free Software Foundation, Inc.
 
    This file is part of GDB.
 /* 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 22
+#endif
+
 extern int arm_apcs_32;
 
 #define                typeNone                0x00
@@ -694,6 +701,23 @@ arm_linux_kernel_u_size (void)
   return (sizeof (struct user));
 }
 
+/* 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 = (void *) ((char *)*base - idx);
+
+  return PS_OK;
+}
+
 static unsigned int
 get_linux_version (unsigned int *vmajor,
                   unsigned int *vminor,
@@ -736,5 +760,5 @@ _initialize_arm_linux_nat (void)
   t->to_store_registers = arm_linux_store_inferior_registers;
 
   /* Register the target.  */
-  add_target (t);
+  linux_nat_add_target (t);
 }
This page took 0.023452 seconds and 4 git commands to generate.