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]

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


This cleans up config/i386/nm-fbsd64.h.  I'll remove it in a seperate
patch.

Mark


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

	* amd64-nat.h: Update copyright year.
	(amd64bsd_target): New prototype.
	* amd64bsd-nat.c: Include "target.h" and "inf-ptrace.h".
	(amd64bsd_target): New function.
	(amd64bsd_fetch_inferior_registers): Rename from
	fetch_inferior_registers.  Make static.
	(amd64bsd_store_inferior_registers): Rename from
	store_inferior_registers.  Make static.
	* amd64fbsd-nat.c: Include "target.h" and "fbsd-nat.h".
	(_initialize_amd64fbsd_nat): Construct and add target vector.
	* amd64nbsd-nat.o: Include "target.h".
	(_initialize_amd64nbsd_nat): Construct and add target vector.
	* amd64obsd-nat.c: Include "target.h".
	(_initialize_amd64obsd_nat): Construct and add target vector.
	* config/i386/nm-fbsd64.h (CHILD_PID_TO_EXEC_FILE): Remove define.
	* config/i386/fbsd64.mh (NATDEPFILES): Remove infptrace.o,
	inftarg.o and fbsd-proc.o.  Add inf-child.o, inf-ptrace.o and
	fbsd-nat.o.
	* config/i386/nbsd64.mh, config/i386/obsd64.mh (NATDEPFILES):
	Remove infptrace.o and inftarg.o.  Add inf-child.o and
	inf-ptrace.o.
	* Makefile.in (amd64bsd-nat.o, amd64fbsd-nat.o, amd64nbsd-nat.o)
	(amd64obsd-nat.o): Update dependencies.

Index: amd64-nat.h
===================================================================
RCS file: /cvs/src/src/gdb/amd64-nat.h,v
retrieving revision 1.2
diff -u -p -r1.2 amd64-nat.h
--- amd64-nat.h 29 Aug 2003 17:18:27 -0000 1.2
+++ amd64-nat.h 26 Sep 2004 18:39:07 -0000
@@ -1,6 +1,6 @@
 /* Native-dependent code for AMD64.
 
-   Copyright 2003 Free Software Foundation, Inc.
+   Copyright 2003, 2004 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -50,4 +50,9 @@ extern void amd64_supply_native_gregset 
 extern void amd64_collect_native_gregset (const struct regcache *regcache,
 					  void *gregs, int regnum);
 
+/* Create a prototype *BSD/amd64 target.  The client can override it
+   with local methods.  */
+
+extern struct target_ops *amd64bsd_target (void);
+
 #endif /* amd64-nat.h */
Index: amd64bsd-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64bsd-nat.c,v
retrieving revision 1.6
diff -u -p -r1.6 amd64bsd-nat.c
--- amd64bsd-nat.c 14 Aug 2004 23:37:04 -0000 1.6
+++ amd64bsd-nat.c 26 Sep 2004 18:39:07 -0000
@@ -22,6 +22,7 @@
 #include "defs.h"
 #include "inferior.h"
 #include "regcache.h"
+#include "target.h"
 
 /* We include <signal.h> to make sure `struct fxsave64' is defined on
    NetBSD, since NetBSD's <machine/reg.h> needs it.  */
@@ -33,13 +34,14 @@
 
 #include "amd64-tdep.h"
 #include "amd64-nat.h"
+#include "inf-ptrace.h"
 
 
 /* Fetch register REGNUM from the inferior.  If REGNUM is -1, do this
    for all registers (including the floating-point registers).  */
 
