[PATCH/SPARC] Unify 32-bit and 64-bit Solaris native support

Mark Kettenis kettenis@chello.nl
Mon Dec 15 20:31:00 GMT 2003


This makes it somewhat easier to configure a 64-bit Solaris native
GDB.  Using a 64-bit compiler should get you a GDB that can debug both
23-bit and 64-bit native processes now.

Committed to the branch.

Mark


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

	* sparc-sol2-nat.c: Add 64-bit support.
	(supply_gregset): Call sparc_supply_gregset
	instead of sparc32_supply_gregset.
	(supply_fpregset, fill_gregset, fill_fpregset): Likewise.
	* sparc64-sol2-nat.c: Remove file.
	* configure.host: Use a single configuration for
	sparc-*-solaris2*, sparcv9-*-solaris2* and sparc64-solaris2*.
	* Makefile.in (ALLDEPFILES): Remobe sparc64-sol2-nat.c.
	(sparc-sol2-nat.o): Update dependency.
	(sparc64-sol2-nat.o): Remove dependency.
	* config/sparc/sol2.mh: Update comment.
	* config/sparc/sol64.mh: Remobe file.

Index: sparc-sol2-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/Attic/sparc-sol2-nat.c,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 sparc-sol2-nat.c
--- sparc-sol2-nat.c 2 Nov 2003 17:05:07 -0000 1.1.2.4
+++ sparc-sol2-nat.c 15 Dec 2003 20:25:24 -0000
@@ -27,31 +27,66 @@
 
 #include "sparc-tdep.h"
 
-/* These functions provide the (temporary) glue between the Solaris
-   SPARC target dependent code and the machine independent SVR4 /proc
+/* This file provids the (temporary) glue between the Solaris SPARC
+   target dependent code and the machine independent SVR4 /proc
    support.  */
 
+/* Solaris 7 (Solaris 2.7, SunOS 5.7) and up support two process data
+   models, the traditional 32-bit data model (ILP32) and the 64-bit
+   data model (LP64).  The format of /proc depends on the data model
+   of the observer (the controlling process, GDB in our case).  The
+   Solaris header files conveniently define PR_MODEL_NATIVE to the
+   data model of the controlling process.  If its value is
+   PR_MODEL_LP64, we know that GDB is being compiled as a 64-bit
+   program.
+
+   Note that a 32-bit GDB won't be able to debug a 64-bit target
+   process using /proc.  */
+
+#if defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)
+
+#include "sparc64-tdep.h"
+
+#define sparc_supply_gregset sparc64_supply_gregset
+#define sparc_supply_fpregset sparc64_supply_fpregset
+#define sparc_collect_gregset sparc64_collect_gregset
+#define sparc_collect_fpregset sparc64_collect_fpregset
+
+#define sparc_sol2_gregset sparc64_sol2_gregset
+#define sparc_sol2_fpregset sparc64_sol2_fpregset
+
+#else
+
+#define sparc_supply_gregset sparc32_supply_gregset
+#define sparc_supply_fpregset sparc32_supply_fpregset
+#define sparc_collect_gregset sparc32_collect_gregset
+#define sparc_collect_fpregset sparc32_collect_fpregset
+
+#define sparc_sol2_gregset sparc32_sol2_gregset
+#define sparc_sol2_fpregset sparc32_sol2_fpregset
+
+#endif
+
 void
 supply_gregset (prgregset_t *gregs)
 {
-  sparc32_supply_gregset (&sparc32_sol2_gregset, current_regcache, -1, gregs);
+  sparc_supply_gregset (&sparc_sol2_gregset, current_regcache, -1, gregs);
 }
 
 void
 supply_fpregset (prfpregset_t *fpregs)
 {
-  sparc32_supply_fpregset (current_regcache, -1, fpregs);
+  sparc_supply_fpregset (current_regcache, -1, fpregs);
 }
 
 void
 fill_gregset (prgregset_t *gregs, int regnum)
 {
-  sparc32_collect_gregset (&sparc32_sol2_gregset,
-			   current_regcache, regnum, gregs);
+  sparc_collect_gregset (&sparc_sol2_gregset, current_regcache, regnum, gregs);
 }
 
 void
 fill_fpregset (prfpregset_t *fpregs, int regnum)
 {
-  sparc32_collect_fpregset (current_regcache, regnum, fpregs);
+  sparc_collect_fpregset (current_regcache, regnum, fpregs);
 }
