[COMMIT] Convert *BSD/sparc* to use target vector inheritance

Mark Kettenis mark.kettenis@xs4all.nl
Tue Oct 12 22:19:00 GMT 2004


Except for FreeBSD/sparc64.  I'll do that one later.

The patches touches the FreeBSD and Linux .mh files though to make
sure things still compile.

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>
 
	* sparc-nat.c: Include "inf-ptrace.h".
	(sparc_target): New function.
	* sparc-nat.h: Update copyright year.
	(sparc_target): New prototype.
	* sparcnbsd-nat.c: Don't include "gdbcore.h", include "target.h".
	(_initialize_sparcnbsd_nat): Construct and add target vector.
	* sparc64nbsd-nat.c: Include "target.h".
	(_initialize_sparc64nbsd_nat): Construct and add target vector.
	* Makefile.in (sparc-nat.o, sparcnbsd-nat.o, sparc64nbsd-nat.o):
	Update dependencies.
	* config/sparc/nbsd64.mh (NATDEPFILES): Remove infptrace.o and
	inftarg.o, add inf-ptrace.o.
	* config/sparc/nbsdaout.mh (NATDEPFILES): Remove infptrace.o and
	inftarg.o, add inf-ptrace.o and bsd-kvm.o.
	(NAT_FILE): Set to nm-bsd.h.
	(LOADLIBES): New variable.
	* config/sparc/nbsdelf.mh (NATDEPFILES): Remove infptrace.o and
	infarg.o, add inf-ptrace.o.
	* config/sparc/nm-nbsdaout.h: Remove file.
	* config/sparc/fbsd.mh (NATDEPFILES): Add inf-ptrace.o.
	* config/sparc/linux.mh (NATDEPFILES): Add inf-ptrace.o.
	* config/sparc/linux64.mh (NATDEPFILES): Add inf-ptrace.o.

 
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.640
diff -u -p -r1.640 Makefile.in
--- Makefile.in 11 Oct 2004 20:03:55 -0000 1.640
+++ Makefile.in 12 Oct 2004 22:17:39 -0000
@@ -2533,7 +2533,7 @@ sparc64-linux-tdep.o: sparc64-linux-tdep
 	$(sparc64_tdep_h)
 sparc64-nat.o: sparc64-nat.c $(defs_h) $(gdbarch_h) $(sparc64_tdep_h) \
 	$(sparc_nat_h)
-sparc64nbsd-nat.o: sparc64nbsd-nat.c $(defs_h) $(regcache_h) \
+sparc64nbsd-nat.o: sparc64nbsd-nat.c $(defs_h) $(regcache_h) $(target_h) \
 	$(sparc64_tdep_h) $(sparc_nat_h) $(bsd_kvm_h)
 sparc64nbsd-tdep.o: sparc64nbsd-tdep.c $(defs_h) $(frame_h) \
 	$(frame_unwind_h) $(gdbcore_h) $(osabi_h) $(regcache_h) $(regset_h) \
@@ -2556,8 +2556,8 @@ sparc-linux-tdep.o: sparc-linux-tdep.c $
 	$(gdb_string_h) $(sparc_tdep_h)
 sparc-nat.o: sparc-nat.c $(defs_h) $(inferior_h) $(regcache_h) $(target_h) \
 	$(gdb_assert_h) $(gdb_string_h) $(gdb_wait_h) $(sparc_tdep_h) \
-	$(sparc_nat_h)
-sparcnbsd-nat.o: sparcnbsd-nat.c $(defs_h) $(gdbcore_h) $(regcache_h) \
+	$(sparc_nat_h) $(inf_ptrace_h)
+sparcnbsd-nat.o: sparcnbsd-nat.c $(defs_h) $(regcache_h) $(target_h) \
 	$(sparc_tdep_h) $(sparc_nat_h) $(bsd_kvm_h)
 sparcnbsd-tdep.o: sparcnbsd-tdep.c $(defs_h) $(floatformat_h) $(frame_h) \
 	$(frame_unwind_h) $(gdbcore_h) $(osabi_h) $(regcache_h) $(regset_h) \
Index: sparc-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-nat.c,v
retrieving revision 1.27
diff -u -p -r1.27 sparc-nat.c
--- sparc-nat.c 14 Aug 2004 23:44:47 -0000 1.27
+++ sparc-nat.c 12 Oct 2004 22:17:40 -0000
@@ -35,6 +35,7 @@
 
 #include "sparc-tdep.h"
 #include "sparc-nat.h"