-void
-fetch_inferior_registers (int regnum)
+static void
+amd64bsd_fetch_inferior_registers (int regnum)
 {
   if (regnum == -1 || amd64_native_gregset_supplies_p (regnum))
     {
@@ -69,8 +71,8 @@ fetch_inferior_registers (int regnum)
 /* Store register REGNUM back into the inferior.  If REGNUM is -1, do
    this for all registers (including the floating-point registers).  */
 
-void
-store_inferior_registers (int regnum)
+static void
+amd64bsd_store_inferior_registers (int regnum)
 {
   if (regnum == -1 || amd64_native_gregset_supplies_p (regnum))
     {
@@ -105,3 +107,17 @@ store_inferior_registers (int regnum)
 	perror_with_name ("Couldn't write floating point status");
     }
 }
+
+/* Create a prototype *BSD/amd64 target.  The client can override it
+   with local methods.  */
+
+struct target_ops *
+amd64bsd_target (void)
+{
+  struct target_ops *t;
+
+  t = inf_ptrace_target ();
+  t->to_fetch_registers = amd64bsd_fetch_inferior_registers;
+  t->to_store_registers = amd64bsd_store_inferior_registers;
+  return t;
+}
Index: amd64fbsd-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64fbsd-nat.c,v
retrieving revision 1.15
diff -u -p -r1.15 amd64fbsd-nat.c
--- amd64fbsd-nat.c 27 Jun 2004 15:44:22 -0000 1.15
+++ amd64fbsd-nat.c 26 Sep 2004 18:39:07 -0000
@@ -22,6 +22,7 @@
 #include "defs.h"
 #include "inferior.h"
 #include "regcache.h"
+#include "target.h"
 
 #include "gdb_assert.h"
 #include <signal.h>
@@ -31,6 +32,7 @@
 #include <sys/sysctl.h>
 #include <machine/reg.h>
 
+#include "fbsd-nat.h"
 #include "amd64-tdep.h"
 #include "amd64-nat.h"
 
@@ -138,11 +140,22 @@ void _initialize_amd64fbsd_nat (void);
 void
 _initialize_amd64fbsd_nat (void)
 {
+  struct target_ops *t;
   int offset;
 
   amd64_native_gregset32_reg_offset = amd64fbsd32_r_reg_offset;
   amd64_native_gregset64_reg_offset = amd64fbsd64_r_reg_offset;
 
+  /* Add some extra features to the common *BSD/i386 target.  */
+  t = amd64bsd_target ();
+  t->to_pid_to_exec_file = fbsd_pid_to_exec_file;
+  t->to_find_memory_regions = fbsd_find_memory_regions;
+  t->to_make_corefile_notes = fbsd_make_corefile_notes;
+  add_target (t);
+
+  /* Support debugging kernel virtual memory images.  */
+  bsd_kvm_add_target (amd64fbsd_supply_pcb);
+
   /* To support the recognition of signal handlers, i386bsd-tdep.c
      hardcodes some constants.  Inclusion of this file means that we
      are compiling a native debugger, which means that we can use the
@@ -219,7 +232,4 @@ Please report this to <bug-gdb@gnu.org>.
 	amd64fbsd_sigtramp_end_addr = ps_strings;
       }
   }
-
-  /* Support debugging kernel virtual memory images.  */
-  bsd_kvm_add_target (amd64fbsd_supply_pcb);
 }
Index: amd64nbsd-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64nbsd-nat.c,v
retrieving revision 1.3
diff -u -p -r1.3 amd64nbsd-nat.c
--- amd64nbsd-nat.c 25 Feb 2004 20:59:12 -0000 1.3
+++ amd64nbsd-nat.c 26 Sep 2004 18:39:07 -0000
@@ -20,6 +20,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
+#include "target.h"
 
 #include "gdb_assert.h"
 
@@ -65,4 +66,7 @@ _initialize_amd64nbsd_nat (void)
   amd64_native_gregset32_reg_offset = amd64nbsd32_r_reg_offset;
   amd64_native_gregset32_num_regs = ARRAY_SIZE (amd64nbsd32_r_reg_offset);
   amd64_native_gregset64_reg_offset = amd64nbsd_r_reg_offset;
+
+  /* We've got nothing to add to the common *BSD/amd64 target.  */
+  add_target (amd64bsd_target ());
 }
Index: amd64obsd-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64obsd-nat.c,v
retrieving revision 1.3
diff -u -p -r1.3 amd64obsd-nat.c
--- amd64obsd-nat.c 22 May 2004 22:42:53 -0000 1.3
+++ amd64obsd-nat.c 26 Sep 2004 18:39:08 -0000
@@ -22,6 +22,7 @@
 #include "defs.h"
 #include "gdbcore.h"
 #include "regcache.h"
+#include "target.h"
 
 #include "gdb_assert.h"
 
@@ -138,6 +139,9 @@ _initialize_amd64obsd_nat (void)
   amd64_native_gregset32_num_regs = ARRAY_SIZE (amd64obsd32_r_reg_offset);
   amd64_native_gregset64_reg_offset = amd64obsd_r_reg_offset;
 
+  /* We've got nothing to add to the common *BSD/amd64 target.  */
+  add_target (amd64bsd_target ());
+
   /* Support debugging kernel virtual memory images.  */
   bsd_kvm_add_target (amd64obsd_supply_pcb);
 }
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.627
diff -u -p -r1.627 Makefile.in
--- Makefile.in 24 Sep 2004 18:17:58 -0000 1.627
+++ Makefile.in 26 Sep 2004 18:39:11 -0000
@@ -1646,9 +1646,11 @@ alpha-tdep.o: alpha-tdep.c $(defs_h) $(d
 	$(regcache_h) $(reggroups_h) $(arch_utils_h) $(osabi_h) $(block_h) \
 	$(infcall_h) $(elf_bfd_h) $(alpha_tdep_h)
 amd64bsd-nat.o: amd64bsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
-	$(gdb_assert_h) $(amd64_tdep_h) $(amd64_nat_h)
+	$(target_h) $(gdb_assert_h) $(amd64_tdep_h) $(amd64_nat_h) \
+	$(inf_ptrace_h)
 amd64fbsd-nat.o: amd64fbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
-	$(gdb_assert_h) $(amd64_tdep_h) $(amd64_nat_h) $(bsd_kvm_h)
+	$(target_h) $(gdb_assert_h) $(fbsd_nat_h) $(amd64_tdep_h) \
+	$(amd64_nat_h) $(bsd_kvm_h)
 amd64fbsd-tdep.o: amd64fbsd-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \
 	$(gdbcore_h) $(regcache_h) $(osabi_h) $(gdb_string_h) \
 	$(amd64_tdep_h) $(solib_svr4_h)
@@ -1661,13 +1663,13 @@ amd64-linux-tdep.o: amd64-linux-tdep.c $
 	$(solib_svr4_h)
 amd64-nat.o: amd64-nat.c $(defs_h) $(gdbarch_h) $(regcache_h) \
 	$(gdb_assert_h) $(gdb_string_h) $(i386_tdep_h) $(amd64_tdep_h)
-amd64nbsd-nat.o: amd64nbsd-nat.c $(defs_h) $(gdb_assert_h) $(amd64_tdep_h) \
-	$(amd64_nat_h)
+amd64nbsd-nat.o: amd64nbsd-nat.c $(defs_h) $(target_h) $(gdb_assert_h) \
+	$(amd64_tdep_h) $(amd64_nat_h)
 amd64nbsd-tdep.o: amd64nbsd-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \
 	$(gdbcore_h) $(osabi_h) $(symtab_h) $(gdb_assert_h) $(amd64_tdep_h) \
 	$(nbsd_tdep_h) $(solib_svr4_h)
 amd64obsd-nat.o: amd64obsd-nat.c $(defs_h) $(gdbcore_h) $(regcache_h) \
-	$(gdb_assert_h) $(amd64_tdep_h) $(amd64_nat_h) $(bsd_kvm_h)
+	$(target_h) $(gdb_assert_h) $(amd64_tdep_h) $(amd64_nat_h) $(bsd_kvm_h)
 amd64obsd-tdep.o: amd64obsd-tdep.c $(defs_h) $(frame_h) $(gdbcore_h) \
 	$(symtab_h) $(objfiles_h) $(osabi_h) $(regset_h) $(target_h) \
 	$(gdb_assert_h) $(gdb_string_h) $(amd64_tdep_h) $(i387_tdep_h) \
Index: config/i386/fbsd64.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/fbsd64.mh,v
retrieving revision 1.7
diff -u -p -r1.7 fbsd64.mh
--- config/i386/fbsd64.mh 29 Jul 2004 20:04:20 -0000 1.7
+++ config/i386/fbsd64.mh 26 Sep 2004 18:39:11 -0000
@@ -1,7 +1,7 @@
 # Host: FreeBSD/amd64
-NATDEPFILES= fork-child.o infptrace.o inftarg.o \
-	amd64-nat.o amd64bsd-nat.o amd64fbsd-nat.o \
-	gcore.o fbsd-proc.o bsd-kvm.o
+NATDEPFILES= fork-child.o inf-child.o inf-ptrace.o \
+	fbsd-nat.o amd64-nat.o amd64bsd-nat.o amd64fbsd-nat.o \
+	gcore.o bsd-kvm.o
 NAT_FILE= nm-fbsd64.h
 
 LOADLIBES= -lkvm
Index: config/i386/nbsd64.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nbsd64.mh,v
retrieving revision 1.4
diff -u -p -r1.4 nbsd64.mh
--- config/i386/nbsd64.mh 3 Sep 2004 19:08:18 -0000 1.4
+++ config/i386/nbsd64.mh 26 Sep 2004 18:39:11 -0000
@@ -1,4 +1,4 @@
 # Host: NetBSD/amd64
-NATDEPFILES= fork-child.o infptrace.o inftarg.o \
+NATDEPFILES= fork-child.o inf-child.o inf-ptrace.o \
 	amd64-nat.o amd64bsd-nat.o amd64nbsd-nat.o
 NAT_FILE= config/nm-nbsd.h
Index: config/i386/nm-fbsd64.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-fbsd64.h,v
retrieving revision 1.3
diff -u -p -r1.3 nm-fbsd64.h
--- config/i386/nm-fbsd64.h 13 Mar 2004 13:07:20 -0000 1.3
+++ config/i386/nm-fbsd64.h 26 Sep 2004 18:39:11 -0000
@@ -25,7 +25,4 @@
 /* Get generic BSD native definitions.  */
 #include "config/nm-bsd.h"
 
-/* Override child_pid_to_exec_file in 'inftarg.c'.  */
-#define CHILD_PID_TO_EXEC_FILE
-
 #endif /* nm-fbsd64.h */
Index: config/i386/obsd64.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/obsd64.mh,v
retrieving revision 1.5
diff -u -p -r1.5 obsd64.mh
--- config/i386/obsd64.mh 3 Sep 2004 19:08:18 -0000 1.5
+++ config/i386/obsd64.mh 26 Sep 2004 18:39:11 -0000
@@ -1,5 +1,5 @@
 # Host: OpenBSD/amd64
-NATDEPFILES= fork-child.o infptrace.o inftarg.o \
+NATDEPFILES= fork-child.o inf-child.o inf-ptrace.o \
 	amd64-nat.o amd64bsd-nat.o amd64obsd-nat.o bsd-kvm.o
 NAT_FILE= config/nm-nbsd.h
 


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