This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Enable new linux thread support for GNU/Linux/PPC gdb


I've committed the patches below.  They enable, for GNU/Linux/PPC, the
new Linux thread support that Mark Kettenis recently contributed.  I
also tried to enable thread support for Linux/IA-64 and Linux/ARM, but
had problems with getting the latter to work.  (On Linux/IA64, the
simple threads test program didn't even run.  I probably need to
upgrade something...)

	* ppc-linux-nat.c (fill_gregset, fill_fpregset): New functions.
	* config/powerpc/linux.mh (NATDEPFILES): Remove linux-thread.o.
	Add proc-service.o, thread-db.o, and lin-lwp.o.
	(LOADLIBES): Define.
	* config/powerpc/nm-linux.h (ATTACH_DETACH, SVR4_SHARED_LIBS):
	Remove defines which are already present in ../nm-linux.h.
	(solib.h): Don't include this file; it's already included by
	../nm-linux.h.
	(PREPARE_TO_PROCEED, GET_THREAD_SIGNALS, ATTACH_LWP): Define
	to use the following lin-lwp.c functions...
	(lin_lwp_prepare_to_proceed, lin_thread_get_thread_signals,
	lin_lwp_attach_lwp): Declare.

Index: ppc-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-linux-nat.c,v
retrieving revision 1.4
diff -u -p -r1.4 ppc-linux-nat.c
--- ppc-linux-nat.c	2000/07/30 01:48:26	1.4
+++ ppc-linux-nat.c	2000/09/18 00:39:58
@@ -71,11 +71,56 @@ supply_gregset (gregset_t * gregsetp)
 }
 
 void
+fill_gregset (gregset_t *gregsetp, int regno)
+{
+  int regi;
+  greg_t *regp = (greg_t *) gregsetp;
+
+#define COPY_REG(_idx_,_regi_) \
+  if ((regno == -1) || regno == _regi_) \
+    memcpy (regp + _idx_, &registers[REGISTER_BYTE (_regi_)], \
+	    REGISTER_RAW_SIZE (_regi_))
+
+  for (regi = 0; regi < 32; regi++)
+    {
+      COPY_REG (regmap[regi], regi);
+    }
+
+  for (regi = FIRST_UISA_SP_REGNUM; regi <= LAST_UISA_SP_REGNUM; regi++)
+    {
+      COPY_REG (regmap[regi], regi);
+    }
+}
+
+void
 supply_fpregset (fpregset_t * fpregsetp)
 {
   int regi;
   for (regi = 0; regi < 32; regi++)
     {
       supply_register (FP0_REGNUM + regi, (char *) (*fpregsetp + regi));
+    }
+}
+
+/*  Given a pointer to a floating point register set in /proc format
+   (fpregset_t *), update the register specified by REGNO from gdb's idea
+   of the current floating point register set.  If REGNO is -1, update
+   them all. */
+
+void
+fill_fpregset (fpregset_t *fpregsetp, int regno)
+{
+  int regi;
+  char *to;
+  char *from;
+  
+  for (regi = 0; regi < 32; regi++)
+    {
+      if ((regno == -1) || (regno == FP0_REGNUM + regi))
+        {
+	  from = (char *) &registers[REGISTER_BYTE (FP0_REGNUM + regi)];
+	  to = (char *) (*fpregsetp + regi);
+	  memcpy (to, from, REGISTER_RAW_SIZE (FP0_REGNUM + regi));
+        }
     }
 }
Index: config/powerpc/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/powerpc/linux.mh,v
retrieving revision 1.3
diff -u -p -r1.3 linux.mh
--- config/powerpc/linux.mh	2000/06/12 06:09:05	1.3
+++ config/powerpc/linux.mh	2000/09/18 00:39:58
@@ -5,6 +5,9 @@ XDEPFILES=
 XM_CLIBS=
 
 NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o core-aout.o core-regset.o ppc-linux-nat.o linux-thread.o
+NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o \
+core-aout.o core-regset.o ppc-linux-nat.o proc-service.o thread-db.o lin-lwp.o
+
+LOADLIBES = -ldl -rdynamic
 
 GDBSERVER_DEPFILES= low-linux.o
Index: config/powerpc/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/powerpc/nm-linux.h,v
retrieving revision 1.3
diff -u -p -r1.3 nm-linux.h
--- config/powerpc/nm-linux.h	2000/05/28 01:12:37	1.3
+++ config/powerpc/nm-linux.h	2000/09/18 00:39:58
@@ -28,9 +28,6 @@ Foundation, Inc., 675 Mass Ave, Cambridg
 #define KERNEL_U_SIZE kernel_u_size()
 extern int kernel_u_size (void);
 
-/* Tell gdb that we can attach and detach other processes */
-#define ATTACH_DETACH
-
 #define U_REGS_OFFSET 0
 
 #define REGISTER_U_ADDR(addr, blockend, regno) \
@@ -39,26 +36,21 @@ extern int kernel_u_size (void);
 /* No <sys/reg.h> */
 
 #define NO_SYS_REG_H
-
-#ifdef HAVE_LINK_H
-#include "solib.h"             /* Support for shared libraries. */
-#define SVR4_SHARED_LIBS
-#endif
-
-/* Support for Linuxthreads. */
 
-#ifdef __STDC__
-struct objfile;
-#endif
+/* FIXME: kettenis/2000-09-03: This should be moved to ../nm-linux.h
+   once we have converted all Linux targets to use the new threads
+   stuff (without the #undef of course).  */
 
-extern void linuxthreads_new_objfile (struct objfile *objfile);
-#define target_new_objfile(OBJFILE) linuxthreads_new_objfile (OBJFILE)
+extern int lin_lwp_prepare_to_proceed (void);
+#undef PREPARE_TO_PROCEED
+#define PREPARE_TO_PROCEED(select_it) lin_lwp_prepare_to_proceed ()
 
-extern char *linuxthreads_pid_to_str (int pid);
-#define target_pid_to_str(PID) linuxthreads_pid_to_str (PID)
+extern void lin_lwp_attach_lwp (int pid, int verbose);
+#define ATTACH_LWP(pid, verbose) lin_lwp_attach_lwp ((pid), (verbose))
 
-extern int linuxthreads_prepare_to_proceed (int step);
-#define PREPARE_TO_PROCEED(select_it) linuxthreads_prepare_to_proceed (1)
+#include <signal.h>
 
+extern void lin_thread_get_thread_signals (sigset_t *mask);
+#define GET_THREAD_SIGNALS(mask) lin_thread_get_thread_signals (mask)
 
 #endif /* #ifndef NM_LINUX_H */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]