Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Re: Make threads architecture-independent on Linux
       [not found] <19991110234852.420C61B493@ocean.lucon.org>
@ 1999-11-12 10:58 ` Jim Kingdon
  1999-11-19 13:35   ` Jim Blandy
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Kingdon @ 1999-11-12 10:58 UTC (permalink / raw)
  To: hjl; +Cc: gdb-patches

> You should have config/tm-linux.h enclosed here and modify all the
> Linux tm files to include it. Otherwise, linuxthreads won't work
> right if REALTIME_HI and REALTIME_LO are not correct.

Ouch.  Thanks for pointing this out.  I've fixed that and another
problem and here's another try (this time I tested it on alpha as well
as x86).

To apply, cd to the gdb/gdb directory and run
  patch -p 1 <this-message

> My gdb tree is a mess. I don't have the time to clean it up.

Don't worry about it - we'll get there one way or another.

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.
	* config/tm-linux.h: New file.
	* config/{i386,m68k,sparc}/tm-linux.h,
	config/alpha/tm-alphalinux.h: Use it.
	* config/{m68k,sparc}/linux.mh, config/alpha/alpha-linux.mh:
	Add linux-thread.o.

--- /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
--- gdb/config/alpha/nm-linux.h  1999/07/07 20:11:53     1.1.1.3
+++ gdb/config/alpha/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
--- gdb/config/i386/nm-linux.h  1999/09/08 23:59:52     1.1.1.3
+++ gdb/config/i386/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
--- gdb/config/m68k/nm-linux.h  1999/07/07 20:14:04     1.1.1.2
+++ gdb/config/m68k/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
--- gdb/config/sparc/nm-linux.h  1999/07/07 20:17:01     1.1.1.2
+++ gdb/config/sparc/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: sparc/tm-linux.h
===================================================================
RCS file: /cvs/gdb/gdb/gdb/config/sparc/tm-linux.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 tm-linux.h
--- tm-linux.h	1999/07/07 20:17:06	1.1.1.2
+++ gdb/config/sparc/tm-linux.h	1999/11/12 13:35:58
@@ -25,6 +25,6 @@
 
 #define SIGCONTEXT_PC_OFFSET 12
 
-#include "tm-sysv4.h"
+#include "tm-linux.h"
 
 #endif /* TM_SPARCLINUX_H */
Index: m68k/tm-linux.h
===================================================================
RCS file: /cvs/gdb/gdb/gdb/config/m68k/tm-linux.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 tm-linux.h
--- tm-linux.h	1999/07/07 20:14:22	1.1.1.2
+++ gdb/config/m68k/tm-linux.h	1999/11/12 13:36:01
@@ -72,7 +72,7 @@
     }									\
 }
 
-#include "tm-sysv4.h"
+#include "tm-linux.h"
 #include "m68k/tm-m68k.h"
 
 /* Extract from an array REGBUF containing the (raw) register state
Index: i386/tm-linux.h
===================================================================
RCS file: /cvs/gdb/gdb/gdb/config/i386/tm-linux.h,v
retrieving revision 1.1.1.7
diff -u -r1.1.1.7 tm-linux.h
--- tm-linux.h	1999/11/02 04:44:22	1.1.1.7
+++ gdb/config/i386/tm-linux.h	1999/11/12 13:36:03
@@ -28,6 +28,7 @@
 #endif
 
 #include "i386/tm-i386.h"
+#include "tm-linux.h"
 
 /* Size of sigcontext, from <asm/sigcontext.h>.  */
 #define LINUX_SIGCONTEXT_SIZE (88)
@@ -38,10 +39,6 @@
 /* Offset to saved SP in sigcontext, from <asm/sigcontext.h>.  */
 #define LINUX_SIGCONTEXT_SP_OFFSET (28)
 
-/* We need this file for the SOLIB_TRAMPOLINE stuff. */
-
-#include "tm-sysv4.h"
-
 #define LOW_RETURN_REGNUM 0	/* holds low four bytes of result */
 #define HIGH_RETURN_REGNUM 2	/* holds high four bytes of result */
 
@@ -166,18 +163,6 @@
       : read_memory_integer ((FRAME)->frame + 4, 4)))
 
 extern CORE_ADDR i386_linux_sigtramp_saved_sp PARAMS ((struct frame_info *));
-
-/* Some versions of Linux have real-time signal support in the C library, and
-   some don't.  We have to include this file to find out.  */
-#include <signal.h>
-
-#ifdef __SIGRTMIN
-#define REALTIME_LO __SIGRTMIN
-#define REALTIME_HI (__SIGRTMAX + 1)
-#else
-#define REALTIME_LO 32
-#define REALTIME_HI 64
-#endif
 
 /* When we call a function in a shared library, and the PLT sends us
    into the dynamic linker to find the function's real address, we
Index: alpha/tm-alphalinux.h
===================================================================
RCS file: /cvs/gdb/gdb/gdb/config/alpha/tm-alphalinux.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 tm-alphalinux.h
--- tm-alphalinux.h	1999/07/07 20:11:59	1.1.1.2
+++ gdb/config/alpha/tm-alphalinux.h	1999/11/12 13:36:05
@@ -75,7 +75,6 @@
 #undef FRAME_PAST_SIGTRAMP_FRAME
 #define FRAME_PAST_SIGTRAMP_FRAME(frame, pc)	(0)
 
-/* We need this for the SOLIB_TRAMPOLINE stuff.  */
-#include "tm-sysv4.h"
+#include "tm-linux.h"
 
 #endif /* TM_LINUXALPHA_H */
--- /dev/null	Tue May  5 16:32:27 1998
+++ gdb/config/tm-linux.h	Thu Nov 11 21:51:21 1999
@@ -0,0 +1,36 @@
+/* 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.  */
+
+/* Some versions of Linux have real-time signal support in the C library, and
+   some don't.  We have to include this file to find out.  */
+#include <signal.h>
+
+#ifdef __SIGRTMIN
+#define REALTIME_LO __SIGRTMIN
+#define REALTIME_HI (__SIGRTMAX + 1)
+#else
+#define REALTIME_LO 32
+#define REALTIME_HI 64
+#endif
+
+/* We need this file for the SOLIB_TRAMPOLINE stuff. */
+
+#include "tm-sysv4.h"
Index: gdb/config/alpha/alpha-linux.mh
===================================================================
RCS file: /cvs/gdb/gdb/gdb/config/alpha/alpha-linux.mh,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 alpha-linux.mh
--- alpha-linux.mh	1999/04/16 01:34:14	1.1.1.1
+++ gdb/config/alpha/alpha-linux.mh	1999/11/12 17:54:12
@@ -3,7 +3,7 @@
 XM_FILE= xm-alphalinux.h
 NAT_FILE= nm-linux.h
 NATDEPFILES= infptrace.o inftarg.o corelow.o core-regset.o alpha-nat.o \
-	fork-child.o solib.o
+	fork-child.o solib.o linux-thread.o
 
 MMALLOC = 
 MMALLOC_CFLAGS = -DNO_MMALLOC 
Index: gdb/config/sparc/linux.mh
===================================================================
RCS file: /cvs/gdb/gdb/gdb/config/sparc/linux.mh,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 linux.mh
--- linux.mh	1999/04/16 01:34:25	1.1.1.1
+++ gdb/config/sparc/linux.mh	1999/11/12 17:54:12
@@ -2,6 +2,7 @@
 XDEPFILES= ser-tcp.o
 XM_FILE= xm-linux.h
 NAT_FILE= nm-linux.h
-NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o
+NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o \
+	linux-thread.o
 HOST_IPC=-DBSD_IPC
 GDBSERVER_DEPFILES= low-sparc.o
Index: gdb/config/m68k/linux.mh
===================================================================
RCS file: /cvs/gdb/gdb/gdb/config/m68k/linux.mh,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 linux.mh
--- linux.mh	1999/04/16 01:34:21	1.1.1.1
+++ gdb/config/m68k/linux.mh	1999/11/12 17:54:12
@@ -4,6 +4,7 @@
 XDEPFILES= ser-tcp.o
 
 NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o core-aout.o core-regset.o m68klinux-nat.o
+NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o \
+	corelow.o core-aout.o core-regset.o m68klinux-nat.o linux-thread.o
 
 GDBSERVER_DEPFILES= low-linux.o
From jtc@redback.com Fri Nov 12 11:56:00 1999
From: jtc@redback.com (J.T. Conklin)
To: gdb-patches@sourceware.cygnus.com
Subject: fp update for embedded x86 config 
Date: Fri, 12 Nov 1999 11:56:00 -0000
Message-id: <5m7ljntrg9.fsf@jtc.redbacknetworks.com>
X-SW-Source: 1999-q4/msg00249.html
Content-length: 2218

1999-11-12  J.T. Conklin  <jtc@redback.com>

	* config/i386/tm-embed.h: New file.
	* config/i386/embed.mt: Updated to use tm-embed.h.

Index: gdb/gdb/config/i386/embed.mt
diff -c gdb/gdb/config/i386/embed.mt:1.1.1.1 gdb/gdb/config/i386/embed.mt:1.2
*** gdb/gdb/config/i386/embed.mt:1.1.1.1	Tue Aug 17 16:52:14 1999
--- gdb/gdb/config/i386/embed.mt	Fri Nov 12 11:48:31 1999
***************
*** 1,3 ****
  # Target: Embedded Intel 386 
  TDEPFILES= i386-tdep.o i387-tdep.o
! TM_FILE= tm-i386v.h
--- 1,3 ----
  # Target: Embedded Intel 386 
  TDEPFILES= i386-tdep.o i387-tdep.o
