aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/linux-mips-low.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2006-03-15 16:26:02 +0000
committerDaniel Jacobowitz <drow@false.org>2006-03-15 16:26:02 +0000
commit21b0f40c16c85360417cfb1826348104ebd2f65e (patch)
treee178718057a4b909e12c7100e9a0ac85a3562002 /gdb/gdbserver/linux-mips-low.c
parent0050a760a7646cdfb63a4c693fca974459776909 (diff)
downloadgdb-21b0f40c16c85360417cfb1826348104ebd2f65e.zip
gdb-21b0f40c16c85360417cfb1826348104ebd2f65e.tar.gz
gdb-21b0f40c16c85360417cfb1826348104ebd2f65e.tar.bz2
* linux-mips-low.c: Include <sys/ptrace.h> and "gdb_proc_service.h".
(PTRACE_GET_THREAD_AREA): Define. (ps_get_thread_area): New function. * Makefile.in (linux-i386-low.o, linux-mips-low.o) (linux-x86-64-low.o): Update.
Diffstat (limited to 'gdb/gdbserver/linux-mips-low.c')
-rw-r--r--gdb/gdbserver/linux-mips-low.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c
index 695bd29..7829550 100644
--- a/gdb/gdbserver/linux-mips-low.c
+++ b/gdb/gdbserver/linux-mips-low.c
@@ -1,5 +1,5 @@
/* GNU/Linux/MIPS specific low level interface, for the remote server for GDB.
- Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2005
+ Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2005, 2006
Free Software Foundation, Inc.
This file is part of GDB.
@@ -22,6 +22,14 @@
#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 25
+#endif
+
#ifdef HAVE_SYS_REG_H
#include <sys/reg.h>
#endif
@@ -140,6 +148,23 @@ mips_breakpoint_at (CORE_ADDR where)
return 0;
}
+/* 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 = {
mips_num_regs,
mips_regmap,