From 6a5c78a350526e8418a83b0275b5ce4ad0f42d7f Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sun, 26 Sep 2004 18:42:30 +0000 Subject: [PATCH] * 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. --- gdb/ChangeLog | 26 ++++++++++++++++++++++++++ gdb/Makefile.in | 12 +++++++----- gdb/amd64-nat.h | 7 ++++++- gdb/amd64bsd-nat.c | 24 ++++++++++++++++++++---- gdb/amd64fbsd-nat.c | 16 +++++++++++++--- gdb/amd64nbsd-nat.c | 4 ++++ gdb/amd64obsd-nat.c | 4 ++++ gdb/config/i386/fbsd64.mh | 6 +++--- gdb/config/i386/nbsd64.mh | 2 +- gdb/config/i386/nm-fbsd64.h | 3 --- gdb/config/i386/obsd64.mh | 2 +- 11 files changed, 85 insertions(+), 21 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c57ae70..9f5acd8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,29 @@ +2004-09-26 Mark Kettenis + + * 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. + 2004-09-25 Mark Kettenis * config/i386/fbsd.mh (NATDEPFILES): Remove infptrace.o. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index f148868..900c919 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1646,9 +1646,11 @@ alpha-tdep.o: alpha-tdep.c $(defs_h) $(doublest_h) $(frame_h) \ $(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 $(defs_h) $(frame_h) $(gdbcore_h) \ $(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) \ diff --git a/gdb/amd64-nat.h b/gdb/amd64-nat.h index edf6df8..0b8caf2 100644 --- a/gdb/amd64-nat.h +++ b/gdb/amd64-nat.h @@ -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 (struct regcache *regcache, 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 */ diff --git a/gdb/amd64bsd-nat.c b/gdb/amd64bsd-nat.c index b30885a..4393553 100644 --- a/gdb/amd64bsd-nat.c +++ b/gdb/amd64bsd-nat.c @@ -22,6 +22,7 @@ #include "defs.h" #include "inferior.h" #include "regcache.h" +#include "target.h" /* We include to make sure `struct fxsave64' is defined on NetBSD, since NetBSD's 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; +} diff --git a/gdb/amd64fbsd-nat.c b/gdb/amd64fbsd-nat.c index caeaee9..b778761 100644 --- a/gdb/amd64fbsd-nat.c +++ b/gdb/amd64fbsd-nat.c @@ -22,6 +22,7 @@ #include "defs.h" #include "inferior.h" #include "regcache.h" +#include "target.h" #include "gdb_assert.h" #include @@ -31,6 +32,7 @@ #include #include +#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 .", amd64fbsd_sigtramp_end_addr = ps_strings; } } - - /* Support debugging kernel virtual memory images. */ - bsd_kvm_add_target (amd64fbsd_supply_pcb); } diff --git a/gdb/amd64nbsd-nat.c b/gdb/amd64nbsd-nat.c index df7ceb9..911f99e 100644 --- a/gdb/amd64nbsd-nat.c +++ b/gdb/amd64nbsd-nat.c @@ -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 ()); } diff --git a/gdb/amd64obsd-nat.c b/gdb/amd64obsd-nat.c index 0f9b5ef..6f8a601 100644 --- a/gdb/amd64obsd-nat.c +++ b/gdb/amd64obsd-nat.c @@ -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); } diff --git a/gdb/config/i386/fbsd64.mh b/gdb/config/i386/fbsd64.mh index d2dae25..a1f037c 100644 --- a/gdb/config/i386/fbsd64.mh +++ b/gdb/config/i386/fbsd64.mh @@ -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 diff --git a/gdb/config/i386/nbsd64.mh b/gdb/config/i386/nbsd64.mh index 32f82a2..1f44547 100644 --- a/gdb/config/i386/nbsd64.mh +++ b/gdb/config/i386/nbsd64.mh @@ -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 diff --git a/gdb/config/i386/nm-fbsd64.h b/gdb/config/i386/nm-fbsd64.h index 061e77e..cd2bdea 100644 --- a/gdb/config/i386/nm-fbsd64.h +++ b/gdb/config/i386/nm-fbsd64.h @@ -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 */ diff --git a/gdb/config/i386/obsd64.mh b/gdb/config/i386/obsd64.mh index 14d341c..c8cf67f 100644 --- a/gdb/config/i386/obsd64.mh +++ b/gdb/config/i386/obsd64.mh @@ -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 -- 2.7.4