From: Mark Kettenis Date: Sun, 19 Sep 2004 20:49:26 +0000 (+0000) Subject: * i386bsd-nat.c: Include "i386bsd-nat.h" and "inf-ptrace.h". X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9692934b4ce2df4304f7b38411d3d1959264c5e3;p=binutils-gdb.git * i386bsd-nat.c: Include "i386bsd-nat.h" and "inf-ptrace.h". (i386bsd_fetch_inferior_registers): Rename from fetch_inferior_registers. Make static. (i386bsd_store_inferior_registers): Rename from store_inferior_registers. Make static. (i386bsd_target): New function. * i386bsd-nat.h: New file. * i386fbsd-nat.c: Include "target.h", "fbsd-nat.h" and "i386bsd-nat.h". (i386fbsd_resume): Rename from child_resume. Make static. (_initialize_i386fbsd_nat): Construct and add target vector. * i386nbsd-nat.c: Include "target.h" and "i386bsd-nat.h". (_initialize_i386nbsd_nat): Construct and add target vector. * config/i386/nm-fbsd.h: (CHILD_RESUME, CHILD_PID_TO_EXEC_FILE): Remove defines. * config/i386/fbsd.mh (NATDEPFILES): Add inf-child.o, inf-ptrace.o and fbsd-nat.o. Remove inftarg.o and fbsd-proc.o. * config/i386/nbsdaout.mh (NATDEPFILES): Add inf-child.o, inf-ptrace.o, i386bsd-nat.o and bsd-kvm.o. Remove inftarg.o. (LOADLIBES): New variable. * config/i386/nbsdelf.mh (NATDEPFILES): Add inf-child.o and inf-ptrace.o. Remove inftarg.o. * config/i386/obsd.mh (NATDEPFILES): Add inf-child.o and inf-ptrace.o. Remove inftarg.o. * config/i386/obsdaout.mh (NATDEPFILES): Add inf-child.o, inf-ptrace.o, i386nbsd-nat.o and bsd-kvm.o. Remove inftarg.o. (LOADLIBES): New variable. * Makefile.in (i386bsd_nat_h): New variable. (i386bsd-nat.o, i386fbsd-nat.o, i386nbsd-nat.o): Update dependencies. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5bb6a92e8d6..95125a01d33 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,36 @@ 2004-09-19 Mark Kettenis + * i386bsd-nat.c: Include "i386bsd-nat.h" and "inf-ptrace.h". + (i386bsd_fetch_inferior_registers): Rename from + fetch_inferior_registers. Make static. + (i386bsd_store_inferior_registers): Rename from + store_inferior_registers. Make static. + (i386bsd_target): New function. + * i386bsd-nat.h: New file. + * i386fbsd-nat.c: Include "target.h", "fbsd-nat.h" and + "i386bsd-nat.h". + (i386fbsd_resume): Rename from child_resume. Make static. + (_initialize_i386fbsd_nat): Construct and add target vector. + * i386nbsd-nat.c: Include "target.h" and "i386bsd-nat.h". + (_initialize_i386nbsd_nat): Construct and add target vector. + * config/i386/nm-fbsd.h: (CHILD_RESUME, CHILD_PID_TO_EXEC_FILE): + Remove defines. + * config/i386/fbsd.mh (NATDEPFILES): Add inf-child.o, inf-ptrace.o + and fbsd-nat.o. Remove inftarg.o and fbsd-proc.o. + * config/i386/nbsdaout.mh (NATDEPFILES): Add inf-child.o, + inf-ptrace.o, i386bsd-nat.o and bsd-kvm.o. Remove inftarg.o. + (LOADLIBES): New variable. + * config/i386/nbsdelf.mh (NATDEPFILES): Add inf-child.o and + inf-ptrace.o. Remove inftarg.o. + * config/i386/obsd.mh (NATDEPFILES): Add inf-child.o and + inf-ptrace.o. Remove inftarg.o. + * config/i386/obsdaout.mh (NATDEPFILES): Add inf-child.o, + inf-ptrace.o, i386nbsd-nat.o and bsd-kvm.o. Remove inftarg.o. + (LOADLIBES): New variable. + * Makefile.in (i386bsd_nat_h): New variable. + (i386bsd-nat.o, i386fbsd-nat.o, i386nbsd-nat.o): Update + dependencies. + * sparc64nbsd-tdep.c: Include "objfiles.h". (sparc64nbsd_init_abi): Set in_solib_call_trampoline and skip_trampoline_code. Set solib_svr4_fetch_link_map_offsets to diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 1bff56692d0..ca1ec9a63b7 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -699,6 +699,7 @@ glibc_tdep_h = glibc-tdep.h gnu_nat_h = gnu-nat.h gregset_h = gregset.h hppa_tdep_h = hppa-tdep.h +i386bsd_nat_h = i386bsd-nat.h i386_linux_tdep_h = i386-linux-tdep.h i386_tdep_h = i386-tdep.h i387_tdep_h = i387-tdep.h @@ -1974,13 +1975,15 @@ hpread.o: hpread.c $(defs_h) $(bfd_h) $(gdb_string_h) $(hp_symtab_h) \ hpux-thread.o: hpux-thread.c $(defs_h) $(gdbthread_h) $(target_h) \ $(inferior_h) $(regcache_h) $(gdb_stat_h) $(gdbcore_h) i386bsd-nat.o: i386bsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ - $(gdb_assert_h) $(i386_tdep_h) $(i387_tdep_h) + $(gdb_assert_h) $(i386_tdep_h) $(i387_tdep_h) $(i386bsd_nat_h) \ + $(inf_ptrace_h) i386bsd-tdep.o: i386bsd-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \ $(gdbcore_h) $(regcache_h) $(osabi_h) $(gdb_string_h) $(i386_tdep_h) i386-cygwin-tdep.o: i386-cygwin-tdep.c $(defs_h) $(osabi_h) $(gdb_string_h) \ $(i386_tdep_h) i386fbsd-nat.o: i386fbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ - $(i386_tdep_h) $(bsd_kvm_h) + $(target_h) $(fbsd_nat_h) $(i386_tdep_h) $(i386bsd_nat_h) \ + $(bsd_kvm_h) i386fbsd-tdep.o: i386fbsd-tdep.c $(defs_h) $(arch_utils_h) $(osabi_h) \ $(i386_tdep_h) $(i387_tdep_h) $(solib_svr4_h) i386gnu-nat.o: i386gnu-nat.c $(defs_h) $(inferior_h) $(floatformat_h) \ @@ -1999,7 +2002,7 @@ i386ly-tdep.o: i386ly-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \ $(regcache_h) $(target_h) $(osabi_h) $(i386_tdep_h) i386-nat.o: i386-nat.c $(defs_h) $(breakpoint_h) $(command_h) $(gdbcmd_h) i386nbsd-nat.o: i386nbsd-nat.c $(defs_h) $(gdbcore_h) $(regcache_h) \ - $(i386_tdep_h) $(bsd_kvm_h) + $(target_h) $(i386_tdep_h) $(i386bsd_nat_h) $(bsd_kvm_h) i386nbsd-tdep.o: i386nbsd-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \ $(gdbcore_h) $(regcache_h) $(regset_h) $(osabi_h) $(symtab_h) \ $(gdb_assert_h) $(gdb_string_h) $(i386_tdep_h) $(i387_tdep_h) \ diff --git a/gdb/config/i386/fbsd.mh b/gdb/config/i386/fbsd.mh index 6f539f79eee..fbbe5bf7135 100644 --- a/gdb/config/i386/fbsd.mh +++ b/gdb/config/i386/fbsd.mh @@ -1,7 +1,7 @@ # Host: FreeBSD/i386 -NATDEPFILES= fork-child.o infptrace.o inftarg.o \ - i386-nat.o i386bsd-nat.o i386fbsd-nat.o \ - gcore.o fbsd-proc.o bsd-kvm.o +NATDEPFILES= fork-child.o inf-child.o inf-ptrace.o infptrace.o \ + fbsd-nat.o i386-nat.o i386bsd-nat.o i386fbsd-nat.o \ + gcore.o bsd-kvm.o NAT_FILE= nm-fbsd.h LOADLIBES= -lkvm diff --git a/gdb/config/i386/nbsdaout.mh b/gdb/config/i386/nbsdaout.mh index d9b94f0d263..9f5e6c4910f 100644 --- a/gdb/config/i386/nbsdaout.mh +++ b/gdb/config/i386/nbsdaout.mh @@ -1,4 +1,7 @@ # Host: NetBSD/i386 a.out -NATDEPFILES= fork-child.o infptrace.o inftarg.o i386bsd-nat.o \ +NATDEPFILES= fork-child.o inf-child.o inf-ptrace.o infptrace.o + i386bsd-nat.o i386nbsd-nat.o bsd-kvm.o \ solib.o solib-sunos.o NAT_FILE= nm-nbsdaout.h + +LOADLIBES= -lkvm diff --git a/gdb/config/i386/nbsdelf.mh b/gdb/config/i386/nbsdelf.mh index 4f9a6fdef88..2e5707d1b9d 100644 --- a/gdb/config/i386/nbsdelf.mh +++ b/gdb/config/i386/nbsdelf.mh @@ -1,5 +1,5 @@ # Host: NetBSD/i386 ELF -NATDEPFILES= fork-child.o infptrace.o inftarg.o \ +NATDEPFILES= fork-child.o inf-child.o inf-ptrace.o infptrace.o \ i386bsd-nat.o i386nbsd-nat.o bsd-kvm.o NAT_FILE= config/nm-nbsd.h diff --git a/gdb/config/i386/nm-fbsd.h b/gdb/config/i386/nm-fbsd.h index 4c5683bcbd9..7374dc9dcea 100644 --- a/gdb/config/i386/nm-fbsd.h +++ b/gdb/config/i386/nm-fbsd.h @@ -54,12 +54,6 @@ extern unsigned long i386bsd_dr_get_status (void); /* Get generic BSD native definitions. */ #include "config/nm-bsd.h" - -/* Override child_resume in `infptrace.c' to work around a kernel bug. */ -#define CHILD_RESUME - -/* Override child_pid_to_exec_file in 'inftarg.c'. */ -#define CHILD_PID_TO_EXEC_FILE /* Support for the user struct. */ diff --git a/gdb/config/i386/obsd.mh b/gdb/config/i386/obsd.mh index 5e5781c7aaf..103ccecf8cd 100644 --- a/gdb/config/i386/obsd.mh +++ b/gdb/config/i386/obsd.mh @@ -1,7 +1,6 @@ # Host: OpenBSD/i386 ELF -NATDEPFILES= fork-child.o infptrace.o inftarg.o \ +NATDEPFILES= fork-child.o inf-child.o inf-ptrace.o infptrace.o \ i386bsd-nat.o i386obsd-nat.o i386nbsd-nat.o bsd-kvm.o NAT_FILE= nm-obsd.h LOADLIBES= -lkvm - diff --git a/gdb/config/i386/obsdaout.mh b/gdb/config/i386/obsdaout.mh index 7b6850f6ef7..656353da932 100644 --- a/gdb/config/i386/obsdaout.mh +++ b/gdb/config/i386/obsdaout.mh @@ -1,4 +1,7 @@ # Host: OpenBSD/i386 a.out -NATDEPFILES= fork-child.o infptrace.o inftarg.o i386bsd-nat.o i386obsd-nat.o \ +NATDEPFILES= fork-child.o inf-child.o inf-ptrace.o infptrace.o \ + i386bsd-nat.o i386nbsd-nat.o i386obsd-nat.o bsd-kvm.o \ solib.o solib-sunos.o NAT_FILE= nm-obsd.h + +LOADLIBES= -lkvm diff --git a/gdb/i386bsd-nat.c b/gdb/i386bsd-nat.c index f54d2f0fb72..349112a4ad0 100644 --- a/gdb/i386bsd-nat.c +++ b/gdb/i386bsd-nat.c @@ -33,6 +33,8 @@ #include "i386-tdep.h" #include "i387-tdep.h" +#include "i386bsd-nat.h" +#include "inf-ptrace.h" /* In older BSD versions we cannot get at some of the segment @@ -128,8 +130,8 @@ i386bsd_collect_gregset (const struct regcache *regcache, /* 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 +i386bsd_fetch_inferior_registers (int regnum) { if (regnum == -1 || GETREGS_SUPPLIES (regnum)) { @@ -178,8 +180,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 +i386bsd_store_inferior_registers (int regnum) { if (regnum == -1 || GETREGS_SUPPLIES (regnum)) { @@ -235,6 +237,20 @@ store_inferior_registers (int regnum) #endif } } + +/* Create a prototype *BSD/i386 target. The client can override it + with local methods. */ + +struct target_ops * +i386bsd_target (void) +{ + struct target_ops *t; + + t = inf_ptrace_target (); + t->to_fetch_registers = i386bsd_fetch_inferior_registers; + t->to_store_registers = i386bsd_store_inferior_registers; + return t; +} /* Support for debug registers. */ diff --git a/gdb/i386bsd-nat.h b/gdb/i386bsd-nat.h new file mode 100644 index 00000000000..a0764ff2f1c --- /dev/null +++ b/gdb/i386bsd-nat.h @@ -0,0 +1,30 @@ +/* Native-dependent code for modern i386 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. */ + +#ifndef I386BSD_NAT_H +#define I386BSD_NAT_H + +/* Create a prototype *BSD/i386 target. The client can override it + with local methods. */ + +extern struct target_ops *i386bsd_target (void); + +#endif /* i386bsd-nat.h */ diff --git a/gdb/i386fbsd-nat.c b/gdb/i386fbsd-nat.c index ed07711ab31..ca3b95d663a 100644 --- a/gdb/i386fbsd-nat.c +++ b/gdb/i386fbsd-nat.c @@ -22,19 +22,21 @@ #include "defs.h" #include "inferior.h" #include "regcache.h" +#include "target.h" #include #include #include +#include "fbsd-nat.h" #include "i386-tdep.h" +#include "i386bsd-nat.h" -/* Resume execution of the inferior process. - If STEP is nonzero, single-step it. - If SIGNAL is nonzero, give it that signal. */ +/* Resume execution of the inferior process. If STEP is nonzero, + single-step it. If SIGNAL is nonzero, give it that signal. */ -void -child_resume (ptid_t ptid, int step, enum target_signal signal) +static void +i386fbsd_resume (ptid_t ptid, int step, enum target_signal signal) { pid_t pid = ptid_get_pid (ptid); int request = PT_STEP; @@ -119,6 +121,16 @@ void _initialize_i386fbsd_nat (void); void _initialize_i386fbsd_nat (void) { + struct target_ops *t; + + /* Add some extra features to the common *BSD/i386 target. */ + t = i386bsd_target (); + t->to_resume = i386fbsd_resume; + 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); + /* FreeBSD provides a kern.ps_strings sysctl that we can use to locate the sigtramp. That way we can still recognize a sigtramp if its location is changed in a new kernel. Of course this is diff --git a/gdb/i386nbsd-nat.c b/gdb/i386nbsd-nat.c index 92da7e18dcd..22af0117e4e 100644 --- a/gdb/i386nbsd-nat.c +++ b/gdb/i386nbsd-nat.c @@ -22,8 +22,10 @@ #include "defs.h" #include "gdbcore.h" #include "regcache.h" +#include "target.h" #include "i386-tdep.h" +#include "i386bsd-nat.h" /* Support for debugging kernel virtual memory images. */ @@ -77,6 +79,9 @@ void _initialize_i386nbsd_nat (void); void _initialize_i386nbsd_nat (void) { + /* We've got nothing to add to the common *BSD/i386 target. */ + add_target (i386bsd_target ()); + /* Support debugging kernel virtual memory images. */ bsd_kvm_add_target (i386nbsd_supply_pcb); }