This is the mail archive of the gdb-patches@sourceware.cygnus.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]

Make threads architecture-independent on Linux


Following up on last week's discussion (that is,
http://sourceware.cygnus.com/ml/gdb-patches/1999-q4/msg00123.html and
related email), here is a patch to enable linux threads in general
rather than just on x86.  I've tested it on x86 but it should work on
all of them (famous last words :-)).

1999-11-08  Jim Kingdon  <http://developer.redhat.com/>

	Enable threads for all linux architectures:
	* config/nm-linux.h: New file.
	* config/{alpha,i386,m68k,sparc}/nm-linux.h: Use it.

--- /dev/null	Tue May  5 16:32:27 1998
+++ gdb/config/nm-linux.h	Mon Nov  1 15:33:51 1999
@@ -0,0 +1,52 @@
+/* Native support for GNU/Linux, for GDB, the GNU debugger.
+   Copyright (C) 1999
+   Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* Linux is svr4ish but not that much */
+#undef USE_PROC_FS
+
+/* Tell gdb that we can attach and detach other processes */
+#define ATTACH_DETACH
+
+/* 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
+
+/* Support for the glibc linuxthreads package. */
+
+#ifdef __STDC__
+struct objfile;
+#endif
+
+extern void
+linuxthreads_new_objfile PARAMS ((struct objfile *objfile));
+#define target_new_objfile(OBJFILE) linuxthreads_new_objfile (OBJFILE)
+
+extern char *
+linuxthreads_pid_to_str PARAMS ((int pid));
+#define target_pid_to_str(PID) linuxthreads_pid_to_str (PID)
+
+extern int
+linuxthreads_prepare_to_proceed PARAMS ((int step));
+#define PREPARE_TO_PROCEED(select_it) linuxthreads_prepare_to_proceed (1)
Index: gdb/config/alpha/nm-linux.h
===================================================================
RCS file: /cvs/gdb/gdb/gdb/config/alpha/nm-linux.h,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 nm-linux.h
--- nm-linux.h	1999/07/07 20:11:53	1.1.1.3
+++ nm-linux.h	1999/11/08 23:09:59
@@ -18,6 +18,8 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include "nm-linux.h"
+
 /* Figure out where the longjmp will land.  We expect that we have just entered
    longjmp and haven't yet setup the stack frame, so the args are still in the
    argument regs.  A0_REGNUM points at the jmp_buf structure from which we
@@ -28,13 +30,12 @@
 extern int
 get_longjmp_target PARAMS ((CORE_ADDR *));
 
-/* Tell gdb that we can attach and detach other processes */
-#define ATTACH_DETACH
-
 /* ptrace register ``addresses'' are absolute.  */
 
 #define U_REGS_OFFSET 0
 
+/* FIXME: This is probably true, or should be, on all Linux ports.
+   IA64?  Sparc64?  */
 #define PTRACE_ARG3_TYPE long
 
 /* ptrace transfers longs, the ptrace man page is lying.  */
@@ -51,10 +52,7 @@
 
 /* Support for shared libraries.  */
 
-#include "solib.h"
-
 #ifdef __ELF__
-#define SVR4_SHARED_LIBS
 #define TARGET_ELF64
 #endif
 
@@ -65,3 +63,4 @@
 /* Given a pointer to either a gregset_t or fpregset_t, return a
    pointer to the first register.  */
 #define ALPHA_REGSET_BASE(regsetp)  ((long *) (regsetp))
+
Index: gdb/config/i386/nm-linux.h
===================================================================
RCS file: /cvs/gdb/gdb/gdb/config/i386/nm-linux.h,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 nm-linux.h
--- nm-linux.h	1999/09/08 23:59:52	1.1.1.3
+++ nm-linux.h	1999/11/08 23:09:59
@@ -23,14 +23,12 @@
 #define NM_LINUX_H
 
 #include "i386/nm-i386v.h"
+#include "nm-linux.h"
 
 /* Return sizeof user struct to callers in less machine dependent routines */
 
 #define KERNEL_U_SIZE kernel_u_size()
 extern int kernel_u_size PARAMS ((void));
-
-/* Tell gdb that we can attach and detach other processes */
-#define ATTACH_DETACH
 
 #define U_REGS_OFFSET 0
 
Index: gdb/config/m68k/nm-linux.h
===================================================================
RCS file: /cvs/gdb/gdb/gdb/config/m68k/nm-linux.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 nm-linux.h
--- nm-linux.h	1999/07/07 20:14:04	1.1.1.2
+++ nm-linux.h	1999/11/08 23:10:00
@@ -21,23 +21,14 @@
 #ifndef NM_LINUX_H
 #define NM_LINUX_H
 
+#include "nm-linux.h"
+
 /* Return sizeof user struct to callers in less machine dependent routines */
 
 #define KERNEL_U_SIZE kernel_u_size()
 extern int kernel_u_size PARAMS ((void));
 
-/* Tell gdb that we can attach and detach other processes */
-#define ATTACH_DETACH
-
 #define U_REGS_OFFSET 0
-
-/* 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
 
 #define REGISTER_U_ADDR(addr, blockend, regno) \
 	(addr) = m68k_linux_register_u_addr ((blockend),(regno));
Index: gdb/config/sparc/nm-linux.h
===================================================================
RCS file: /cvs/gdb/gdb/gdb/config/sparc/nm-linux.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 nm-linux.h
--- nm-linux.h	1999/07/07 20:17:01	1.1.1.2
+++ nm-linux.h	1999/11/08 23:10:00
@@ -27,6 +27,3 @@
 
 #define KERNEL_U_SIZE kernel_u_size()
 extern int kernel_u_size PARAMS ((void));
-
-/* Linux is svr4ish but not that much */
-#undef USE_PROC_FS

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