From 1b9445c221ae5af50d982e82d241d11a4ac36764 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Tue, 12 Oct 2004 22:18:55 +0000 Subject: [PATCH] * 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. --- gdb/ChangeLog | 23 +++++++++++++++++++++++ gdb/Makefile.in | 6 +++--- gdb/config/sparc/fbsd.mh | 2 +- gdb/config/sparc/linux.mh | 2 +- gdb/config/sparc/linux64.mh | 2 +- gdb/config/sparc/nbsd64.mh | 4 ++-- gdb/config/sparc/nbsdaout.mh | 8 +++++--- gdb/config/sparc/nbsdelf.mh | 4 ++-- gdb/sparc-nat.c | 15 +++++++++++++++ gdb/sparc-nat.h | 7 ++++++- gdb/sparc64nbsd-nat.c | 4 ++++ gdb/sparcnbsd-nat.c | 5 ++++- 12 files changed, 67 insertions(+), 15 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 56246f2d564..a4a8fd368d8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,28 @@ 2004-10-12 Mark Kettenis + * 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. + * defs.h [!FOPEN_RB]: Include "fopen-bin.h" instead of "fopen-same.h". Update comment. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 51fa3ce68d0..fb3073278cc 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -2533,7 +2533,7 @@ sparc64-linux-tdep.o: sparc64-linux-tdep.c $(defs_h) $(gdbarch_h) $(osabi_h) \ $(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 $(defs_h) $(floatformat_h) $(frame_h) \ $(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) \ diff --git a/gdb/config/sparc/fbsd.mh b/gdb/config/sparc/fbsd.mh index fb491a55c47..ec9a31a5c79 100644 --- a/gdb/config/sparc/fbsd.mh +++ b/gdb/config/sparc/fbsd.mh @@ -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 diff --git a/gdb/config/sparc/linux.mh b/gdb/config/sparc/linux.mh index 67ed9656276..abd3ed87bea 100644 --- a/gdb/config/sparc/linux.mh +++ b/gdb/config/sparc/linux.mh @@ -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 diff --git a/gdb/config/sparc/linux64.mh b/gdb/config/sparc/linux64.mh index 5f6aed5235e..05a63b03ef8 100644 --- a/gdb/config/sparc/linux64.mh +++ b/gdb/config/sparc/linux64.mh @@ -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 diff --git a/gdb/config/sparc/nbsd64.mh b/gdb/config/sparc/nbsd64.mh index 9ac8cf477d2..95d4166bc9f 100644 --- a/gdb/config/sparc/nbsd64.mh +++ b/gdb/config/sparc/nbsd64.mh @@ -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 diff --git a/gdb/config/sparc/nbsdaout.mh b/gdb/config/sparc/nbsdaout.mh index 8944e60e483..cd0067d2088 100644 --- a/gdb/config/sparc/nbsdaout.mh +++ b/gdb/config/sparc/nbsdaout.mh @@ -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 diff --git a/gdb/config/sparc/nbsdelf.mh b/gdb/config/sparc/nbsdelf.mh index 611a6a4d2ad..d258fccd514 100644 --- a/gdb/config/sparc/nbsdelf.mh +++ b/gdb/config/sparc/nbsdelf.mh @@ -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 diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c index 858e2787dff..a3836ce892e 100644 --- a/gdb/sparc-nat.c +++ b/gdb/sparc-nat.c @@ -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 *ops, enum target_object object, 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. */ diff --git a/gdb/sparc-nat.h b/gdb/sparc-nat.h index 8f99b1eea11..25ecc637b28 100644 --- a/gdb/sparc-nat.h +++ b/gdb/sparc-nat.h @@ -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) (int); 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 */ diff --git a/gdb/sparc64nbsd-nat.c b/gdb/sparc64nbsd-nat.c index 7d554cf6089..fe9e006b8dc 100644 --- a/gdb/sparc64nbsd-nat.c +++ b/gdb/sparc64nbsd-nat.c @@ -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); } diff --git a/gdb/sparcnbsd-nat.c b/gdb/sparcnbsd-nat.c index fa663f2478c..4b0eb12136c 100644 --- a/gdb/sparcnbsd-nat.c +++ b/gdb/sparcnbsd-nat.c @@ -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); } -- 2.39.2