summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jacobowitz <dan@debian.org>2005-03-25 22:20:48 +0000
committerDaniel Jacobowitz <dan@debian.org>2005-03-25 22:20:48 +0000
commit00060a40169b0a7b3ce95d711eaefd3b884ec143 (patch)
tree4e04700b49098f09584bc3d3c818318d07eb85c8
parenta4cb8d1b61965e487dfca5471fdf56cf94634452 (diff)
downloadgdb-00060a40169b0a7b3ce95d711eaefd3b884ec143.tar.gz
* gdb/Makefile.in (arm-linux-nat.o): Update dependencies.
* gdb/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. * gdb/gdbserver/linux-arm-low.c: Include "../gdb_proc_service.h". (PTRACE_GET_THREAD_AREA): Define. (ps_get_thread_area): New function.
-rw-r--r--ChangeLog.csl12
-rw-r--r--gdb/Makefile.in3
-rw-r--r--gdb/arm-linux-nat.c24
-rw-r--r--gdb/gdbserver/Makefile.in5
-rw-r--r--gdb/gdbserver/linux-arm-low.c39
5 files changed, 79 insertions, 4 deletions
diff --git a/ChangeLog.csl b/ChangeLog.csl
index fa7a530a178..d7751c23654 100644
--- a/ChangeLog.csl
+++ b/ChangeLog.csl
@@ -1,3 +1,15 @@
+2005-03-25 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * gdb/Makefile.in (arm-linux-nat.o): Update dependencies.
+ * gdb/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.
+ * gdb/gdbserver/linux-arm-low.c: Include "../gdb_proc_service.h".
+ (PTRACE_GET_THREAD_AREA): Define.
+ (ps_get_thread_area): New function.
+
2005-03-25 Paul Brook <paul@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index d008e48f33a..56a2c850f13 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1730,7 +1730,8 @@ arch-utils.o: arch-utils.c $(defs_h) $(arch_utils_h) $(buildsym_h) \
$(gdb_assert_h) $(sim_regno_h) $(gdbcore_h) $(osabi_h) $(version_h) \
$(floatformat_h)
arm-linux-nat.o: arm-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
- $(gdb_string_h) $(regcache_h) $(arm_tdep_h) $(gregset_h)
+ $(gdb_string_h) $(regcache_h) $(arm_tdep_h) $(gregset_h)\
+ $(gdb_proc_service_h)
arm-linux-tdep.o: arm-linux-tdep.c $(defs_h) $(target_h) $(value_h) \
$(gdbtypes_h) $(floatformat_h) $(gdbcore_h) $(frame_h) $(regcache_h) \
$(doublest_h) $(solib_svr4_h) $(osabi_h) $(arm_tdep_h) \
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index 8059af6c052..0d5f072fe78 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -34,6 +34,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
@@ -691,6 +698,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,
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index b18f5869152..aa7877e3b4b 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.
@@ -260,7 +260,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-i386-low.o: linux-i386-low.c $(linux_low_h) $(server_h)
linux-ia64-low.o: linux-ia64-low.c $(linux_low_h) $(server_h)
linux-mips-low.o: linux-mips-low.c $(linux_low_h) $(server_h)
diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
index f091a3dccc3..75ebbd6e3c6 100644
--- a/gdb/gdbserver/linux-arm-low.c
+++ b/gdb/gdbserver/linux-arm-low.c
@@ -1,5 +1,5 @@
/* GNU/Linux/ARM specific low level interface, for the remote server for GDB.
- Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GDB.
@@ -22,6 +22,26 @@
#include "server.h"
#include "linux-low.h"
+#include <sys/ptrace.h>
+
+/* Correct for all GNU/Linux targets (for quite some time). */
+#define GDB_GREGSET_T elf_gregset_t
+#define GDB_FPREGSET_T elf_fpregset_t
+
+#ifndef HAVE_ELF_FPREGSET_T
+/* Make sure we have said types. Not all platforms bring in <linux/elf.h>
+ via <sys/procfs.h>. */
+#ifdef HAVE_LINUX_ELF_H
+#include <linux/elf.h>
+#endif
+#endif
+
+#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
@@ -95,6 +115,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,