]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2005-03-25 Daniel Jacobowitz <dan@codesourcery.com>
authorPaul Brook <paul@codesourcery.com>
Thu, 20 Oct 2005 03:34:53 +0000 (03:34 +0000)
committerPaul Brook <paul@codesourcery.com>
Thu, 20 Oct 2005 03:34:53 +0000 (03:34 +0000)
* 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.

ChangeLog.csl
gdb/Makefile.in
gdb/arm-linux-nat.c
gdb/gdbserver/Makefile.in
gdb/gdbserver/linux-arm-low.c

index d4bf69d58833d7a5a8400e4b4f33ba51e0028f91..23422c9acc9d63a59d9d02cd995a0eb52527f6ed 100644 (file)
@@ -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  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * gdb/elfread.c (elf_symtab_read): Skip symbols which BFD considers
index 02eaa44d4fd2a5f806f4054dfa62ef7e5201c421..02bfcef36c120af721211ac26626002b0659ab9f 100644 (file)
@@ -1734,7 +1734,7 @@ arch-utils.o: arch-utils.c $(defs_h) $(arch_utils_h) $(buildsym_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) \
-       $(target_h) $(linux_nat_h)
+       $(target_h) $(linux_nat_h) $(gdb_proc_service_h) $(gdb_assert_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) \
index 84aaaf6b4e897fea8bc6dc539afa73df9357a6b7..c29c783074dee581649e89ec926343046cfbb36f 100644 (file)
 /* 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
@@ -95,7 +102,7 @@ get_thread_id (ptid_t ptid)
     tid = PIDGET (ptid);
   return tid;
 }
-#define GET_THREAD_ID(PTID)    get_thread_id ((PTID));
+#define GET_THREAD_ID(PTID)    get_thread_id (PTID)
 
 static void
 fetch_nwfpe_single (unsigned int fn, FPA11 * fpa11)
@@ -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,
index 830f6f6ee99562ca486a32d19a3315a66f8571ff..baa360597731ffb08b72b0c85dd523f601fa944b 100644 (file)
@@ -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)
index 7c23b17789ad0c0f9622d6db2468687da353870e..2cbccd9af525b629ee996371179a5217a4c59d2d 100644 (file)
 #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,