! TM_FILE= tm-embed.h
Index: gdb/gdb/config/i386/tm-embed.h
diff -c /dev/null gdb/gdb/config/i386/tm-embed.h:1.1
*** /dev/null	Fri Nov 12 11:49:47 1999
--- gdb/gdb/config/i386/tm-embed.h	Fri Nov 12 11:48:31 1999
***************
*** 0 ****
--- 1,35 ----
+ /* Target machine description for embedded 80[3456]86,
+    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.  */
+ 
+ #ifndef TM_EMBED_H
+ #define TM_EMBED_H
+ 
+ /* Because GDB's embedded x86 targets did not support floating point 
+    registers before the x86 FP support reorganization effort, it seems
+    prudent to continue doing the same until a mechanism is in place to 
+    select processor type at run time. */
+ 
+ #undef HAVE_I387_REGS
+ #undef HAVE_SSE_REGS
+ 
+ #include "i386/tm-i386v.h"
+ 
+ #endif /* ifndef TM_EMBED_H */


-- 
J.T. Conklin
RedBack Networks
From guo@cup.hp.com Fri Nov 12 12:32:00 1999
From: Jimmy Guo <guo@cup.hp.com>
To: gdb-patches@sourceware.cygnus.com
Subject: (patch) hpjyg23: gdbtypes.[ch] & values.c
Date: Fri, 12 Nov 1999 12:32:00 -0000
Message-id: <Pine.LNX.4.10.9911121213280.2889-100000@hpcll168.cup.hp.com>
X-SW-Source: 1999-q4/msg00250.html
Content-length: 15251

***
Patch dependency: hpjyg11 (gdbtypes.h)
***

This patch covers misc. fixes to gdbtypes.c and values.c, and introduces
builtin_type_CORE_ADDR (for 32x64 fix) as well as is_float_type.

ChangeLog:

1999-11-12	Jimmy Guo	<guo@cup.hp.com>

	* gdbtypes.c: Misc. fixes and builtin_type_CORE_ADDR support.
	(rank_one_type): return INTEGER_PROMOTION_BADNESS if parm is of
	TYPE_CODE_ENUM, arg is of a compatible type, but TYPE_LENGTH
	(arg) <= TYPE_LENGTH (parm); when both parm and arg are of
	TYPE_CODE_STRUCT, return 0 if the tag names are the same (for
	same type in different shared libraries), same for
	TYPE_CODE_UNION.
	(build_gdbtypes): init builtin_type_CORE_ADDR to
	builtin_type_unsigned_long_long (64bit) or
	builtin_type_unsigned_long (32bit).
	(is_float_type): New function.

	* gdbtypes.h: Misc. fixes and builtin_type_CORE_ADDR support.
	(TYPE_IS_OPAQUE): include TYPE_CODE_TEMPLATE too.
	(builtin_type_CORE_ADDR): Declare.
	(builtin_type_f_integer_s2,builtin_type_f_integer_s8,
	builtin_type_f_logical_s8): Declare, for Fortran support.
	(is_float_type): Declare.

	* values.c: Misc. 32x64 fixes.

Index: gdb/gdbtypes.c
/opt/gnu/bin/diff -r -c -N  /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/gdbtypes.c gdb/gdbtypes.c
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/gdbtypes.c	Thu Nov 11 14:32:32 1999
--- gdb/gdbtypes.c	Fri Nov 12 12:11:03 1999
***************
*** 65,70 ****
--- 65,71 ----
  struct type *builtin_type_int64;
  struct type *builtin_type_uint64;
  struct type *builtin_type_bool;
+ struct type *builtin_type_CORE_ADDR;
  struct type *builtin_type_v4sf;
  
  int opaque_type_resolution = 1;
***************
*** 1435,1441 ****
    char *mangled_name = gdb_mangle_name (type, method_id, signature_id);
    char *demangled_name = cplus_demangle (mangled_name,
  					 DMGL_PARAMS | DMGL_ANSI);
!   char *argtypetext, *p;
    int depth = 0, argcount = 1;
    struct type **argtypes;
    struct type *mtype;
--- 1436,1442 ----
    char *mangled_name = gdb_mangle_name (type, method_id, signature_id);
    char *demangled_name = cplus_demangle (mangled_name,
  					 DMGL_PARAMS | DMGL_ANSI);
!   char *argtypetext, *p = NULL;
    int depth = 0, argcount = 1;
    struct type **argtypes;
    struct type *mtype;
***************
*** 1669,1674 ****
--- 1670,1685 ----
  	 || (TYPE_CODE (t) == TYPE_CODE_BOOL)));
  }
  
+ int
+ is_float_type (t)
+      struct type *t;
+ {
+   CHECK_TYPEDEF (t);
+   return
+     ((t != NULL) &&
+      (TYPE_CODE(t) == TYPE_CODE_FLT));
+ }
+ 
  /* Chill varying string and arrays are represented as follows:
  
     struct { int __var_length; ELEMENT_TYPE[MAX_SIZE] __var_data};
***************
*** 2025,2040 ****
   * base classes too.
   */
  
! /* pai: FIXME This doesn't do the right thing: count redefined virtual
!  * functions only once (latest redefinition)
!  */
  
  int
  count_virtual_fns (dclass)
       struct type *dclass;
  {
    int fn, oi;			/* function and overloaded instance indices */
!   int vfuncs;			/* count to return */
  
    /* recurse on bases that can share virtual table */
    struct type *pbc = primary_base_class (dclass);
--- 2036,2051 ----
   * base classes too.
   */
  
! /* pai: FIXME I'm not sure that this does the right thing: it should
!    probably count redefined virtual functions only once (latest redefinition).
!    But see use in cp-valprint.c before changing this. */
  
  int
  count_virtual_fns (dclass)
       struct type *dclass;
  {
    int fn, oi;			/* function and overloaded instance indices */
!   int vfuncs = 0;		/* count to return */
  
    /* recurse on bases that can share virtual table */
    struct type *pbc = primary_base_class (dclass);
***************
*** 2291,2297 ****
  	case TYPE_CODE_RANGE:
  	case TYPE_CODE_BOOL:
  	case TYPE_CODE_ENUM:
! 	  return INTEGER_COERCION_BADNESS;
  	case TYPE_CODE_FLT:
  	  return INT_FLOAT_CONVERSION_BADNESS;
  	default:
--- 2302,2311 ----
  	case TYPE_CODE_RANGE:
  	case TYPE_CODE_BOOL:
  	case TYPE_CODE_ENUM:
! 	  if (TYPE_LENGTH (arg) <= TYPE_LENGTH (parm))
! 	    return INTEGER_PROMOTION_BADNESS;
! 	  else
! 	    return INTEGER_COERCION_BADNESS;
  	case TYPE_CODE_FLT:
  	  return INT_FLOAT_CONVERSION_BADNESS;
  	default:
***************
*** 2405,2410 ****
--- 2419,2435 ----
        switch (TYPE_CODE (arg))
  	{
  	case TYPE_CODE_STRUCT:
+ 	  /* RM: the two structs may be the same type but in
+ 	     different shared libraries. The type ptrs won't
+ 	     compare equal, but they really are the same type (or
+ 	     we have a violation of C++'s one definition
+ 	     rule). Compare names to see if the two types refer to
+ 	     the same struct. */
+ 	  /* RM: compare tag names -- one or both names may have a
+ 	     class/struct prefix */
+ 	  if (!strcmp(TYPE_TAG_NAME(arg), TYPE_TAG_NAME(parm)))
+ 	    return 0;
+               
  	  /* Check for derivation */
  	  if (is_ancestor (parm, arg))
  	    return BASE_CONVERSION_BADNESS;
***************
*** 2417,2422 ****
--- 2442,2456 ----
        switch (TYPE_CODE (arg))
  	{
  	case TYPE_CODE_UNION:
+ 	  /* RM: the two unions may be the same type but in
+ 	     different shared libraries. The type ptrs won't
+ 	     compare equal, but they really are the same type (or
+ 	     we have a violation of C++'s one definition
+ 	     rule). Compare names to see if the two types refer to
+ 	     the same union. */
+ 	  if (!strcmp(TYPE_NAME(arg), TYPE_NAME(parm)))
+ 	    return 0;
+ 	  /* else fall through */
  	default:
  	  return INCOMPATIBLE_TYPE_BADNESS;
  	}
***************
*** 2955,2960 ****
--- 2989,3000 ----
      init_type (TYPE_CODE_BOOL, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
  	       0,
  	       "bool", (struct objfile *) NULL);
+ 
+ #ifdef BFD64
+   builtin_type_CORE_ADDR = builtin_type_unsigned_long_long;
+ #else
+   builtin_type_CORE_ADDR = builtin_type_unsigned_long;
+ #endif
  
    /* Add user knob for controlling resolution of opaque types */
    add_show_from_set
Index: gdb/gdbtypes.h
/opt/gnu/bin/diff -r -c -N  /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/gdbtypes.h gdb/gdbtypes.h
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/gdbtypes.h	Fri Nov  5 13:04:38 1999
--- gdb/gdbtypes.h	Thu Nov 11 14:49:10 1999
***************
*** 827,836 ****
  #define TYPE_LOCALTYPE_FILE(thistype) (TYPE_CPLUS_SPECIFIC(thistype)->localtype_ptr->file)
  #define TYPE_LOCALTYPE_LINE(thistype) (TYPE_CPLUS_SPECIFIC(thistype)->localtype_ptr->line)
  
! #define TYPE_IS_OPAQUE(thistype) (((TYPE_CODE (thistype) == TYPE_CODE_STRUCT) ||        \
!                                    (TYPE_CODE (thistype) == TYPE_CODE_UNION))        && \
!                                   (TYPE_NFIELDS (thistype) == 0)                     && \
!                                   (TYPE_CPLUS_SPECIFIC (thistype) && (TYPE_NFN_FIELDS (thistype) == 0)))
  
  
  
--- 827,839 ----
  #define TYPE_LOCALTYPE_FILE(thistype) (TYPE_CPLUS_SPECIFIC(thistype)->localtype_ptr->file)
  #define TYPE_LOCALTYPE_LINE(thistype) (TYPE_CPLUS_SPECIFIC(thistype)->localtype_ptr->line)
  
! #define TYPE_IS_OPAQUE(thistype) \
!   (((TYPE_CODE (thistype) == TYPE_CODE_STRUCT) || \
!     (TYPE_CODE (thistype) == TYPE_CODE_UNION)  || \
!     /* RM: templates too */ \
!     (TYPE_CODE (thistype) == TYPE_CODE_TEMPLATE))  && \
!    (TYPE_NFIELDS (thistype) == 0) && \
!    (TYPE_CPLUS_SPECIFIC (thistype) && (TYPE_NFN_FIELDS (thistype) == 0)))
  
  
  
***************
*** 877,882 ****
--- 880,891 ----
  extern struct type *builtin_type_long_long;
  extern struct type *builtin_type_unsigned_long_long;
  
+ /* builtin_type_CORE_ADDR in a 32-bit gdb will point to the same thing
+    as builtin_type_unsigned_long.  In a 64-bit gdb it will point to
+    builtin_type_unsigned_long_long */
+ 
+ extern struct type *builtin_type_CORE_ADDR;
+ 
  /* Modula-2 types */
  
  extern struct type *builtin_type_m2_char;
***************
*** 897,907 ****
  
  extern struct type *builtin_type_f_character;
  extern struct type *builtin_type_f_integer;
  extern struct type *builtin_type_f_logical;
  extern struct type *builtin_type_f_logical_s1;
  extern struct type *builtin_type_f_logical_s2;
! extern struct type *builtin_type_f_integer;
! extern struct type *builtin_type_f_integer_s2;
  extern struct type *builtin_type_f_real;
  extern struct type *builtin_type_f_real_s8;
  extern struct type *builtin_type_f_real_s16;
--- 906,917 ----
  
  extern struct type *builtin_type_f_character;
  extern struct type *builtin_type_f_integer;
+ extern struct type *builtin_type_f_integer_s2;
+ extern struct type *builtin_type_f_integer_s8;
  extern struct type *builtin_type_f_logical;
  extern struct type *builtin_type_f_logical_s1;
  extern struct type *builtin_type_f_logical_s2;
! extern struct type *builtin_type_f_logical_s8;
  extern struct type *builtin_type_f_real;
  extern struct type *builtin_type_f_real_s8;
  extern struct type *builtin_type_f_real_s16;
***************
*** 1147,1152 ****
--- 1157,1164 ----
  extern int can_dereference PARAMS ((struct type *));
  
  extern int is_integral_type PARAMS ((struct type *));
+ 
+ extern int is_float_type PARAMS ((struct type *));
  
  extern void maintenance_print_type PARAMS ((char *, int));
  
Index: gdb/values.c
/opt/gnu/bin/diff -r -c -N  /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/values.c gdb/values.c
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/values.c	Thu Nov 11 13:04:26 1999
--- gdb/values.c	Thu Nov 11 13:30:04 1999
***************
*** 931,940 ****
        if (VALUE_ADDRESS (argp) == 0)
  	error ("Address of object is null; object may not have been created.");
  
!       /* pai: FIXME -- 32x64 possible problem? */
!       /* First word (4 bytes) in object layout is the vtable pointer */
!       coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (argp));		/* pai: (temp)  */
!       /* + offset + VALUE_EMBEDDED_OFFSET (argp)); */
  
        if (!coreptr)
  	error ("Virtual table pointer is null for object; object may not have been created.");
