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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Big VAX cleanup


I managed to get the current GDB running on Ultrix/VAX, so I did some
serious cleaning.  Since Andrew got rid of the VAX xm.h files the
distinction between the various Ultrix versions was no longer there.
Furthermore, the differences with old BSD were so small that I merged
that I mad Ultrix and 4.2BSD use the same config.  I didn't get it
actually running on 4.3BSD (which I've got running on my VAX
simulator) because I haven't managed to find a recent enough version
of GCC that can be build on the system.  But I'm fairly confident that
it can be built if you replace enough of the 4.3BSD tools with GNU
tools.

Signal handler support was axed with this patch, but probably didn't
work anyway.

In this state, the code isn't much of a maintenance burden, and I'm
happy to keep it.

Committed,

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* vax-nat.c: New file.
	* vaxbsd-nat.c: Tweak comment.
	* Makefile.in (ALLDEPFILES): Add vax-nat.c, vaxbsd-nat.c and
	vaxnbsd-tdep.c.
	(vax-nat.o): New dependency.
	* configure.host (vax-*-bsd*, vax-*-ultrix*): Set gdb_host to vax.
	(vax-*-ultrix2*): Remove.
	* config/vax/vax.mh: New file.
	* config/vax/nm-vax.h (vax_kernel_u_addr): New extern declaration.
	(KERNEL_U_ADDR): Define as vax_kernel_u_addr.
	(vax_register_u_addr): New prototype.
	(REGISTER_U_ADDR): Define using vax_register_u_addr.
	* config/vax/vaxult2.mh: Remove file.
	* config/vax/vaxult.mh: Remove file.
	* config/vax/vaxbsd.mh: Remove file.
	* config/vax/vax.mt (TM_FILE): Remove.
	* config/vax/tm-vaxbsd.h: Remove file.

