[PATCH] Use new threads support for all Linuxen

Mark Kettenis kettenis@wins.uva.nl
Sun Oct 14 13:48:00 GMT 2001


Since the reactions were so positive, I went ahead and checked in the
attached.  Tested in i386-pc-linux-gnu.  Native sparc-linux is now
definitely broken.  Native sparc64-linux was already broken.  Native
m68k-linux should be OK.

Mark


2001-10-14  Mark Kettenis  <kettenis@gnu.org>

	* config/nm-linux.h (struct objfile): Remove forward declaration.
	(linuxthreads_new_objfile): Remove prototype.
	(linuxthreads_pid_to_str): Remove prototype.
	(PREPARE_TO_PROCEED): Redefine in terms of
	lin_lwp_prepare_to_proceed.
	(struct target_waitstatus): Forward declaration.
	(child_wait): New prototype.
	(CHILD_WAIT): Define.
	(lin_lwp_attach_lwp, ATTACH_LWP, lin_thread_get_thread_signals,
	GET_THREAD_SIGNAL): Moved here from arch-specific files.
	* config/alpha/nm-linux.h, config/arm/nm-linux.h,
	config/ia64/nm-linux.h, config/mips/nm-linux.h,
	config/powerpc/nm-linux.h: Don't include <signal.h>.
	(lin_lwp_attach_lwp, ATTACH_LWP, lin_thread_get_thread_signals,
	GET_THREAD_SIGNAL): Remove.
	* config/i386/nm-linux.h: Likewise.
	(struct target_waitstatus, child_wait, CHILD_WAIT): Remove.
	* config/m68k/linux.mh, config/sparc/linux.mh (NATDEPFILES):
	Remove linux-thread.o.  Add proc-service.o, thread-db.o and
	lin-lwp.o.
	(LOADLIBES): New variable.

Index: config/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/nm-linux.h,v
retrieving revision 1.9
diff -u -p -r1.9 nm-linux.h
--- config/nm-linux.h 2001/07/11 10:03:32 1.9
+++ config/nm-linux.h 2001/10/14 19:32:16
@@ -25,6 +25,16 @@
 /* Tell GDB that we can attach and detach other processes.  */
 #define ATTACH_DETACH
 
+/* Since we're building a native debugger, we can include <signal.h>
+   to find the range of real-time signals.  */
+
+#include <signal.h>
+
+#ifdef __SIGRTMIN
+#define REALTIME_LO	__SIGRTMIN
+#define REALTIME_HI	(__SIGRTMAX + 1)
+#endif
+
 /* We define this if link.h is available, because with ELF we use SVR4
    style shared libraries.  */
 
@@ -33,39 +43,27 @@
 #include "solib.h"             /* Support for shared libraries.  */
 #endif
 
-
-/* FIXME: kettenis/2001-07-11: Stuff on this page is obsolete, and
-   only used by the (unmaintained) sparc and m68k ports.  */
-
-/* Support for the glibc LinuxThreads package.  */
 
-struct objfile;
+/* Override child_wait in `inftarg.c'.  */
+struct target_waitstatus;
+extern ptid_t child_wait (ptid_t ptid, struct target_waitstatus *ourstatus);
+#define CHILD_WAIT
 
-/* Hook to look at new objfiles (shared libraries).  */
-extern void linuxthreads_new_objfile (struct objfile *objfile);
+extern int lin_lwp_prepare_to_proceed (void);
+#define PREPARE_TO_PROCEED(select_it) lin_lwp_prepare_to_proceed ()
 
-/* Method to print a human-readable thread description.  */
-extern char *linuxthreads_pid_to_str (ptid_t ptid);
+extern void lin_lwp_attach_lwp (ptid_t ptid, int verbose);
+#define ATTACH_LWP(ptid, verbose) lin_lwp_attach_lwp ((ptid), (verbose))
 
-extern int linuxthreads_prepare_to_proceed (int step);
-#define PREPARE_TO_PROCEED(select_it) linuxthreads_prepare_to_proceed (1)
-
+extern void lin_thread_get_thread_signals (sigset_t *mask);
+#define GET_THREAD_SIGNALS(mask) lin_thread_get_thread_signals (mask)
 
 /* Defined to make stepping-over-breakpoints be thread-atomic.  */
 #define USE_THREAD_STEP_NEEDED 1
+
 
 /* Use elf_gregset_t and elf_fpregset_t, rather than
    gregset_t and fpregset_t.  */
 
 #define GDB_GREGSET_T  elf_gregset_t
 #define GDB_FPREGSET_T elf_fpregset_t