+#include "inf-ptrace.h"
 
 /* With some trickery we can use the code in this file for most (if
    not all) ptrace(2) based SPARC systems, which includes SunOS 4,
@@ -304,6 +305,20 @@ sparc_xfer_wcookie (struct target_ops *o
   memcpy (readbuf, buf + offset, len);
   return len;
 }
+
+/* Create a prototype generic SPARC target.  The client can override
+   it with local methods.  */
+
+struct target_ops *
+sparc_target (void)
+{
+  struct target_ops *t;
+
+  t = inf_ptrace_target ();
+  t->to_fetch_registers = fetch_inferior_registers;
+  t->to_store_registers = store_inferior_registers;
+  return t;
+}
 
 
 /* Provide a prototype to silence -Wmissing-prototypes.  */
Index: sparc-nat.h
===================================================================
RCS file: /cvs/src/src/gdb/sparc-nat.h,v
retrieving revision 1.2
diff -u -p -r1.2 sparc-nat.h
--- sparc-nat.h 3 Jan 2004 10:08:44 -0000 1.2
+++ sparc-nat.h 12 Oct 2004 22:17:40 -0000
@@ -1,6 +1,6 @@
 /* Native-dependent code for SPARC.
 
-   Copyright 2003 Free Software Foundation, Inc.
+   Copyright 2003, 2004 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -37,4 +37,9 @@ extern int (*sparc_fpregset_supplies_p) 
 extern int sparc32_gregset_supplies_p (int regnum);
 extern int sparc32_fpregset_supplies_p (int regnum);
 
+/* Create a prototype generic SPARC target.  The client can override
+   it with local methods.  */
+
+extern struct target_ops *sparc_target (void);
+
 #endif /* sparc-nat.h */
Index: sparc64nbsd-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc64nbsd-nat.c,v
retrieving revision 1.5
diff -u -p -r1.5 sparc64nbsd-nat.c
--- sparc64nbsd-nat.c 23 Jul 2004 10:33:37 -0000 1.5
+++ sparc64nbsd-nat.c 12 Oct 2004 22:17:40 -0000
@@ -21,6 +21,7 @@
 
 #include "defs.h"
 #include "regcache.h"
+#include "target.h"
 
 #include "sparc64-tdep.h"
 #include "sparc-nat.h"
@@ -169,6 +170,9 @@ _initialize_sparc64nbsd_nat (void)
   sparc_gregset_supplies_p = sparc64nbsd_gregset_supplies_p;
   sparc_fpregset_supplies_p = sparc64nbsd_fpregset_supplies_p;
 
+  /* We've got nothing to add to the generic SPARC target.  */
+  add_target (sparc_target ());
+
   /* Support debugging kernel virtual memory images.  */
   bsd_kvm_add_target (sparc64nbsd_supply_pcb);
 }
Index: sparcnbsd-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/sparcnbsd-nat.c,v
retrieving revision 1.6
diff -u -p -r1.6 sparcnbsd-nat.c
--- sparcnbsd-nat.c 22 Jul 2004 23:07:37 -0000 1.6
+++ sparcnbsd-nat.c 12 Oct 2004 22:17:40 -0000
@@ -20,8 +20,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
-#include "gdbcore.h"
 #include "regcache.h"
+#include "target.h"
 
 #include "sparc-tdep.h"
 #include "sparc-nat.h"
@@ -66,6 +66,9 @@ _initialize_sparcnbsd_nat (void)
 {
   sparc_gregset = &sparc32nbsd_gregset;
 
+  /* We've got nothing to add to the generic SPARC target.  */
+  add_target (sparc_target ());
+
   /* Support debugging kernel virtual memory images.  */
   bsd_kvm_add_target (sparc32nbsd_supply_pcb);
 }
Index: config/sparc/fbsd.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/fbsd.mh,v
retrieving revision 1.4
diff -u -p -r1.4 fbsd.mh
--- config/sparc/fbsd.mh 3 Jan 2004 10:08:45 -0000 1.4
+++ config/sparc/fbsd.mh 12 Oct 2004 22:17:40 -0000
@@ -1,5 +1,5 @@
 # Host: FreeBSD/sparc64
 NATDEPFILES= sparc64fbsd-nat.o sparc64-nat.o sparc-nat.o \