--- 931,939 ----
        if (VALUE_ADDRESS (argp) == 0)
  	error ("Address of object is null; object may not have been created.");
  
!       /* First word (sizeof(CORE_ADDR) bytes) in object layout is
! 	 the vtable pointer */
!       coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (argp));
  
        if (!coreptr)
  	error ("Virtual table pointer is null for object; object may not have been created.");
***************
*** 955,964 ****
  	   * the beginning of the vtable; but first we have to adjust
  	   * by HP_ACC_VFUNC_START to account for other entries */
  
! 	  /* pai: FIXME: 32x64 problem here, a word may be 8 bytes in
! 	   * which case the multiplier should be 8 and values should be long */
! 	  vp = value_at (builtin_type_int,
! 			 coreptr + 4 * (TYPE_FN_FIELD_VOFFSET (f, j) + HP_ACC_VFUNC_START), NULL);
  
  	  coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (vp));
  	  /* coreptr now contains the address of the virtual function */
--- 954,965 ----
  	   * the beginning of the vtable; but first we have to adjust
  	   * by HP_ACC_VFUNC_START to account for other entries */
  
! 	  vp = value_at (builtin_type_CORE_ADDR,
! 			 coreptr +
! 			 sizeof (CORE_ADDR) *
! 			 (TYPE_FN_FIELD_VOFFSET (f, j) +
! 			  HP_ACC_VFUNC_START),
! 			 NULL);
  
  	  coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (vp));
  	  /* coreptr now contains the address of the virtual function */
***************
*** 974,987 ****
  
  	  /* Find class segment pointer.  These are in the vtable slots after
  	   * some other entries, so adjust by HP_ACC_VFUNC_START for that. */
! 	  /* pai: FIXME 32x64 problem here, if words are 8 bytes long
! 	   * the multiplier below has to be 8 and value should be long. */
! 	  vp = value_at (builtin_type_int,
! 		    coreptr + 4 * (HP_ACC_VFUNC_START + class_index), NULL);
  	  /* Indirect once more, offset by function index */
! 	  /* pai: FIXME 32x64 problem here, again multiplier could be 8 and value long */
! 	  coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (vp) + 4 * TYPE_FN_FIELD_VOFFSET (f, j));
! 	  vp = value_at (builtin_type_int, coreptr, NULL);
  	  coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (vp));
  
  	  /* coreptr now contains the address of the virtual function */
--- 975,992 ----
  
  	  /* Find class segment pointer.  These are in the vtable slots after
  	   * some other entries, so adjust by HP_ACC_VFUNC_START for that. */
! 
! 	  vp = value_at (builtin_type_CORE_ADDR,
! 			 coreptr +
! 			 sizeof (CORE_ADDR) *
! 			 (HP_ACC_VFUNC_START + class_index),
! 			 NULL);
  	  /* Indirect once more, offset by function index */
! 
! 	  coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (vp) +
! 				    sizeof (CORE_ADDR) *
! 				    TYPE_FN_FIELD_VOFFSET (f, j));
! 	  vp = value_at (builtin_type_CORE_ADDR, coreptr, NULL);
  	  coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (vp));
  
  	  /* coreptr now contains the address of the virtual function */
***************
*** 997,1003 ****
        VALUE_TYPE (vp) = ftype;
        VALUE_ADDRESS (vp) = coreptr;
  
!       /* pai: (temp) do we need the value_ind stuff in value_fn_field? */
        return vp;
      }
    else
--- 1002,1008 ----
        VALUE_TYPE (vp) = ftype;
        VALUE_ADDRESS (vp) = coreptr;
  
!       /* pai: do we need the value_ind stuff in value_fn_field? */
        return vp;
      }
    else
***************
*** 1009,1015 ****
           with a strange type, so cast it to type `pointer to long' (which
           should serve just fine as a function type).  Then, index into
           the table, and convert final value to appropriate function type.  */
!       value_ptr entry, vfn, vtbl;
        value_ptr vi = value_from_longest (builtin_type_int,
  				    (LONGEST) TYPE_FN_FIELD_VOFFSET (f, j));
        struct type *fcontext = TYPE_FN_FIELD_FCONTEXT (f, j);
--- 1014,1020 ----
           with a strange type, so cast it to type `pointer to long' (which
           should serve just fine as a function type).  Then, index into
           the table, and convert final value to appropriate function type.  */
!       value_ptr entry, vfn = NULL, vtbl;
        value_ptr vi = value_from_longest (builtin_type_int,
  				    (LONGEST) TYPE_FN_FIELD_VOFFSET (f, j));
        struct type *fcontext = TYPE_FN_FIELD_FCONTEXT (f, j);
***************
*** 1102,1107 ****
--- 1107,1114 ----
  
     FIXME-tiemann: should work with dossier entries as well.  */
  
+ /* pai: Note -- not for HP aCC */
+ 
  static value_ptr
  value_headof (in_arg, btype, dtype)
       value_ptr in_arg;
***************
*** 1196,1201 ****
--- 1203,1210 ----
     of its baseclasses) to figure out the most derived type that ARG
     could actually be a pointer to.  */
  
+ /* pai: Note -- not for HP aCC */
+ 
  value_ptr
  value_from_vtable_info (arg, type)
       value_ptr arg;
***************
*** 1213,1218 ****
--- 1222,1229 ----
  /* Return true if the INDEXth field of TYPE is a virtual baseclass
     pointer which is for the base class whose type is BASECLASS.  */
  
+ /* pai: Note -- not for HP aCC */
+ 
  static int
  vb_match (type, index, basetype)
       struct type *type;
***************
*** 1266,1271 ****
--- 1277,1284 ----
     to (the address of)(ARG) + OFFSET.
  
     -1 is returned on error. */
+ 
+ /* pai: Note -- not for HP aCC */
  
  int
  baseclass_offset (type, index, valaddr, address)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Make threads architecture-independent on Linux
  1999-11-12 10:58 ` Make threads architecture-independent on Linux Jim Kingdon
@ 1999-11-19 13:35   ` Jim Blandy
  0 siblings, 0 replies; 3+ messages in thread
