diff options
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r-- | gdb/gdbserver/Makefile.in | 5 | ||||
-rw-r--r-- | gdb/gdbserver/linux-arm-low.c | 23 |
2 files changed, 26 insertions, 2 deletions
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in index 830f6f6ee99..baa36059773 100644 --- a/gdb/gdbserver/Makefile.in +++ b/gdb/gdbserver/Makefile.in @@ -1,5 +1,5 @@ # Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -# 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. # This file is part of GDB. @@ -264,7 +264,8 @@ linux_low_h = $(srcdir)/linux-low.h linux-low.o: linux-low.c $(linux_low_h) $(server_h) $(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< @USE_THREAD_DB@ -linux-arm-low.o: linux-arm-low.c $(linux_low_h) $(server_h) +linux-arm-low.o: linux-arm-low.c $(linux_low_h) $(server_h) \ + $(gdb_proc_service_h) linux-cris-low.o: linux-cris-low.c $(linux_low_h) $(server_h) linux-crisv32-low.o: linux-crisv32-low.c $(linux_low_h) $(server_h) linux-i386-low.o: linux-i386-low.c $(linux_low_h) $(server_h) diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c index 7c23b17789a..2cbccd9af52 100644 --- a/gdb/gdbserver/linux-arm-low.c +++ b/gdb/gdbserver/linux-arm-low.c @@ -22,6 +22,12 @@ #include "server.h" #include "linux-low.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 @@ -94,6 +100,23 @@ arm_reinsert_addr () collect_register_by_name ("lr", &pc); 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, |