-	fork-child.o infptrace.o inftarg.o \
+	fork-child.o inf-ptrace.o infptrace.o inftarg.o \
 	solib.o solib-svr4.o solib-legacy.o
 NAT_FILE= nm-fbsd.h
Index: config/sparc/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/linux.mh,v
retrieving revision 1.13
diff -u -p -r1.13 linux.mh
--- config/sparc/linux.mh 28 Sep 2004 17:29:12 -0000 1.13
+++ config/sparc/linux.mh 12 Oct 2004 22:17:40 -0000
@@ -1,7 +1,7 @@
 # Host: GNU/Linux SPARC
 NAT_FILE= nm-linux.h
 NATDEPFILES= sparc-nat.o sparc-sol2-nat.o \
-	corelow.o core-regset.o fork-child.o \
+	corelow.o core-regset.o fork-child.o inf-ptrace.o \
 	infptrace.o inftarg.o \
 	proc-service.o thread-db.o \
 	gcore.o linux-nat.o
Index: config/sparc/linux64.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/linux64.mh,v
retrieving revision 1.4
diff -u -p -r1.4 linux64.mh
--- config/sparc/linux64.mh 28 Sep 2004 17:29:12 -0000 1.4
+++ config/sparc/linux64.mh 12 Oct 2004 22:17:40 -0000
@@ -2,7 +2,7 @@
 NAT_FILE= nm-linux.h
 NATDEPFILES= sparc-nat.o sparc64-nat.o sparc-sol2-nat.o sparc64-linux-nat.o \
 	corelow.o core-regset.o \
-	fork-child.o infptrace.o inftarg.o \
+	fork-child.o inf-ptrace.o infptrace.o inftarg.o \
 	proc-service.o thread-db.o \
 	gcore.o linux-nat.o
 
Index: config/sparc/nbsd64.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/nbsd64.mh,v
retrieving revision 1.3
diff -u -p -r1.3 nbsd64.mh
--- config/sparc/nbsd64.mh 23 Jul 2004 10:33:37 -0000 1.3
+++ config/sparc/nbsd64.mh 12 Oct 2004 22:17:40 -0000
@@ -1,6 +1,6 @@
 # Host: NetBSD/sparc64
-NATDEPFILES= sparc64nbsd-nat.o sparc-nat.o bsd-kvm.o \
-	fork-child.o infptrace.o inftarg.o
+NATDEPFILES= fork-child.o inf-ptrace.o \
+	sparc64nbsd-nat.o sparc-nat.o bsd-kvm.o
 NAT_FILE= nm-nbsd.h
 
 LOADLIBES= -lkvm
Index: config/sparc/nbsdaout.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/nbsdaout.mh,v
retrieving revision 1.3
diff -u -p -r1.3 nbsdaout.mh
--- config/sparc/nbsdaout.mh 3 Jan 2004 10:08:45 -0000 1.3
+++ config/sparc/nbsdaout.mh 12 Oct 2004 22:17:40 -0000
@@ -1,4 +1,6 @@
 # Host: NetBSD/sparc a.out
-NATDEPFILES= sparc-nat.o sparcnbsd-nat.o \
-	fork-child.o infptrace.o inftarg.o solib-sunos.o
-NAT_FILE= nm-nbsdaout.h
+NATDEPFILES= fork-child.o inf-ptrace.o \
+	sparc-nat.o sparcnbsd-nat.o bsd-kvm.o solib-sunos.o
+NAT_FILE= nm-nbsd.h
+
+LOADLIBES= -lkvm
Index: config/sparc/nbsdelf.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/nbsdelf.mh,v
retrieving revision 1.12
diff -u -p -r1.12 nbsdelf.mh
--- config/sparc/nbsdelf.mh 22 May 2004 22:34:44 -0000 1.12
+++ config/sparc/nbsdelf.mh 12 Oct 2004 22:17:40 -0000
@@ -1,6 +1,6 @@
 # Host: NetBSD/sparc ELF
-NATDEPFILES= sparc-nat.o sparcnbsd-nat.o bsd-kvm.o \
-	fork-child.o infptrace.o inftarg.o
+NATDEPFILES= fork-child.o inf-ptrace.o \
+	sparc-nat.o sparcnbsd-nat.o bsd-kvm.o
 NAT_FILE= nm-nbsd.h
 
 LOADLIBES= -lkvm



More information about the Gdb-patches mailing list