Index: vax-nat.c
===================================================================
RCS file: vax-nat.c
diff -N vax-nat.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ vax-nat.c 6 Aug 2004 19:11:23 -0000
@@ -0,0 +1,106 @@
+/* Native-dependent code for VAX UNIXen (including older BSD's).
+
+   Copyright 2004 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.  */
+
+#include "defs.h"
+#include "inferior.h"
+
+#include "gdb_assert.h"
+#include <sys/types.h>
+#include <sys/dir.h>
+#include <sys/user.h>
+
+#ifdef HAVE_SYS_PTRACE_H
+#include <sys/ptrace.h>
+#endif
+
+#ifndef PT_READ_U
+#define PT_READ_U 3
+#endif
+
+#ifdef SYS_REG_H
+/* UNIX 32V and derivatives (including 3BSD).  */
+#include <sys/reg.h>
+#else
+/* 4.2BSD and derivatives.  */
+#include <machine/reg.h>
+#endif
+
+#include "vax-tdep.h"
+
+/* Address of the user structure.  This is the the value for 32V; 3BSD
+   uses a different value, but hey, who's still using those systems?  */
+CORE_ADDR vax_kernel_u_addr = 0x80020000;
+
+/* Location of the user's stored registers; usage is `u.u_ar0[XX]'.
+   For 4.2BSD and ULTRIX these are negative!  See <machine/reg.h>.  */
+static int vax_register_index[] =
+{
+  R0, R1, R2, R3, R4, R5,
+  R6, R7, R8, R9, R10, R11,
+  AP, FP, SP, PC, PS
+};
+
+CORE_ADDR
+vax_register_u_addr (CORE_ADDR u_ar0, int regnum)
+{
+  gdb_assert (regnum >= 0 && regnum < ARRAY_SIZE (vax_register_index));
+
+  /* Type is `int *u_ar0'.  See <sys/user.h>.  */
+  return u_ar0 + vax_register_index[regnum - VAX_R0_REGNUM] * 4;
+}
+
+
+CORE_ADDR
+vax_register_u_offset (int regnum)
+{
+  size_t u_ar0_offset = offsetof (struct user, u_ar0);
+  CORE_ADDR u_ar0;
+  int pid;
+
+  errno = 0;
+  pid = PIDGET (inferior_ptid);
+  u_ar0 = ptrace (PT_READ_U, pid, u_ar0_offset, 0);
+  if (errno)
+    perror_with_name ("Unable to determine location of registers");
+
+  return vax_register_u_addr (u_ar0, regnum) - vax_kernel_u_addr;
+}
+
+
+#include <nlist.h>
+
+#ifndef _PATH_UNIX
+#define _PATH_UNIX "/vmunix"
+#endif
+
+/* Provide a prototype to silence -Wmissing-prototypes.  */
+void _initialize_vax_nat (void);
+
+void
+_initialize_vax_nat (void)
+{
+  struct nlist names[2];
+
+  names[0].n_name = "_u";
+  names[1].n_name = NULL;
+  if (nlist (_PATH_UNIX, names) == 0)
+    vax_kernel_u_addr = names[0].n_value;
+}
Index: vaxbsd-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/vaxbsd-nat.c,v
retrieving revision 1.3
diff -u -p -r1.3 vaxbsd-nat.c
--- vaxbsd-nat.c 17 Jul 2004 11:03:46 -0000 1.3
+++ vaxbsd-nat.c 6 Aug 2004 19:11:23 -0000
@@ -1,4 +1,4 @@
-/* Native-dependent code for VAX BSD's.
+/* Native-dependent code for modern VAX BSD's.
 
    Copyright 2004 Free Software Foundation, Inc.
 
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.605
diff -u -p -r1.605 Makefile.in
--- Makefile.in 5 Aug 2004 14:34:16 -0000 1.605
+++ Makefile.in 6 Aug 2004 19:11:26 -0000
@@ -1406,7 +1406,7 @@ ALLDEPFILES = \
 	sparc64nbsd-nat.c sparc64nbsd-tdep.c sparc64obsd-tdep.c \
 	sparcnbsd-nat.c sparcnbsd-tdep.c sparcobsd-tdep.c \
 	symm-tdep.c symm-nat.c \
-	vax-tdep.c \
+	vax-nat.c vax-tdep.c vaxbsd-nat.c vaxnbsd-tdep.c \
 	vx-share/xdr_ld.c vx-share/xdr_ptrace.c vx-share/xdr_rdb.c \
 	win32-nat.c \
 	xcoffread.c xcoffsolib.c \
@@ -2640,6 +2640,7 @@ vaxbsd-nat.o: vaxbsd-nat.c $(defs_h) $(i
 	$(vax_tdep_h) $(bsd_kvm_h)
 vaxnbsd-tdep.o: vaxnbsd-tdep.c $(defs_h) $(arch_utils_h) $(osabi_h) \
 	$(vax_tdep_h) $(solib_svr4_h) $(gdb_string_h)
+vax-nat.o: vax-nat.c $(defs_h) $(inferior_h) $(gdb_assert_h) $(vax_tdep_h)
 vax-tdep.o: vax-tdep.c $(defs_h) $(arch_utils_h) $(dis_asm_h) $(frame_h) \
 	$(frame_base_h) $(frame_unwind_h) $(gdbcore_h) $(gdbtypes_h) \
 	$(osabi_h) $(regcache_h) $(regset_h) $(trad_frame_h) $(value_h) \
Index: configure.host
===================================================================
RCS file: /cvs/src/src/gdb/configure.host,v
retrieving revision 1.81
diff -u -p -r1.81 configure.host
--- configure.host 29 Jul 2004 19:33:22 -0000 1.81
+++ configure.host 6 Aug 2004 19:11:26 -0000
@@ -133,12 +133,11 @@ sparc-*-solaris2* | sparcv9-*-solaris2* 
 			gdb_host=sol2
 			;;
 
+vax-*-bsd*)		gdb_host=vax ;;
 vax-*-netbsdelf*)	gdb_host=nbsdelf ;;
 vax-*-netbsd*)		gdb_host=nbsdaout ;;
 vax-*-openbsd*)		gdb_host=obsd ;;
-vax-*-bsd*)		gdb_host=vaxbsd ;;
-vax-*-ultrix2*)		gdb_host=vaxult2 ;;
-vax-*-ultrix*)		gdb_host=vaxult ;;
+vax-*-ultrix*)		gdb_host=vax ;;
 
 x86_64-*-linux*)	gdb_host=linux64 ;;
 x86_64-*-freebsd*)	gdb_host=fbsd64 ;;
Index: config/vax/nm-vax.h
===================================================================
RCS file: /cvs/src/src/gdb/config/vax/nm-vax.h,v
retrieving revision 1.4
diff -u -p -r1.4 nm-vax.h
--- config/vax/nm-vax.h 29 Jul 2004 20:53:27 -0000 1.4
+++ config/vax/nm-vax.h 6 Aug 2004 19:11:26 -0000
@@ -1,5 +1,6 @@
-/* Common definitions for GDB native support on Vaxen under 4.2bsd and Ultrix.
-   Copyright (C) 1986, 1987, 1989, 1992 Free Software Foundation, Inc.
+/* Native-dependent definitions for VAXen under 4.2 BSD and ULTRIX.
+
+   Copyright 1986, 1987, 1989, 1992, 2004 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -18,16 +19,14 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define AP_REGNUM 12	/* XXXJRT */
+#ifndef NM_VAX_H
+#define NM_VAX_H
+
+extern CORE_ADDR vax_kernel_u_addr;
+#define KERNEL_U_ADDR vax_kernel_u_addr
+
+extern CORE_ADDR vax_register_u_addr (CORE_ADDR u_ar0, int regnum);
+#define REGISTER_U_ADDR(addr, u_ar0, regnum) \
+  (addr) = vax_register_u_addr (u_ar0, regnum)
 