From: Jim Blandy @ 1999-11-19 13:35 UTC (permalink / raw)
  To: Jim Kingdon; +Cc: gdb-patches

This patch is turning out to be quite helpful for us.  Thanks!

Shouldn't gdb/config/sparc/nm-linux.h #include "nm-linux.h", too?  If
it does, can't we delete the #inclusion of solib.h?

Also, we don't need to test __STDC__, as config/nm-linux.h does.  GDB
only compiles under ANSI C now.  Besides, Linux has only ever had ANSI
C compilers.  :)


> 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.
> 	* config/tm-linux.h: New file.
> 	* config/{i386,m68k,sparc}/tm-linux.h,
> 	config/alpha/tm-alphalinux.h: Use it.
> 	* config/{m68k,sparc}/linux.mh, config/alpha/alpha-linux.mh:
> 	Add linux-thread.o.
> 
> --- /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
> --- gdb/config/alpha/nm-linux.h  1999/07/07 20:11:53     1.1.1.3
> +++ gdb/config/alpha/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
> --- gdb/config/i386/nm-linux.h  1999/09/08 23:59:52     1.1.1.3
> +++ gdb/config/i386/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
> --- gdb/config/m68k/nm-linux.h  1999/07/07 20:14:04     1.1.1.2
> +++ gdb/config/m68k/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
> --- gdb/config/sparc/nm-linux.h  1999/07/07 20:17:01     1.1.1.2
> +++ gdb/config/sparc/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: sparc/tm-linux.h
> ===================================================================
> RCS file: /cvs/gdb/gdb/gdb/config/sparc/tm-linux.h,v
> retrieving revision 1.1.1.2
> diff -u -r1.1.1.2 tm-linux.h
> --- tm-linux.h	1999/07/07 20:17:06	1.1.1.2
> +++ gdb/config/sparc/tm-linux.h	1999/11/12 13:35:58
> @@ -25,6 +25,6 @@
>  
>  #define SIGCONTEXT_PC_OFFSET 12
>  
> -#include "tm-sysv4.h"
> +#include "tm-linux.h"
>  
>  #endif /* TM_SPARCLINUX_H */
> Index: m68k/tm-linux.h
> ===================================================================
> RCS file: /cvs/gdb/gdb/gdb/config/m68k/tm-linux.h,v
> retrieving revision 1.1.1.2
> diff -u -r1.1.1.2 tm-linux.h
> --- tm-linux.h	1999/07/07 20:14:22	1.1.1.2
> +++ gdb/config/m68k/tm-linux.h	1999/11/12 13:36:01
> @@ -72,7 +72,7 @@
>      }									\
>  }
>  
> -#include "tm-sysv4.h"
> +#include "tm-linux.h"
>  #include "m68k/tm-m68k.h"
>  
>  /* Extract from an array REGBUF containing the (raw) register state
> Index: i386/tm-linux.h
> ===================================================================
> RCS file: /cvs/gdb/gdb/gdb/config/i386/tm-linux.h,v
> retrieving revision 1.1.1.7
> diff -u -r1.1.1.7 tm-linux.h
> --- tm-linux.h	1999/11/02 04:44:22	1.1.1.7
> +++ gdb/config/i386/tm-linux.h	1999/11/12 13:36:03
> @@ -28,6 +28,7 @@
>  #endif
>  
>  #include "i386/tm-i386.h"
> +#include "tm-linux.h"
>  
>  /* Size of sigcontext, from <asm/sigcontext.h>.  */
>  #define LINUX_SIGCONTEXT_SIZE (88)
> @@ -38,10 +39,6 @@
>  /* Offset to saved SP in sigcontext, from <asm/sigcontext.h>.  */
>  #define LINUX_SIGCONTEXT_SP_OFFSET (28)
>  
> -/* We need this file for the SOLIB_TRAMPOLINE stuff. */
> -
> -#include "tm-sysv4.h"
> -
>  #define LOW_RETURN_REGNUM 0	/* holds low four bytes of result */
>  #define HIGH_RETURN_REGNUM 2	/* holds high four bytes of result */
>  
> @@ -166,18 +163,6 @@
>        : read_memory_integer ((FRAME)->frame + 4, 4)))
>  
>  extern CORE_ADDR i386_linux_sigtramp_saved_sp PARAMS ((struct frame_info *));
> -
> -/* Some versions of Linux have real-time signal support in the C library, and
> -   some don't.  We have to include this file to find out.  */
> -#include <signal.h>
> -
> -#ifdef __SIGRTMIN
> -#define REALTIME_LO __SIGRTMIN
> -#define REALTIME_HI (__SIGRTMAX + 1)
> -#else
> -#define REALTIME_LO 32
> -#define REALTIME_HI 64
> -#endif
>  
>  /* When we call a function in a shared library, and the PLT sends us
>     into the dynamic linker to find the function's real address, we
> Index: alpha/tm-alphalinux.h
> ===================================================================
> RCS file: /cvs/gdb/gdb/gdb/config/alpha/tm-alphalinux.h,v
> retrieving revision 1.1.1.2
> diff -u -r1.1.1.2 tm-alphalinux.h
> --- tm-alphalinux.h	1999/07/07 20:11:59	1.1.1.2
> +++ gdb/config/alpha/tm-alphalinux.h	1999/11/12 13:36:05
> @@ -75,7 +75,6 @@
>  #undef FRAME_PAST_SIGTRAMP_FRAME
>  #define FRAME_PAST_SIGTRAMP_FRAME(frame, pc)	(0)
>  
> -/* We need this for the SOLIB_TRAMPOLINE stuff.  */
> -#include "tm-sysv4.h"
> +#include "tm-linux.h"
>  
>  #endif /* TM_LINUXALPHA_H */
> --- /dev/null	Tue May  5 16:32:27 1998
> +++ gdb/config/tm-linux.h	Thu Nov 11 21:51:21 1999
> @@ -0,0 +1,36 @@
> +/* 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.  */
> +
> +/* Some versions of Linux have real-time signal support in the C library, and
> +   some don't.  We have to include this file to find out.  */
> +#include <signal.h>
> +
> +#ifdef __SIGRTMIN
> +#define REALTIME_LO __SIGRTMIN
> +#define REALTIME_HI (__SIGRTMAX + 1)
> +#else
> +#define REALTIME_LO 32
> +#define REALTIME_HI 64
> +#endif
> +
> +/* We need this file for the SOLIB_TRAMPOLINE stuff. */
> +
> +#include "tm-sysv4.h"
> Index: gdb/config/alpha/alpha-linux.mh
> ===================================================================
> RCS file: /cvs/gdb/gdb/gdb/config/alpha/alpha-linux.mh,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 alpha-linux.mh
> --- alpha-linux.mh	1999/04/16 01:34:14	1.1.1.1
> +++ gdb/config/alpha/alpha-linux.mh	1999/11/12 17:54:12
> @@ -3,7 +3,7 @@
>  XM_FILE= xm-alphalinux.h
>  NAT_FILE= nm-linux.h
>  NATDEPFILES= infptrace.o inftarg.o corelow.o core-regset.o alpha-nat.o \
> -	fork-child.o solib.o
> +	fork-child.o solib.o linux-thread.o
>  
>  MMALLOC = 
>  MMALLOC_CFLAGS = -DNO_MMALLOC 
> Index: gdb/config/sparc/linux.mh
> ===================================================================
> RCS file: /cvs/gdb/gdb/gdb/config/sparc/linux.mh,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 linux.mh
> --- linux.mh	1999/04/16 01:34:25	1.1.1.1
> +++ gdb/config/sparc/linux.mh	1999/11/12 17:54:12
> @@ -2,6 +2,7 @@
>  XDEPFILES= ser-tcp.o
>  XM_FILE= xm-linux.h
>  NAT_FILE= nm-linux.h
> -NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o
> +NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o \
> +	linux-thread.o
>  HOST_IPC=-DBSD_IPC
>  GDBSERVER_DEPFILES= low-sparc.o
> Index: gdb/config/m68k/linux.mh
> ===================================================================
> RCS file: /cvs/gdb/gdb/gdb/config/m68k/linux.mh,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 linux.mh
> --- linux.mh	1999/04/16 01:34:21	1.1.1.1
> +++ gdb/config/m68k/linux.mh	1999/11/12 17:54:12
> @@ -4,6 +4,7 @@
>  XDEPFILES= ser-tcp.o
>  
>  NAT_FILE= nm-linux.h
> -NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o core-aout.o core-regset.o m68klinux-nat.o
> +NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o \
> +	corelow.o core-aout.o core-regset.o m68klinux-nat.o linux-thread.o
>  
>  GDBSERVER_DEPFILES= low-linux.o
> 
From ac131313@cygnus.com Mon Nov 22 01:32:00 1999
From: Andrew Cagney <ac131313@cygnus.com>
To: GDB Patches <gdb-patches@sourceware.cygnus.com>
Subject: FYI: strdup() -> xstrdup()
Date: Mon, 22 Nov 1999 01:32:00 -0000
Message-id: <38390D9A.3BA4969F@cygnus.com>
X-SW-Source: 1999-q4/msg00304.html
Content-length: 638

Just FYI,

I've checked in a patch with the ChangeLog entry:

Thu Nov 18 18:12:48 1999  Andrew Cagney  <cagney@b1.cygnus.com>

	* jv-typeprint.c (java_type_print_base), kod-cisco.c
 	(cisco_kod_open), kod.c (kod_set_os), xcoffread.c
 	(process_linenos), symfile.c (add_symbol_file_command),
 	remote-rdi.c (arm_rdi_open, rdilogfile_command), main.c
 	(captured_main), go32-nat.c (go32_create_inferior), exec.c
 	(exec_file_attach), corefile.c (core_file_command,
 	reopen_exec_file): Replace strdup with xstrdup.

