gdb/
[deliverable/binutils-gdb.git] / gdb / gdbserver / linux-arm-low.c
index b2c314fef8176b4446d70651cf48f61d9fc4465d..c01f97ad8931fe8459b9f738a9d276ebb9788295 100644 (file)
@@ -1,5 +1,6 @@
 /* GNU/Linux/ARM specific low level interface, for the remote server for GDB.
-   Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+   Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+   2006
    Free Software Foundation, Inc.
 
    This file is part of GDB.
 #include "server.h"
 #include "linux-low.h"
 
+#include <sys/ptrace.h>
+
+#include "gdb_proc_service.h"
+
+#ifndef PTRACE_GET_THREAD_AREA
+#define PTRACE_GET_THREAD_AREA 22
+#endif
+
 #ifdef HAVE_SYS_REG_H
 #include <sys/reg.h>
 #endif
@@ -105,6 +114,23 @@ arm_reinsert_addr ()
   return pc;
 }
 
+/* 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;
+}
+
 struct linux_target_ops the_low_target = {
   arm_num_regs,
   arm_regmap,
This page took 0.023964 seconds and 4 git commands to generate.