-/* This is the amount to subtract from u.u_ar0
-   to get the offset in the core file of the register values.  */
-#define KERNEL_U_ADDR (0x80000000 - (UPAGES * NBPG))
-
-#define REGISTER_U_ADDR(addr, blockend, regno)		\
-{ addr = blockend - 0110 + regno * 4;			\
-  if (regno == PC_REGNUM) addr = blockend - 8;		\
-  if (regno == PS_REGNUM) addr = blockend - 4;		\
-  if (regno == DEPRECATED_FP_REGNUM) addr = blockend - 0120;	\
-  if (regno == AP_REGNUM) addr = blockend - 0124;	\
-  if (regno == SP_REGNUM) addr = blockend - 20; }
+#endif /* nm-vax.h */
Index: config/vax/tm-vaxbsd.h
===================================================================
RCS file: config/vax/tm-vaxbsd.h
diff -N config/vax/tm-vaxbsd.h
--- config/vax/tm-vaxbsd.h 1 May 2004 13:14:20 -0000 1.5
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,36 +0,0 @@
-/* Definitions to make GDB run on a vax under 4.2bsd.
-
-   Copyright 1986, 1987, 1989, 1991, 1993, 1994, 1996, 1998, 1999,
-   2000, 2002, 2004 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_VAXBSD_H
-#define TM_VAXBSD_H
-
-#define TARGET_UPAGES 14
-#define TARGET_NBPG 512
-#define STACK_END_ADDR (0x80000000 - (TARGET_UPAGES * TARGET_NBPG))
-
-/* On the VAX, sigtramp is in the u area.  Can't check the exact
-   addresses because for cross-debugging we don't have VAX include
-   files around.  This should be close enough.  */
-#define DEPRECATED_IN_SIGTRAMP(PC,FUNC_NAME) \
-((PC) >= (STACK_END_ADDR) && (PC) < (0x80000000))
-
-#endif /* TM_VAXBSD_H */
Index: config/vax/vax.mh
===================================================================
RCS file: config/vax/vax.mh
diff -N config/vax/vax.mh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ config/vax/vax.mh 6 Aug 2004 19:11:26 -0000
@@ -0,0 +1,3 @@
+# Host: VAX running 4.2BSD or Ultrix
+NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o
+NAT_FILE= nm-vax.h
Index: config/vax/vax.mt
===================================================================
RCS file: /cvs/src/src/gdb/config/vax/vax.mt,v
retrieving revision 1.2
diff -u -p -r1.2 vax.mt
--- config/vax/vax.mt 26 Jun 2002 17:39:30 -0000 1.2
+++ config/vax/vax.mt 6 Aug 2004 19:11:26 -0000
@@ -1,3 +1,2 @@
-# Target: DEC VAX running BSD or Ultrix
+# Target: VAX running 4.2BSD or Ultrix
 TDEPFILES= vax-tdep.o
-TM_FILE= tm-vaxbsd.h
Index: config/vax/vaxbsd.mh
===================================================================
RCS file: config/vax/vaxbsd.mh
diff -N config/vax/vaxbsd.mh
--- config/vax/vaxbsd.mh 5 Aug 2004 14:34:17 -0000 1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-# Host: DEC VAX running BSD
-
-# The following types of /bin/cc failures have been observed:
-# 1.  Something in readline.c which I have never seen
-# 2.  ``"values.c", line 816: compiler error: schain botch''
-#msg /bin/cc has been known to fail on VAXen running BSD4.3
-#msg If this occurs, use gcc
-#msg  (but see comments in Makefile.dist about compiling with gcc).
-
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o
-
-NAT_FILE= nm-vax.h
Index: config/vax/vaxult.mh
===================================================================
RCS file: config/vax/vaxult.mh
diff -N config/vax/vaxult.mh
--- config/vax/vaxult.mh 5 Aug 2004 14:34:17 -0000 1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,4 +0,0 @@
-# Host: DEC VAX running Ultrix
-
-NAT_FILE= nm-vax.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o
Index: config/vax/vaxult2.mh
===================================================================
RCS file: config/vax/vaxult2.mh
diff -N config/vax/vaxult2.mh
--- config/vax/vaxult2.mh 5 Aug 2004 14:34:17 -0000 1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,4 +0,0 @@
-# Host: DEC VAX running Ultrix
-
-NAT_FILE= nm-vax.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o


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