None of the calls to strdup() were being checked.  At least this gets
GDB to attempt a clean shutdown :-)

	enjoy,
		Andrew
From jakub@redhat.com Mon Nov 22 02:58:00 1999
From: Jakub Jelinek <jakub@redhat.com>
To: kingdon@redhat.com, "David S. Miller" <davem@redhat.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: [PATCH] gdb 4.18 fix for disassembly
Date: Mon, 22 Nov 1999 02:58:00 -0000
Message-id: <19991122115929.C515@mff.cuni.cz>
X-SW-Source: 1999-q4/msg00305.html
Content-length: 1341

Hi!

gdb we shipped does not disassemble correctly instructions outside of the v8
ISA (e.g. v8plus, v8plusa).
This patch fixes it. In cvs gdb this code changed again so it might well
work just fine, haven't checked yet.

1999-11-22  Jakub Jelinek  <jakub@redhat.com>

	* sparc-tdep.c (_initialize_sparc_tdep): Don't force machine to the
	compiled-in default unless it is sparclite or sparclet - otherwise
	gdb messes up disassembly of any architecture higher than
	bfd_mach_sparc.

--- gdb/sparc-tdep.c.jj	Mon Dec 14 00:28:45 1998
+++ gdb/sparc-tdep.c	Mon Nov 22 11:40:11 1999
@@ -1929,7 +1929,11 @@ sparc_target_architecture_hook (ap)
 void
 _initialize_sparc_tdep ()
 {
-  tm_print_insn = gdb_print_insn_sparc;
+  if (TM_PRINT_INSN_MACH == bfd_mach_sparc_sparclite
+      || TM_PRINT_INSN_MACH == bfd_mach_sparc_sparclet)
+    tm_print_insn = gdb_print_insn_sparc;
+  else
+    tm_print_insn = print_insn_sparc;
   tm_print_insn_info.mach = TM_PRINT_INSN_MACH;  /* Selects sparc/sparclite */
   target_architecture_hook = sparc_target_architecture_hook;
 }

Cheers,
    Jakub
___________________________________________________________________
Jakub Jelinek | jakub@redhat.com | http://sunsite.mff.cuni.cz/~jj
Linux version 2.3.18 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________
From ac131313@cygnus.com Mon Nov 22 03:41:00 1999
From: Andrew Cagney <ac131313@cygnus.com>
To: Jimmy Guo <guo@cup.hp.com>
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: (patch) hpjyg15a, was Re: (patch) hpjyg15: hppah-nat.c & related
Date: Mon, 22 Nov 1999 03:41:00 -0000
Message-id: <38392AEC.CD29960D@cygnus.com>
References: <Pine.LNX.4.10.9911111640190.6426-100000@hpcll168.cup.hp.com>
X-SW-Source: 1999-q4/msg00306.html
Content-length: 8196

Jimmy Guo wrote:
> 
> >I'd prefer the name (target_signal_p()) (Well actually I don't prefer
> >that name but its more consistent with the general naming convetion :-).
> >
> >I'll check in a change to target.[ch] that adds the target_singal_p().
> >Hmm, I might do it slightly differently - were getting too many separate
> >places where there is code like:
> >
> >       #if SIG...
> >          case TARGET_SIGNAL...
> >       #endif
> >
> >With that in, can the hppa-nat.c be re-submitted?  BTW, you might also
> >split it, I think it contains two changes - the code that uses this new
> >function and something else.
> 
> Sure.  Here is the part which makes use of target_signal_p (the
> target.[ch] changes you are making).
> 
> Ignore the hpjyg15 patch, but use this (hpjyg15a), and the sequel I'm
> cooking (hpjug15b).
> 
> ChangeLog:
> 
> 1999-11-08      Jimmy Guo       <guo@cup.hp.com>
> 
>         * hppah-nat.c (require_notification_of_events): start by
>         ignoring all signals and then adding back in ones we're
>         interested in.
> 
>         * infrun.c (handle_command): On HP, call
>           require_notification_of_events to ignore signals we don't
>           care.

FYI,

I've so far checked in the attached.  Hopefully some of the comments
added to remote.c will help.
I'll buck-pass the infrun.c change to Stan.

	Andrew
Mon Nov 22 21:39:27 1999  Andrew Cagney  <cagney@b1.cygnus.com>

	* target.c (do_target_signal_to_host): New function.  Indicate of
 	the conversion was successful to the caller via an additional
 	parameter.
	(target_signal_to_host_p): New function. Return non-zero if the
 	GDB signal exists on the host system.
	(target_signal_to_host): Rewrite.  Use do_target_signal_to_host.
	* target.h (target_signal_to_host_p): Add declaration. Document
 	target_singal vs host signal vs target OS signal confusion.
	
	From 1999-11-08 Jimmy Guo <guo@cup.hp.com>:
	* hppah-nat.c (require_notification_of_events): Start by ignoring
 	all signals and then adding back in ones we're interested in.
	
Index: hppah-nat.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/hppah-nat.c,v
retrieving revision 2.30
diff -p -r2.30 hppah-nat.c
*** hppah-nat.c	1999/08/16 20:41:00	2.30
--- hppah-nat.c	1999/11/22 11:18:35
*************** require_notification_of_events (pid)
*** 698,703 ****
--- 698,705 ----
  #if defined(PT_SET_EVENT_MASK)
    int pt_status;
    ptrace_event_t ptrace_events;
+   int nsigs;
+   int signum;
  
    /* Instruct the kernel as to the set of events we wish to be
       informed of.  (This support does not exist before HPUX 10.0.
*************** require_notification_of_events (pid)
*** 709,715 ****
       the kernel to keep certain signals hidden from us, we do it
       by calling sigdelset (ptrace_events.pe_signals, signal) for
       each such signal here, before doing PT_SET_EVENT_MASK.  */
!   sigemptyset (&ptrace_events.pe_signals);
  
    ptrace_events.pe_set_event = 0;
  
--- 711,739 ----
       the kernel to keep certain signals hidden from us, we do it
       by calling sigdelset (ptrace_events.pe_signals, signal) for
       each such signal here, before doing PT_SET_EVENT_MASK.  */
!   /* RM: The above comment is no longer true. We start with ignoring
!      all signals, and then add the ones we are interested in. We could
!      do it the other way: start by looking at all signals and then
!      deleting the ones that we aren't interested in, except that
!      multiple gdb signals may be mapped to the same host signal
!      (eg. TARGET_SIGNAL_IO and TARGET_SIGNAL_POLL both get mapped to
!      signal 22 on HPUX 10.20) We want to be notified if we are
!      interested in either signal.  */
!   sigfillset (&ptrace_events.pe_signals);
! 
!   /* RM: Let's not bother with signals we don't care about */
!   nsigs = (int) TARGET_SIGNAL_LAST;
!   for (signum = nsigs; signum > 0; signum--)
!     {
!       if ((signal_stop_state (signum)) ||
! 	  (signal_print_state (signum)) ||
! 	  (!signal_pass_state (signum)))
! 	{
! 	  if (target_signal_to_host_p (signum))
! 	    sigdelset (&ptrace_events.pe_signals,
! 		       target_signal_to_host (signum));
! 	}
!     }
  
    ptrace_events.pe_set_event = 0;
  
Index: target.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/target.c,v
retrieving revision 1.112
diff -p -r1.112 target.c
*** target.c	1999/11/07 23:28:41	1.112
--- target.c	1999/11/22 11:18:42
*************** target_signal_from_host (hostsig)
*** 1675,1684 ****
    return TARGET_SIGNAL_UNKNOWN;
  }
  
! int
! target_signal_to_host (oursig)
!      enum target_signal oursig;
  {
    switch (oursig)
      {
      case TARGET_SIGNAL_0:
--- 1675,1690 ----
    return TARGET_SIGNAL_UNKNOWN;
  }
  
! /* Convert a OURSIG (an enum target_signal) to the form used by the
!    target operating system (refered to as the ``host'') or zero if the
!    equivalent host signal is not available.  Set/clear OURSIG_OK
!    accordingly. */
! 
! static int
! do_target_signal_to_host (enum target_signal oursig,
! 			  int *oursig_ok)
  {
+   *oursig_ok = 1;
    switch (oursig)
      {
      case TARGET_SIGNAL_0:
*************** target_signal_to_host (oursig)
*** 1913,1924 ****
--- 1919,1952 ----
  	    return retsig;
  	}
  #endif
+       *oursig_ok = 0;
+       return 0;
+     }
+ }
+ 
+ int
+ target_signal_to_host_p (enum target_signal oursig)
+ {
+   int oursig_ok;
+   do_target_signal_to_host (oursig, &oursig_ok);
+   return oursig_ok;
+ }
+ 
+ int
+ target_signal_to_host (enum target_signal oursig)
+ {
+   int oursig_ok;
+   int targ_signo = do_target_signal_to_host (oursig, &oursig_ok);
+   if (!oursig_ok)
+     {
        /* The user might be trying to do "signal SIGSAK" where this system
           doesn't have SIGSAK.  */
        warning ("Signal %s does not exist on this system.\n",
  	       target_signal_to_name (oursig));
        return 0;
      }
+   else
+     return targ_signo;
  }
  
  /* Helper function for child_wait and the Lynx derivatives of child_wait.
Index: target.h
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/target.h,v
retrieving revision 1.91
diff -p -r1.91 target.h
*** target.h	1999/11/07 23:28:41	1.91
--- target.h	1999/11/22 11:18:44
*************** extern asection *target_memory_bfd_secti
*** 1343,1349 ****
  /* This is for native targets which use a unix/POSIX-style waitstatus.  */
  extern void store_waitstatus PARAMS ((struct target_waitstatus *, int));
  
