aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2006-03-15 16:08:24 +0000
committerDaniel Jacobowitz <drow@false.org>2006-03-15 16:08:24 +0000
commitdc60ece87d8448b8d6f37411daefabbd830c20d5 (patch)
treed5486fe83a5593bc582e54582e640c883905ca28 /gdb
parent7123df0e8094827978ce5f0cebc67e5d58bdc053 (diff)
downloadgdb-dc60ece87d8448b8d6f37411daefabbd830c20d5.zip
gdb-dc60ece87d8448b8d6f37411daefabbd830c20d5.tar.gz
gdb-dc60ece87d8448b8d6f37411daefabbd830c20d5.tar.bz2
* mips-linux-nat.c: Include "gdb_proc_service.h".
(PTRACE_GET_THREAD_AREA): Define. (ps_get_thread_area): New. * Makefile.in (mips-linux-nat.o): Update.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/Makefile.in2
-rw-r--r--gdb/mips-linux-nat.c26
3 files changed, 33 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 44f5ea4..826678c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2006-03-15 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * mips-linux-nat.c: Include "gdb_proc_service.h".
+ (PTRACE_GET_THREAD_AREA): Define.
+ (ps_get_thread_area): New.
+ * Makefile.in (mips-linux-nat.o): Update.
+
2006-03-13 Jim Blandy <jimb@codesourcery.com>
* MAINTAINERS: Use my work address.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index d5abb4f..74bdf0b 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2295,7 +2295,7 @@ mips64obsd-tdep.o: mips64obsd-tdep.c $(defs_h) $(osabi_h) $(regcache_h) \
$(gdb_string_h) $(mips_tdep_h) $(solib_svr4_h)
mips-irix-tdep.o: mips-irix-tdep.c $(defs_h) $(osabi_h) $(elf_bfd_h)
mips-linux-nat.o: mips-linux-nat.c $(defs_h) $(mips_tdep_h) $(target_h) \
- $(linux_nat_h)
+ $(linux_nat_h) $(gdb_proc_service_h)
mips-linux-tdep.o: mips-linux-tdep.c $(defs_h) $(gdbcore_h) $(target_h) \
$(solib_svr4_h) $(osabi_h) $(mips_tdep_h) $(gdb_string_h) \
$(gdb_assert_h) $(frame_h) $(regcache_h) $(trad_frame_h) \
diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
index 0d581d1..1f18771 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -1,6 +1,7 @@
/* Native-dependent code for GNU/Linux on MIPS processors.
- Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -24,6 +25,12 @@
#include "target.h"
#include "linux-nat.h"
+#include "gdb_proc_service.h"
+
+#ifndef PTRACE_GET_THREAD_AREA
+#define PTRACE_GET_THREAD_AREA 25
+#endif
+
/* Pseudo registers can not be read. ptrace does not provide a way to
read (or set) MIPS_PS_REGNUM, and there's no point in reading or
setting MIPS_ZERO_REGNUM. We also can not set BADVADDR, CAUSE, or
@@ -65,6 +72,23 @@ mips_linux_cannot_store_register (int regno)
return 1;
}
+/* 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;
+}
+
void _initialize_mips_linux_nat (void);
void