aboutsummaryrefslogtreecommitdiff
path: root/gdb/arm-linux-nat.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2006-05-30 15:57:09 +0000
committerDaniel Jacobowitz <drow@false.org>2006-05-30 15:57:09 +0000
commit9308fc88e7f28b38ac63622291a3ec853a72c1c8 (patch)
treed67f03030693a760bbcfa23ec69d35bedb9c8e56 /gdb/arm-linux-nat.c
parenteebf07fbf50f2054980133a8643ba778bf27667d (diff)
downloadgdb-9308fc88e7f28b38ac63622291a3ec853a72c1c8.zip
gdb-9308fc88e7f28b38ac63622291a3ec853a72c1c8.tar.gz
gdb-9308fc88e7f28b38ac63622291a3ec853a72c1c8.tar.bz2
gdb/
* Makefile.in (arm-linux-nat.o): Update dependencies. * arm-linux-nat.c: Include "gdb_proc_service.h". (PTRACE_GET_THREAD_AREA): Define. (ps_get_thread_area): New function. gdb/gdbserver/ * Makefile.in (linux-arm-low.o): Update dependencies. * linux-arm-low.c: Include "../gdb_proc_service.h". (PTRACE_GET_THREAD_AREA): Define. (ps_get_thread_area): New function.
Diffstat (limited to 'gdb/arm-linux-nat.c')
-rw-r--r--gdb/arm-linux-nat.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index 8023026..0cfec20 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -37,6 +37,13 @@
/* 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,