! /* Convert between host signal numbers and enum target_signal's.  */
  extern enum target_signal target_signal_from_host PARAMS ((int));
  extern int target_signal_to_host PARAMS ((enum target_signal));
  
--- 1343,1365 ----
  /* This is for native targets which use a unix/POSIX-style waitstatus.  */
  extern void store_waitstatus PARAMS ((struct target_waitstatus *, int));
  
! /* Predicate to target_signal_to_host(). Return non-zero if the enum
!    targ_signal SIGNO has an equivalent ``host'' representation. */
! /* FIXME: cagney/1999-11-22: The name below was chosen in preference
!    to the shorter target_signal_p() because it is far less ambigious.
!    In this context ``target_signal'' refers to GDB's internal
!    representation of the target's set of signals while ``host signal''
!    refers to the target operating system's signal.  Confused? */
! extern int target_signal_to_host_p (enum target_signal signo);
! 
! /* Convert between host signal numbers and enum target_signal's.
!    target_signal_to_host() returns 0 and prints a warning() on GDB's
!    console if SIGNO has no equivalent host representation. */
! /* FIXME: cagney/1999-11-22: Here ``host'' is used incorrectly, it is
!    refering to the target operating system's signal numbering.
!    Similarly, ``enum target_signal'' is named incorrectly, ``enum
!    gdb_signal'' would probably be better as it is refering to GDB's
!    internal representation of a target operating system's signal. */
  extern enum target_signal target_signal_from_host PARAMS ((int));
  extern int target_signal_to_host PARAMS ((enum target_signal));
  
From ac131313@cygnus.com Mon Nov 22 03:42:00 1999
From: Andrew Cagney <ac131313@cygnus.com>
To: Stan Shebs <shebs@cygnus.com>
Cc: Jimmy Guo <guo@cup.hp.com>, gdb-patches@sourceware.cygnus.com
Subject: Re: (patch) hpjyg15a, was Re: (patch) hpjyg15: hppah-nat.c & related
Date: Mon, 22 Nov 1999 03:42:00 -0000
Message-id: <38392B57.B3395317@cygnus.com>
References: <Pine.LNX.4.10.9911111640190.6426-100000@hpcll168.cup.hp.com>
X-SW-Source: 1999-q4/msg00307.html
Content-length: 1698

Stan,

Here is the infrun.c part of HP's patch 15.

Jimmy Guo wrote:
> 
> >I'd prefer the name (target_signal_p()) (Well actually I don't prefer
> >that name but its more consistent with the general naming convetion :-).
> >
> >I'll check in a change to target.[ch] that adds the target_singal_p().
> >Hmm, I might do it slightly differently - were getting too many separate
> >places where there is code like:
> >
> >       #if SIG...
> >          case TARGET_SIGNAL...
> >       #endif
> >
> >With that in, can the hppa-nat.c be re-submitted?  BTW, you might also
> >split it, I think it contains two changes - the code that uses this new
> >function and something else.
> 
> Sure.  Here is the part which makes use of target_signal_p (the
> target.[ch] changes you are making).
> 
> Ignore the hpjyg15 patch, but use this (hpjyg15a), and the sequel I'm
> cooking (hpjug15b).
> 
> ChangeLog:
> 
> 1999-11-08      Jimmy Guo       <guo@cup.hp.com>
> 
>         * infrun.c (handle_command): On HP, call
>           require_notification_of_events to ignore signals we don't
>           care.
> 
> Index: gdb/infrun.c
> /opt/gnu/bin/diff -r -c -N  /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/infrun.c gdb/infrun.c
> *** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/infrun.c    Fri Nov  5 18:37:38 1999
> --- gdb/infrun.c        Fri Nov  5 18:38:41 1999
> ***************
> *** 3621,3626 ****
> --- 3621,3633 ----
>         }
>       }
> 
> +
> + #ifdef GDB_TARGET_IS_HPPA
> +   /* RM: Use OS interface to ignore signals we don't care about */
> +   if (target_has_execution)
> +     require_notification_of_events (inferior_pid);
> + #endif
> +
>     do_cleanups (old_chain);
>   }
> 

	Andrew
From shebs@cygnus.com Mon Nov 22 13:40:00 1999
From: Stan Shebs <shebs@cygnus.com>
To: cagney@cygnus.com
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: FYI: strdup() -> xstrdup()
Date: Mon, 22 Nov 1999 13:40:00 -0000
Message-id: <199911222140.NAA24525@andros.cygnus.com>
References: <38390D9A.3BA4969F@cygnus.com>
X-SW-Source: 1999-q4/msg00308.html
Content-length: 932

   Date: Mon, 22 Nov 1999 20:32:10 +1100
   From: Andrew Cagney <ac131313@cygnus.com>

   I've checked in a patch with the ChangeLog entry:

   Thu Nov 18 18:12:48 1999  Andrew Cagney  <cagney@b1.cygnus.com>

	   * jv-typeprint.c (java_type_print_base), kod-cisco.c
	   (cisco_kod_open), kod.c (kod_set_os), xcoffread.c
	   (process_linenos), symfile.c (add_symbol_file_command),
	   remote-rdi.c (arm_rdi_open, rdilogfile_command), main.c
	   (captured_main), go32-nat.c (go32_create_inferior), exec.c
	   (exec_file_attach), corefile.c (core_file_command,
	   reopen_exec_file): Replace strdup with xstrdup.

   None of the calls to strdup() were being checked.  At least this gets
   GDB to attempt a clean shutdown :-)

Good stuff!  Could you perhaps add a note to the internals manual?  Strdup
is a standard function, and a year from now somebody will forget about
xstrdup and use the standard function instead.

								Stan


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Make threads architecture-independent on Linux
       [not found] <19991108233623.805581B493@ocean.lucon.org>