Index: configure.host
===================================================================
RCS file: /cvs/src/src/gdb/configure.host,v
retrieving revision 1.57.4.5
diff -u -p -r1.57.4.5 configure.host
--- configure.host 16 Nov 2003 10:19:38 -0000 1.57.4.5
+++ configure.host 15 Dec 2003 20:25:24 -0000
@@ -134,11 +134,10 @@ sparc-*-linux*)		gdb_host=linux ;;
 sparc-*-netbsdelf*)	gdb_host=nbsdelf ;;
 sparc-*-netbsdaout*)	gdb_host_nbsdaout ;;
 sparc-*-netbsd*)	gdb_host=nbsdaout ;;
-sparc-*-solaris2*)	gdb_host=sol2 ;;
 sparc64-*-freebsd*)	gdb_host=fbsd ;;
 sparc64-*-linux*)	gdb_host=linux64 ;;
-sparc64-*-solaris2* | sparcv9-*-solaris2*)
-			gdb_host=sol64
+sparc-*-solaris2* | sparcv9-*-solaris2* | sparc64-*-solaris2*)
+			gdb_host=sol2
 			;;
 
 vax-*-bsd*)		gdb_host=vaxbsd ;;
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.445.2.8
diff -u -p -r1.445.2.8 Makefile.in
--- Makefile.in 16 Nov 2003 10:19:37 -0000 1.445.2.8
+++ Makefile.in 15 Dec 2003 20:28:34 -0000
@@ -1299,7 +1299,7 @@ ALLDEPFILES = \
 	sparc-nat.c sparc-sol2-nat.c sparcbsd-nat.c sparcnbsd-nat.c \
 	sparc64-tdep.c sparc64-sol2-tdep.c sparc64-linux-tdep.c \
 	sparc64fbsd-tdep.c \
-	sparc64-nat.c sparc64-sol2-nat.c sparc64-linux-nat.c \
+	sparc64-nat.c sparc64-linux-nat.c \
 	sparc64fbsd-nat.c \
 	sun3-nat.c \
 	symm-tdep.c symm-nat.c \
@@ -2316,7 +2316,7 @@ sparc-tdep.o: sparc-tdep.c $(defs_h) $(a
 sparc-linux-tdep.o: sparc-linux-tdep.c $(defs_h) $(gdbarch_h) $(osabi_h) \
 	$(solib_svr4_h) $(sparc_tdep_h)
 sparc-sol2-nat.o: sparc-sol2-nat.c $(defs_h) $(gregset_h) $(regcache_h) \
-	$(sparc_tdep_h)
+	$(sparc_tdep_h) $(sparc64_tdep_h)
 sparc-sol2-tdep.o: sparc-sol2-tdep.c $(defs_h) $(frame_h) $(frame_base_h) \
 	$(frame_unwind_h) $(gdbcore_h) $(symtab_h) $(objfiles_h) $(osabi_h) \
 	$(regcache_h) $(target_h) $(trad_frame_h) $(gdb_assert_h) \
@@ -2338,8 +2338,6 @@ sparc64-linux-nat.o: sparc64-linux-nat.c
 	$(sparc64_tdep_h) $(sparc_nat_h)
 sparc64-linux-tdep.o: sparc64-linux-tdep.c $(defs_h) $(gdbarch_h) \
 	$(osabi_h) $(solib_svr4_h) $(sparc64_tdep_h)
-sparc64-sol2-nat.o: sparc64-sol2-nat.c $(defs_h) $(gregset_h) $(regcache_h) \
-	$(sparc64_tdep_h)
 sparc64-sol2-tdep.o: sparc64-sol2-tdep.c $(defs_h) $(gdbarch_h) $(symtab_h) \
 	$(objfiles_h) $(osabi_h) $(sparc64_tdep_h)
 sparc64fbsd-tdep.o: sparc64fbsd-tdep.c $(defs_h) $(gdbcore_h) $(osabi_h) \
Index: config/sparc/sol2.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/Attic/sol2.mh,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 sol2.mh
--- config/sparc/sol2.mh 7 Nov 2003 21:46:10 -0000 1.1.2.2
+++ config/sparc/sol2.mh 15 Dec 2003 20:25:24 -0000
@@ -1,4 +1,4 @@
-# Host: Solaris SPARC
+# Host: Solaris SPARC & UltraSPARC
 NAT_FILE= nm-sol2.h
 NATDEPFILES= sparc-sol2-nat.o \
 	corelow.o core-regset.o fork-child.o gcore.o \



More information about the Gdb-patches mailing list