-
-/* Since we're building a native debugger, we can include <signal.h>
-   to find the range of real-time signals.  */
-
-#include <signal.h>
-
-#ifdef __SIGRTMIN
-#define REALTIME_LO	__SIGRTMIN
-#define REALTIME_HI	(__SIGRTMAX + 1)
-#endif
Index: config/alpha/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/alpha/nm-linux.h,v
retrieving revision 1.6
diff -u -p -r1.6 nm-linux.h
--- config/alpha/nm-linux.h 2001/07/11 10:33:29 1.6
+++ config/alpha/nm-linux.h 2001/10/14 19:32:16
@@ -57,20 +57,4 @@ extern int get_longjmp_target (CORE_ADDR
    pointer to the first register.  */
 #define ALPHA_REGSET_BASE(regsetp)  ((long *) (regsetp))
 
-/* 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 int lin_lwp_prepare_to_proceed (void);
-#undef PREPARE_TO_PROCEED
-#define PREPARE_TO_PROCEED(select_it) lin_lwp_prepare_to_proceed ()
-
-extern void lin_lwp_attach_lwp (ptid_t pid, int verbose);
-#define ATTACH_LWP(ptid, verbose) lin_lwp_attach_lwp ((ptid), (verbose))
-
-#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 /* NM_LINUX_H */
Index: config/arm/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/arm/nm-linux.h,v
retrieving revision 1.5
diff -u -p -r1.5 nm-linux.h
--- config/arm/nm-linux.h 2001/05/04 04:15:30 1.5
+++ config/arm/nm-linux.h 2001/10/14 19:32:16
@@ -30,20 +30,4 @@ extern int kernel_u_size (void);
 /* Override copies of {fetch,store}_inferior_registers in infptrace.c.  */
 #define FETCH_INFERIOR_REGISTERS
 
-/* 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 int lin_lwp_prepare_to_proceed (void);
-#undef PREPARE_TO_PROCEED
-#define PREPARE_TO_PROCEED(select_it) lin_lwp_prepare_to_proceed ()
-
-extern void lin_lwp_attach_lwp (ptid_t ptid, int verbose);
-#define ATTACH_LWP(ptid, verbose) lin_lwp_attach_lwp ((ptid), (verbose))
-
-#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 /* NM_ARMLINUX_H */
Index: config/i386/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-linux.h,v
retrieving revision 1.14
diff -u -p -r1.14 nm-linux.h
--- config/i386/nm-linux.h 2001/10/14 11:30:37 1.14
+++ config/i386/nm-linux.h 2001/10/14 19:32:16
@@ -63,15 +63,8 @@ extern void i386_linux_dr_reset_addr (in
 extern unsigned long i386_linux_dr_get_status (void);
 #define I386_DR_LOW_GET_STATUS() \
   i386_linux_dr_get_status ()
+
 
-/* We define this if link.h is available, because with ELF we use SVR4
-   style shared libraries.  */
-
-#ifdef HAVE_LINK_H
-#define SVR4_SHARED_LIBS
-#include "solib.h"		/* Support for shared libraries.  */
-#endif
-
 /* Override copies of {fetch,store}_inferior_registers in `infptrace.c'.  */
 #define FETCH_INFERIOR_REGISTERS
 
@@ -86,26 +79,5 @@ extern int cannot_store_register (int re
 
 /* Override child_resume in `infptrace.c'.  */
 #define CHILD_RESUME
-
-/* Override child_wait in `inftarg.c'.  */
-struct target_waitstatus;
-extern ptid_t child_wait (ptid_t ptid, struct target_waitstatus *ourstatus);
-#define CHILD_WAIT
-
-/* 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 int lin_lwp_prepare_to_proceed (void);
-#undef PREPARE_TO_PROCEED
-#define PREPARE_TO_PROCEED(select_it) lin_lwp_prepare_to_proceed ()
-
-extern void lin_lwp_attach_lwp (ptid_t ptid, int verbose);
-#define ATTACH_LWP(ptid, verbose) lin_lwp_attach_lwp ((ptid), (verbose))
-
-#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 /* nm_linux.h */
+#endif /* nm-linux.h */
Index: config/ia64/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/ia64/nm-linux.h,v
retrieving revision 1.7
diff -u -p -r1.7 nm-linux.h
--- config/ia64/nm-linux.h 2001/05/04 04:15:31 1.7
+++ config/ia64/nm-linux.h 2001/10/14 19:32:16
@@ -76,20 +76,4 @@ extern int ia64_linux_insert_watchpoint 
 extern int ia64_linux_remove_watchpoint (ptid_t ptid, CORE_ADDR addr,
                                          int len);
 
-/* 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 int lin_lwp_prepare_to_proceed (void);
-#undef PREPARE_TO_PROCEED
-#define PREPARE_TO_PROCEED(select_it) lin_lwp_prepare_to_proceed ()
-
-extern void lin_lwp_attach_lwp (ptid_t ptid, int verbose);
-#define ATTACH_LWP(ptid, verbose) lin_lwp_attach_lwp ((ptid), (verbose))
-
-#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: config/m68k/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/m68k/linux.mh,v
retrieving revision 1.5
diff -u -p -r1.5 linux.mh
--- config/m68k/linux.mh 2001/07/11 18:39:12 1.5
+++ config/m68k/linux.mh 2001/10/14 19:32:16
@@ -1,10 +1,15 @@
-# Host: Motorola m68k running Linux
+# Host: Motorola m68k running GNU/Linux.
 
 XM_FILE= xm-linux.h
 XDEPFILES=
 
 NAT_FILE= nm-linux.h
 NATDEPFILES= infptrace.o inftarg.o fork-child.o \
-	corelow.o core-aout.o m68klinux-nat.o linux-thread.o
+	corelow.o core-aout.o m68klinux-nat.o \
+	proc-service.o thread-db.o lin-lwp.o
+
+# The dynamically loaded libthread_db needs access to symbols in the
+# gdb executable.
+LOADLIBES = -ldl -rdynamic
 
 GDBSERVER_DEPFILES= low-linux.o
Index: config/mips/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/nm-linux.h,v
retrieving revision 1.1
diff -u -p -r1.1 nm-linux.h
--- config/mips/nm-linux.h 2001/07/10 20:41:54 1.1
+++ config/mips/nm-linux.h 2001/10/14 19:32:16
@@ -47,20 +47,4 @@ int mips_linux_cannot_store_register (in
 #define CANNOT_FETCH_REGISTER(regno) mips_linux_cannot_fetch_register (regno)
 #define CANNOT_STORE_REGISTER(regno) mips_linux_cannot_store_register (regno)
 
-/* FIXME: 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 int lin_lwp_prepare_to_proceed (void);
-#undef PREPARE_TO_PROCEED
-#define PREPARE_TO_PROCEED(select_it) lin_lwp_prepare_to_proceed ()
-
-extern void lin_lwp_attach_lwp (ptid_t ptid, int verbose);
-#define ATTACH_LWP(ptid, verbose) lin_lwp_attach_lwp ((ptid), (verbose))
-
-#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 /* NM_MIPSLINUX_H */
Index: config/powerpc/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/powerpc/nm-linux.h,v
retrieving revision 1.7
diff -u -p -r1.7 nm-linux.h
--- config/powerpc/nm-linux.h 2001/07/11 10:24:35 1.7
+++ config/powerpc/nm-linux.h 2001/10/14 19:32:16
@@ -33,20 +33,4 @@ extern int kernel_u_size (void);
 #define REGISTER_U_ADDR(addr, blockend, regno) \
         (addr) = ppc_register_u_addr ((blockend),(regno));
 
-/* 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 int lin_lwp_prepare_to_proceed (void);
-#undef PREPARE_TO_PROCEED
-#define PREPARE_TO_PROCEED(select_it) lin_lwp_prepare_to_proceed ()
-
-extern void lin_lwp_attach_lwp (ptid_t ptid, int verbose);
-#define ATTACH_LWP(ptid, verbose) lin_lwp_attach_lwp ((ptid), (verbose))
-
-#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: config/sparc/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/linux.mh,v
retrieving revision 1.2
diff -u -p -r1.2 linux.mh
--- config/sparc/linux.mh 2000/06/12 06:09:05 1.2
+++ config/sparc/linux.mh 2001/10/14 19:32:16
@@ -1,8 +1,15 @@
-# Host: Sparcstation, running Linux
-XDEPFILES=
+# Host: Sparcstation, running GNU/Linux.
+
 XM_FILE= xm-linux.h
+XDEPFILES=
+
 NAT_FILE= nm-linux.h
 NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o \
-	linux-thread.o
+	proc-service.o thread-db.o lin-lwp.o
+
+# The dynamically loaded libthread_db needs access to symbols in the
+# gdb executable.
+LOADLIBES = -ldl -rdynamic
+
 HOST_IPC=-DBSD_IPC
 GDBSERVER_DEPFILES= low-sparc.o



More information about the Gdb-patches mailing list