@ 1999-11-10 13:38 ` Mark Kettenis
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Kettenis @ 1999-11-10 13:38 UTC (permalink / raw)
  To: hjl; +Cc: kingdon, gdb-patches

   Date: Mon, 8 Nov 1999 15:36:23 -0800 (PST)
   From: hjl@lucon.org (H.J. Lu)

   > 
   > 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.
   > 

   I will advise against it. You can take a look at gdb 4.17.0.14 to
   see how it is handled there. I will make a patch for gdb 4.18
   when the backlog improves.

What exactly is withholding you from submitting small patches to bits
unrelated to the FPU support?  And even then, the only piece missing
for proper Linux FPU support is the "info float" command which is not
essential and will be present real soon now.  There are also some
remaining issues with long double support that have to be resolved and
the idea is to get rid if the ad-hoc implementation that the Linux
port uses now.  I would advise strongly against touching the long
double support since almost anything you'll do will most likely be
changed anyway.  But I cannot see why this small "backlog" is keeping
you from submitting patches.

Somehow I'm suspecting that you want to submit a huge patch that
touches several unrelated issues without a lot of explanation why
those changes are necessary.  I think that that would be a terribly
bad thing to do, and I would strngly advise the GDB maintainers not to
accept such a large patch.

If JK's patch really isn't the right way to add thread-support for
all Linux architectures, please tell us why!  Otherwise I think the
patch should be applied.

Mark
From shebs@cygnus.com Wed Nov 10 13:41:00 1999
From: Stan Shebs <shebs@cygnus.com>
To: guo@cup.hp.com
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: (patch) hpjyg02: fix gdb.base/commands.exp
Date: Wed, 10 Nov 1999 13:41:00 -0000
Message-id: <199911102141.NAA28196@andros.cygnus.com>
References: <Pine.LNX.4.10.9910281741360.28476-100000@hpcll168.cup.hp.com>
X-SW-Source: 1999-q4/msg00221.html
Content-length: 310

   Date: Thu, 28 Oct 1999 17:44:32 -0700 (PDT)
   From: Jimmy Guo <guo@cup.hp.com>

   We need a $gdb_prompt $ anchor for 'continue with watch' test in
   gdb.base/commands.exp, or the anchor could be picked up by the next
   expect ...

Thanks, I've just installed this patch in the repository.

								Stan
From eliz@gnu.org Wed Nov 10 14:37:00 1999
From: Eli Zaretskii <eliz@gnu.org>
To: jimb@cygnus.com, dj@delorie.com
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: i386: Are we settled?
Date: Wed, 10 Nov 1999 14:37:00 -0000
Message-id: <199911102234.RAA01359@mescaline.gnu.org>
References: <199911090018.TAA12933@zwingli.cygnus.com>
X-SW-Source: 1999-q4/msg00222.html
Content-length: 10052

These are the patches for go32-specific config files following the new
tm-i386.h.

--- gdb/config/i386/tm-go32.h~1	Wed Jul  7 20:13:00 1999
+++ gdb/config/i386/tm-go32.h	Wed Nov 10 18:08:46 1999
@@ -18,108 +18,10 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include "i386/tm-i386v.h"
+#undef HAVE_SSE_REGS	/* FIXME! go32-nat.c needs to support XMMi registers */
+#define HAVE_I387_REGS
 
-/* Number of machine registers. */
-
-#undef NUM_FREGS
-#define NUM_FREGS 15
-#undef NUM_REGS
-#define NUM_REGS (16+NUM_FREGS)
-
-/* Initializer for an array of names of registers.  There should be
-   NUM_REGS strings in this initializer.  */
-
-/* The order of the first 8 registers must match the compiler's
-   numbering scheme (which is the same as the 386 scheme).  */
-
-#undef REGISTER_NAMES
-#define REGISTER_NAMES { "eax",  "ecx",   "edx",  "ebx",  \
-			 "esp",  "ebp",   "esi",  "edi",  \
-			 "eip",  "eflags","cs",   "ss",   \
-			 "ds",   "es",    "fs",   "gs",   \
-			 "st0",  "st1",   "st2",  "st3",  \
-                         "st4",  "st5",   "st6",  "st7",  \
-			 "fctrl","fstat", "ftag", "fcs",  \
-			 "fopsel","fip",  "fopoff" }
-
-#undef FP_REGNUM
-#define FP_REGNUM  5		/* (ebp) Contains addr of stack frame */
-#undef  SP_REGNUM
-#define SP_REGNUM  4		/* (usp) Contains address of top of stack */
-#undef  PS_REGNUM
-#define PS_REGNUM  9		/* (ps)  Contains processor status */
-#undef  PC_REGNUM
-#define PC_REGNUM  8		/* (eip) Contains program counter */
-#undef  FP0_REGNUM
-#define FP0_REGNUM 16		/* Floating point register 0 */
-#undef  FPC_REGNUM
-#define FPC_REGNUM 24		/* 80387 control register */
-#undef  FPCWD_REGNUM
-#define FPCWD_REGNUM FPC_REGNUM
-#undef  FPSWD_REGNUM
-#define FPSWD_REGNUM 25		/* 80387 status register */
-#undef  FPTWD_REGNUM
-#define FPTWD_REGNUM 26		/* 80387 tag register */
-#undef  FPIPO_REGNUM
-#define FPIPO_REGNUM 29		/* 80387 instruction pointer offset reg */
-#undef  FPIPS_REGNUM
-#define FPIPS_REGNUM 27		/* 80387 instruction pointer selector reg */
-#undef  FPOOS_REGNUM
-#define FPOOS_REGNUM 30		/* 80387 operand pointer offset reg */
-#undef  FPOPS_REGNUM
-#define FPOPS_REGNUM 28		/* 80387 operand pointer selector reg */
-
-/* Total amount of space needed to store our copies of the machine's
-   register state, the array `registers'.  */
-
-#undef REGISTER_BYTES
-#define REGISTER_BYTES (10*4 + 6*2 + 8*10 + 5*2 + 2*4)
-
-/* Index within `registers' of the first byte of the space for
-   register N.  */
-
-#undef REGISTER_BYTE
-#define REGBYTE_0  0
-#define REGBYTE_10 (REGBYTE_0+10*4)
-#define REGBYTE_16 (REGBYTE_10+6*2)
-#define REGBYTE_24 (REGBYTE_16+8*10)
-#define REGBYTE_29 (REGBYTE_24+5*2)
-#define REGISTER_BYTE(N) (((N) < 10) ? (N) * 4 : \
-                          (N) < 16 ? REGBYTE_10 +((N) - 10) * 2 : \
-                          (N) < 24 ? REGBYTE_16 +((N) - 16) * 10 : \
-                          (N) < 29 ? REGBYTE_24 +((N) - 24) * 2 : \
-                          REGBYTE_29 + ((N) - 29) * 4)
-
-/* Number of bytes of storage in the actual machine representation
-   for register N.  */
-
-#undef REGISTER_RAW_SIZE
-#define REGISTER_RAW_SIZE(N) ((N) < 10 ? 4 : (N) < 16 ? 2 : (N) < 24 ? 10 : \
-                              (N) < 29 ? 2 : 4)
-
-/* Number of bytes of storage in the program's representation
-   for register N. */
-
-#undef REGISTER_VIRTUAL_SIZE
-#define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N)
-
-/* Largest value REGISTER_RAW_SIZE can have.  */
-
-#undef MAX_REGISTER_RAW_SIZE
-#define MAX_REGISTER_RAW_SIZE 10
-
-/* Largest value REGISTER_VIRTUAL_SIZE can have.  */
-
-#undef MAX_REGISTER_VIRTUAL_SIZE
-#define MAX_REGISTER_VIRTUAL_SIZE 10
-
-/* Nonzero if register N requires conversion
-   from raw format to virtual format.  */
-
-#undef REGISTER_CONVERTIBLE
-#define REGISTER_CONVERTIBLE(N) ((N) < FP0_REGNUM ? 0 :\
-                                 (N) < FPC_REGNUM ? 1 : 0)
+#include "i386/tm-i386.h"
 
 /* The host and target are i386 machines and the compiler supports
    long doubles. Long doubles on the host therefore have the same
@@ -142,70 +44,34 @@
 
 extern int i387_hex_long_double_input (char *p, long double *putithere);
 
+#ifdef LD_I387	/* otherwise, definitions from tm-i386.h are good enough */
+
 #undef REGISTER_CONVERT_TO_VIRTUAL
-#ifdef LD_I387
-#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
-{ \
-  if (TYPE == REGISTER_VIRTUAL_TYPE (REGNUM)) \
-    { \
-      memcpy (TO, FROM, TYPE_LENGTH (TYPE)); \
-    } \
-  else \
-    { \
-      long double val = *((long double *)FROM); \
-      store_floating ((TO), TYPE_LENGTH (TYPE), val); \
-    } \
+#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO)	\
+{								\
+  long double val = *((long double *)(FROM));			\
+  store_floating ((TO), TYPE_LENGTH (TYPE), val);		\
 }
-#else
-/* Convert data from raw format for register REGNUM in buffer FROM to
-   virtual format with type TYPE in buffer TO.  */
-#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
-{ \
-  double val; \
-  i387_to_double ((FROM), (char *)&val); \
-  store_floating ((TO), TYPE_LENGTH (TYPE), val); \
-}
-#endif
-
-extern void i387_to_double PARAMS ((char *, char *));
 
 #undef REGISTER_CONVERT_TO_RAW
-#ifdef LD_I387
-#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
-{ \
-  if (TYPE == REGISTER_VIRTUAL_TYPE (REGNUM)) \
-    { \
-      memcpy (TO, FROM, TYPE_LENGTH (TYPE)); \
-    } \
-  else \
-    { \
-      long double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
-      *((long double *)TO) = val; \
-    } \
-}
-#else
-#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
-{ \
-  double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
-  double_to_i387((char *)&val, (TO)); \
+#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO)			\
+{									\
+  long double val = extract_floating ((FROM), TYPE_LENGTH (TYPE));	\
+  *((long double *)(TO)) = val;						\
 }
-#endif
 
-extern void double_to_i387 PARAMS ((char *, char *));
+/* Return the GDB type object for the "standard" data type of data in 
+   register N.  Perhaps si and di should go here, but potentially they
+   could be used for things other than address.  */
+
+#define REGISTER_VIRTUAL_TYPE(N)				\
+  (((N) == PC_REGNUM || (N) == FP_REGNUM || (N) == SP_REGNUM)	\
+   ? lookup_pointer_type (builtin_type_void)			\
+   : IS_FP_REGNUM(N) ? builtin_type_long_double 		\
+   : IS_SSE_REGNUM(N) ? builtin_type_v4sf			\
+   : builtin_type_int)
 
-/* Return the GDB type object for the "standard" data type of data in
-   register N.  */
-
-#undef REGISTER_VIRTUAL_TYPE
-#ifdef LD_I387
-#define REGISTER_VIRTUAL_TYPE(N) \
-  ((N < FP0_REGNUM) ? builtin_type_int : \
-   (N < FPC_REGNUM) ? builtin_type_long_double : builtin_type_int)
-#else
-#define REGISTER_VIRTUAL_TYPE(N) \
-  ((N < FP0_REGNUM) ? builtin_type_int : \
-   (N < FPC_REGNUM) ? builtin_type_double : builtin_type_int)
-#endif
+#endif /* LD_I387 */
 
 #undef TARGET_LONG_DOUBLE_BIT
 #define TARGET_LONG_DOUBLE_BIT 96
--- gdb/config/i386/xm-go32.h~1	Mon Apr 26 18:26:22 1999
+++ gdb/config/i386/xm-go32.h	Wed Aug 18 08:30:52 1999
@@ -25,7 +25,7 @@
 
 #define SLASH_P(X) ((X)=='\\' || (X) == '/')
 
-#define ROOTED_P(X) ((SLASH_P((X)[0]))|| ((X)[1] ==':'))
+#define ROOTED_P(X) ((SLASH_P((X)[0])) || ((X)[0] && (X)[1] ==':'))
 
 #define SLASH_CHAR '/'
 #define SLASH_STRING "/"
--- gdb/config/i386/nm-go32.h~1	Sun Aug  8 12:41:38 1999
+++ gdb/config/i386/nm-go32.h	Sat Aug 14 14:59:08 1999
@@ -24,8 +23,31 @@
 
 #define TARGET_HAS_HARDWARE_WATCHPOINTS
 
+/* Returns the number of hardware watchpoints of type TYPE that we can
+   set.  Value is positive if we can set CNT watchpoints, zero if
+   setting watchpoints of type TYPE is not supported, and negative if
+   CNT is more than the maximum number of watchpoints of type TYPE
+   that we can support.  TYPE is one of bp_hardware_watchpoint,
+   bp_read_watchpoint, bp_write_watchpoint, or bp_hardware_breakpoint.
+   CNT is the number of such watchpoints used so far (including this
+   one).  OTHERTYPE is non-zero if other types of watchpoints are
+   currently enabled.
+
+   We always return 1 here because we don't have enough information
+   about possible overlap of addresses that they want to watch.  As
+   an extreme example, consider the case where all the watchpoints
+   watch the same address and the same region length: then we can
+   handle a virtually unlimited number of watchpoints, due to debug
+   register sharing implemented via reference counts in go32-nat.c.  */
+
 #define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) 1
 
+/* Returns non-zero if we can use hardware watchpoints to watch a region
+   whose address is ADDR and whose length is LEN.  */
+
+#define TARGET_REGION_OK_FOR_HW_WATCHPOINT(addr,len) \
+	go32_region_ok_for_watchpoint(addr,len)
+
 /* After a watchpoint trap, the PC points to the instruction after the
    one that caused the trap.  Therefore we don't need to step over it.
    But we do need to reset the status register to avoid another trap.  */
@@ -33,19 +55,22 @@
 #define HAVE_CONTINUABLE_WATCHPOINT
 
 #define STOPPED_BY_WATCHPOINT(W)  \
-  go32_stopped_by_watchpoint (inferior_pid)
+  go32_stopped_by_watchpoint (inferior_pid, 0)
+
+#define target_stopped_data_address() \
+  go32_stopped_by_watchpoint (inferior_pid, 1)
 
 /* Use these macros for watchpoint insertion/removal.  */
 
 #define target_insert_watchpoint(addr, len, type)  \
-  go32_insert_watchpoint (inferior_pid, addr, len, 2)
+  go32_insert_watchpoint (inferior_pid, addr, len, type)
 
 #define target_remove_watchpoint(addr, len, type)  \
-  go32_remove_watchpoint (inferior_pid, addr, len)
+  go32_remove_watchpoint (inferior_pid, addr, len, type)
 
 #define target_insert_hw_breakpoint(addr, shadow)  \
   go32_insert_hw_breakpoint(addr, shadow)
-
+  
 #define target_remove_hw_breakpoint(addr, shadow)  \
   go32_remove_hw_breakpoint(addr, shadow)
 
@@ -55,3 +80,4 @@
 #define FLOAT_INFO { i386_go32_float_info (); }
 
 extern void i386_go32_float_info (void);
+
From eliz@gnu.org Wed Nov 10 14:50:00 1999
From: Eli Zaretskii <eliz@gnu.org>
To: ezannoni@cygnus.com, dj@delorie.com
Cc: muller@cerbere.u-strasbg.fr, shebs@cygnus.com, gdb-patches@sourceware.cygnus.com
Subject: Re: go32-nat.c compilation problem
Date: Wed, 10 Nov 1999 14:50:00 -0000
Message-id: <199911102250.RAA01938@mescaline.gnu.org>
References: <199911081709.SAA23904@cerbere.u-strasbg.fr> <14375.536.118347.328812@kwikemart.cygnus.com> <199911081742.MAA20623@mescaline.gnu.org> <14375.5038.377535.816858@kwikemart.cygnus.com>
X-SW-Source: 1999-q4/msg00223.html
Content-length: 2683

> Fatal() was deleted, and then changes to go32-nat.c were made that
> reintroduced calls to fatal(). I believe the changes were part of a patch
> you submitted, *before* the function fatal was replaced by internal_error().

Here are the diffs for go32-nat.c that should fix this.

1999-11-10  Eli Zaretskii  <eliz@is.elta.co.il>

	* go32-nat.c (go32_fetch_registers, store_register)
	(go32_create_inferior, init_go32_ops): Replace fatal with
	internal_error.
	(sig_map): Map exception 7 to TARGET_SIGNAL_EMT.


--- gdb/go32-nat.c~1	Wed Oct 13 13:39:00 1999
+++ gdb/go32-nat.c	Wed Nov 10 16:49:06 1999
@@ -345,7 +345,7 @@ sig_map[] =
     4, TARGET_SIGNAL_FPE,
     5, TARGET_SIGNAL_SEGV,
     6, TARGET_SIGNAL_ILL,
-    7, TARGET_SIGNAL_FPE,
+    7, TARGET_SIGNAL_EMT,	/* no-coprocessor exception */
     8, TARGET_SIGNAL_SEGV,
     9, TARGET_SIGNAL_SEGV,
     10, TARGET_SIGNAL_BUS,
@@ -570,7 +570,8 @@ go32_fetch_registers (int regno)
 	supply_register (regno,
 			 (char *) &npx + regno_mapping[regno].tss_ofs);
       else
-	fatal ("Invalid register no. %d in go32_fetch_register.", regno);
+	internal_error ("Invalid register no. %d in go32_fetch_register.",
+			regno);
     }
 }
 
