2004-09-19 Mark Kettenis <kettenis@gnu.org>
+ * 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
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
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) \
$(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) \
# 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
# 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
# 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
/* 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
\f
/* Support for the user struct. */
# 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
-
# 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
#include "i386-tdep.h"
#include "i387-tdep.h"
+#include "i386bsd-nat.h"
+#include "inf-ptrace.h"
\f
/* In older BSD versions we cannot get at some of the segment
/* 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))
{
/* 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))
{
#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;
+}
\f
/* Support for debug registers. */
--- /dev/null
+/* 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 */
#include "defs.h"
#include "inferior.h"
#include "regcache.h"
+#include "target.h"
#include <sys/types.h>
#include <sys/ptrace.h>
#include <sys/sysctl.h>
+#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;
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
#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. */
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);
}