@@ -587,7 +588,7 @@ store_register (int regno)
   else if (regno < 31)
     rp = (char *) &npx + regno_mapping[regno].tss_ofs;
   else
-    fatal ("Invalid register no. %d in store_register.", regno);
+    internal_error ("Invalid register no. %d in store_register.", regno);
   memcpy (rp, v, regno_mapping[regno].size);
 }
 
@@ -680,7 +681,7 @@ go32_create_inferior (char *exec_file, c
   resume_is_step = 0;
   /* Init command line storage.  */
   if (redir_debug_init (&child_cmd) == -1)
-    fatal ("Cannot allocate redirection storage: not enough memory.\n");
+    internal_error ("Cannot allocate redirection storage: not enough memory.\n");
 
   /* Parse the command line and create redirections.  */
   if (strpbrk (args, "<>"))
@@ -1311,7 +1312,7 @@ init_go32_ops (void)
 
   /* Initialize child's command line storage.  */
   if (redir_debug_init (&child_cmd) == -1)
-    fatal ("Cannot allocate redirection storage: not enough memory.\n");
+    internal_error ("Cannot allocate redirection storage: not enough memory.\n");
 }
 
 void
--- gdb/utils.c~1	Wed Nov 10 12:58:14 1999
+++ gdb/utils.c	Wed Nov 10 16:51:24 1999
@@ -787,7 +787,7 @@ notice_quit ()
     immediate_quit = 1;
 }
 
-#else /* !defined(__GO32__) && !defined(_MSC_VER) */
+#else /* !defined(_MSC_VER) */
 
 void
 notice_quit ()
@@ -795,7 +795,7 @@ notice_quit ()
   /* Done by signals */
 }
 
-#endif /* !defined(__GO32__) && !defined(_MSC_VER) */
+#endif /* !defined(_MSC_VER) */
 
 /* Control C comes here */
 void
From kingdon@redhat.com Wed Nov 10 15:31:00 1999
From: Jim Kingdon <kingdon@redhat.com>
To: hjl@lucon.org
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: Make threads architecture-independent on Linux
Date: Wed, 10 Nov 1999 15:31:00 -0000
Message-id: <199911102331.SAA08531@devserv.devel.redhat.com>
References: <19991108233623.805581B493@ocean.lucon.org>
X-SW-Source: 1999-q4/msg00224.html
Content-length: 865

> I will advise against it. You can take a look at gdb 4.17.0.14 to
> see how it is handled there.

Uh, OK, I've just looked at it.  The bits to make threads
arch-independent look pretty similar to my patch to me.

Perhaps you (or someone) could offer a more specific critique?
Failing more specifics, I'd advocate checking my patch in.  That's
http://sourceware.cygnus.com/ml/gdb-patches/1999-q4/msg00207.html
for those who might have lost track.

> I will make a patch for gdb 4.18 when the backlog improves.

I don't think that waiting for future patches is a good plan.  This
isn't just directed at you, HJ, it applies equally to all the Cygnus
threads changes which are in progress and/or planned.  Especially
since just about everything being discussed (backlog, floating point,
libthread_db analogue, &c) is orthogonal to making the config
arch-independent.
From hjl@lucon.org Wed Nov 10 15:49:00 1999
From: hjl@lucon.org (H.J. Lu)
To: kingdon@redhat.com (Jim Kingdon)
Cc: gdb-patches@sourceware.cygnus.com
Subject: Re: Make threads architecture-independent on Linux
Date: Wed, 10 Nov 1999 15:49:00 -0000
Message-id: <19991110234852.420C61B493@ocean.lucon.org>
References: <199911102331.SAA08531@devserv.devel.redhat.com>
X-SW-Source: 1999-q4/msg00225.html
Content-length: 2412

> 
> > I will advise against it. You can take a look at gdb 4.17.0.14 to
> > see how it is handled there.
> 
> Uh, OK, I've just looked at it.  The bits to make threads
> arch-independent look pretty similar to my patch to me.

But you don't have config/tm-linux.h.

> 
> Perhaps you (or someone) could offer a more specific critique?

You should have config/tm-linux.h enclosed here and modify all the
Linux tm files to include it. Otherwise, linuxthreads won't work
right if REALTIME_HI and REALTIME_LO are not correct.

> Failing more specifics, I'd advocate checking my patch in.  That's
> http://sourceware.cygnus.com/ml/gdb-patches/1999-q4/msg00207.html
> for those who might have lost track.
> 
> > I will make a patch for gdb 4.18 when the backlog improves.
> 
> I don't think that waiting for future patches is a good plan.  This
> isn't just directed at you, HJ, it applies equally to all the Cygnus
> threads changes which are in progress and/or planned.  Especially
> since just about everything being discussed (backlog, floating point,
> libthread_db analogue, &c) is orthogonal to making the config
> arch-independent.
> 

My gdb tree is a mess. I don't have the time to clean it up. I don't
want to spend time on it before gdb in CVS is in reasonable shape.



-- 
H.J. Lu (hjl@gnu.org)
--
/* Macro definitions for Linux targets.
   Copyright 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.  */

/* Some versions of Linux have real-time signal support in the C library, and
   some don't.  We have to include this file to find out.  */
#include <signal.h>

#ifdef __SIGRTMIN
#define REALTIME_LO __SIGRTMIN
#define REALTIME_HI (__SIGRTMAX + 1)
#else
#define REALTIME_LO 32
#define REALTIME_HI 64
#endif


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-11-19 13:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <19991110234852.420C61B493@ocean.lucon.org>
1999-11-12 10:58 ` Make threads architecture-independent on Linux Jim Kingdon
1999-11-19 13:35   ` Jim Blandy
     [not found] <19991108233623.805581B493@ocean.lucon.org>
1999-11-10 13:38 ` Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox