Re: [RFC/RFA] Target vectors for native Linux targets

Daniel Jacobowitz
2005-09-04T22:48:03Z

I'm presenting an alternative patch, stealing bits from mine last
December and other clever bits from Ulrich's. His patch was much
prettier than mine - but missed some important things that generated
ugliness in my first patch (for instance non-FETCH_INFERIOR_REGISTERS
targets). I've come up with cleaner solutions than I did the first
time round.

I've also addressed the comments the first patch received.

On Fri, Aug 19, 2005 at 02:51:24AM +0200, Ulrich Weigand wrote:
> One problem with the conversion is that I wouldn't want to have to
> convert all the various Linux subtargets at the same time. It's a
> lot of work, and I'm unable to test most of those platforms. Thus
> I've thought of a way to stage the conversion:

I bit the bullet and did them all, since I had most of it lying around
anyway.

> To avoid calling child_xfer_memory I had to switch to using xfer_partial
> instead. This change also bubbled up to linux-thread-db.c. (But seeing
> as xfer_memory is deprecated, that's probably a good idea anyway.)

Definitely. I moved the bits around; you preserved only calling
linux_proc_xfer_memory for multi-threaded targets, but in fact the only
reason that was the case was that there was no easy way to call it for
single-threaded targets at the time. So this should speed up GDB a bit
when /proc is available.

This patch has only been tested on i686-pc-linux-gnu at the moment, but
it's been mightily proofread, and I have high confidence in it. It
obsoletes about half your posted patch for S/390 (the watchpoint bits
are an obvious follow-up). Could you give this a spin on S/390 for me?

Assuming it looks good, I will try to dig up another architecture or
two to try.

--
Daniel Jacobowitz
CodeSourcery, LLC

2005-09-04 Daniel Jacobowitz <dan@codesourcery.com>
Ulrich Weigand <uweigand@de.ibm.com>

* Makefile.in (ALLDEPFILES): Update.
(alpha-linux-nat.o, sparc-linux-nat.o): New rules.
(amd64-linux-nat.o, arm-linux-nat.o, hppa-linux-nat.o)
(i386-linux-nat.o, ia64-linux-nat.o, linux-nat.o, m32r-linux-nat.o)
(m68klinux-nat.o, mips-linux-nat.o, ppc-linux-nat.o, s390-nat.o)
(sparc64-linux-nat.o): Update dependencies.
* alpha-linux-nat.c, sparc-linux-nat.c: New files.
* amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(amd64_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(amd64_linux_child_post_start_inferior): Renamed from
child_post_startup_inferior and made static. Call
super_post_startup_inferior.
(super_post_startup_inferior): New.
(_initialize_amd64_linux_nat): Set it. Call linux_target and
add_target.
* arm-linux-nat.c (arm_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(arm_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(_initialize_arm_linux_nat): Add a prototype. Use linux_target and
add_target.
* hppa-linux-nat.c (hppa_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(hppa_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(_initialize_hppa_linux_nat): New function.
* i386-linux-nat.c (i386_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(i386_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(i386_linux_resume): Renamed from child_resume and made static.
(i386_linux_child_post_start_inferior): Renamed from
child_post_startup_inferior and made static. Call
super_post_startup_inferior.
(super_post_startup_inferior): New.
(_initialize_i386_linux_nat): New function.
* i386-nat.c: Remove LINUX_CHILD_POST_STARTUP_INFERIOR #ifndef.
* ia64-linux-nat.c (ia64_linux_xfer_unwind_table): Remove.
(super_xfer_partial): New.
(ia64_linux_xfer_partial): New function. Use it.
(_initialize_ia64_linux_nat): New function.
* inf-ptrace.c (inf_ptrace_fetch_register): Use
gdbarch_cannot_fetch_register. Fix some comments.
(inf_ptrace_store_register): Use gdbarch_cannot_store_register. Fix
some comments.
* linux-nat.c: Include "inf-ptrace.h" and "auxv.h".
(linux_ops, super_xfer_partial): New variables.
(linux_child_post_startup_inferior): Make static.
(child_post_startup_inferior): Delete.
(linux_nat_attach, linux_nat_detach, resume_callback)
(linux_nat_resume, linux_nat_wait, linux_nat_create_inferior)
(linux_nat_mourn_inferior): Use linux_ops instead of
deprecated_child_ops.
(child_wait): Do not depend on CHILD_WAIT.
(linux_nat_xfer_memory): Remove, replace by ...
(linux_nat_xfer_partial): ... this. Use linux_ops->to_xfer_partial
instead of linux_proc_xfer_memory and child_xfer_memory.
(linux_nat_fetch_registers, linux_nat_store_registers)
(linux_nat_child_post_startup_inferior): New functions.
(init_linux_nat_ops): Use the new functions.
(linux_proc_xfer_memory): Remove, replace by ...
(linux_proc_xfer_partial): ... this. Make static.
(linux_xfer_partial, linux_target): New functions.
(_initialize_linux_nat): Do not modify deprecated_child_ops.
* linux-nat.h (linux_proc_xfer_memory): Remove prototype.
(struct mem_attrib, struct target_ops): Remove forward declarations.
(linux_child_post_startup_inferior): Remove prototype.
(linux_target): Add prototype.
* linux-thread-db.c (thread_db_xfer_memory): Remove, replace by ...
(thread_db_xfer_partial): ... this.
(init_thread_db_ops): Set to_xfer_partial instead of
deprecated_xfer_memory.
* m32r-linux-nat.c (m32r_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(m32r_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(_initialize_m32r_linux_nat): New function.
* m68klinux-nat.c (m68k_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(m68k_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(old_fetch_inferior_registers, old_store_inferior_registers): Made
static.
(_initialize_m68k_linux_nat): Use linux_target and add_target.
* mips-linux-nat.c (_initialize_mips_linux_nat): New function.
* ppc-linux-nat.c (ppc_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(ppc_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(_initialize_ppc_linux_nat): New function.
* s390-nat.c (s390_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(s390_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(_initialize_s390_nat): New function.
* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use
linux_target and add_target.
* config/nm-linux.h: Don't include "auxv.h".
(struct target_waitstatus, child_wait, CHILD_WAIT)
(CHILD_PID_TO_EXEC_FILE, CHILD_INSERT_FORK_CATCHPOINT)
(CHILD_INSERT_VFORK_CATCHPOINT, CHILD_INSERT_EXEC_CATCHPOINT)
(CHILD_POST_STARTUP_INFERIOR, CHILD_POST_ATTACH, CHILD_FOLLOW_FORK)
(DEPRECATED_KILL_INFERIOR, NATIVE_XFER_AUXV): Delete.
* config/alpha/alpha-linux.mh (NATDEPFILES): Replace infptrace.o
and inftarg.o with inf-ptrace.o and alpha-linux-nat.o.
* config/sparc/linux.mh (NATDEPFILES): Replace infptrace.o and
inftarg.o with sparc-linux-nat.o.
* config/sparc/linux64.mh (NATDEPFILES): Remove infptrace.o and
inftarg.o.
* config/arm/linux.mh (NATDEPFILES): Replace infptrace.o and
inftarg.o with inf-ptrace.o.
* config/i386/linux.mh (NATDEPFILES): Likewise.
* config/i386/linux64.mh (NATDEPFILES): Likewise.
* config/ia64/linux.mh (NATDEPFILES): Likewise.
* config/m32r/linux.mh (NATDEPFILES): Likewise.
* config/m68k/linux.mh (NATDEPFILES): Likewise.
* config/mips/linux.mh (NATDEPFILES): Likewise.
* config/pa/linux.mh (NATDEPFILES): Likewise.
* config/powerpc/linux.mh (NATDEPFILES): Likewise.
* config/powerpc/ppc64-linux.mh (NATDEPFILES): Likewise.
* config/s390/s390.mh (NATDEPFILES): Likewise.
* config/i386/nm-linux.h (DEPRECATED_CHILD_RESUME): Don't define.
(LINUX_CHILD_POST_STARTUP_INFERIOR): Don't define.
* config/i386/nm-linux64.h (LINUX_CHILD_POST_STARTUP_INFERIOR):
Don't define.
* config/ia64/nm-linux.h: Don't include "target.h".
(NATIVE_XFER_UNWIND_TABLE, ia64_linux_xfer_unwind_table): Remove.
* config/djgpp/fnchange.lst: Add alpha-linux-tdep.c,
alpha-linux-nat.c, sparc-linux-tdep.c, and sparc-linux-nat.c.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.751
diff -u -p -r1.751 Makefile.in
--- Makefile.in 3 Sep 2005 00:35:45 -0000 1.751
+++ Makefile.in 4 Sep 2005 20:58:29 -0000
@@ -1374,7 +1374,7 @@ MAKEOVERRIDES=

ALLDEPFILES = \
aix-thread.c \
- alpha-nat.c alphabsd-nat.c \
+ alpha-nat.c alphabsd-nat.c alpha-linux-nat.c \
alpha-tdep.c alpha-linux-tdep.c alphabsd-tdep.c alphanbsd-tdep.c \
alpha-osf1-tdep.c alphafbsd-tdep.c alpha-mdebug-tdep.c \
amd64-nat.c amd64-tdep.c \
@@ -1416,6 +1416,7 @@ ALLDEPFILES = \
m32r-linux-nat.c m32r-linux-tdep.c \
m68k-tdep.c \
m68kbsd-nat.c m68kbsd-tdep.c \
+ m68klinux-nat.c m68klinux-tdep.c \
m88k-tdep.c m88kbsd-nat.c \
mcore-tdep.c \
mips-linux-nat.c mips-linux-tdep.c \
@@ -1439,6 +1440,7 @@ ALLDEPFILES = \
ser-go32.c ser-pipe.c ser-tcp.c \
sh-tdep.c sh64-tdep.c shnbsd-tdep.c shnbsd-nat.c \
solib-irix.c solib-svr4.c solib-sunos.c \
+ sparc-linux-nat.c \
sparc-linux-tdep.c sparc-nat.c sparc-sol2-nat.c sparc-sol2-tdep.c \
sparc-tdep.c sparc-sol2-nat.c sparc-sol2-tdep.c sparc64-linux-nat.c \
sparc64-linux-tdep.c sparc64-nat.c sparc64-sol2-tdep.c \
@@ -1669,6 +1671,7 @@ alphabsd-tdep.o: alphabsd-tdep.c $(defs_
$(alphabsd_tdep_h)
alphafbsd-tdep.o: alphafbsd-tdep.c $(defs_h) $(value_h) $(osabi_h) \
$(alpha_tdep_h)
+alpha-linux-nat.o: alpha-linux-nat.c $(defs_h) $(target_h) $(linux_nat_h)
alpha-linux-tdep.o: alpha-linux-tdep.c $(defs_h) $(frame_h) $(gdb_assert_h) \
$(osabi_h) $(solib_svr4_h) $(alpha_tdep_h)
alpha-mdebug-tdep.o: alpha-mdebug-tdep.c $(defs_h) $(frame_h) \
@@ -1699,7 +1702,7 @@ amd64fbsd-tdep.o: amd64fbsd-tdep.c $(def
amd64-linux-nat.o: amd64-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
$(regcache_h) $(linux_nat_h) $(gdb_assert_h) $(gdb_string_h) \
$(gdb_proc_service_h) $(gregset_h) $(amd64_tdep_h) \
- $(i386_linux_tdep_h) $(amd64_nat_h)
+ $(i386_linux_tdep_h) $(amd64_nat_h) $(target_h)
amd64-linux-tdep.o: amd64-linux-tdep.c $(defs_h) $(frame_h) $(gdbcore_h) \
$(regcache_h) $(osabi_h) $(symtab_h) $(gdb_string_h) $(amd64_tdep_h) \
$(solib_svr4_h)
@@ -1732,7 +1735,8 @@ arch-utils.o: arch-utils.c $(defs_h) $(a
$(gdb_assert_h) $(sim_regno_h) $(gdbcore_h) $(osabi_h) $(version_h) \
$(floatformat_h)
arm-linux-nat.o: arm-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
- $(gdb_string_h) $(regcache_h) $(arm_tdep_h) $(gregset_h)
+ $(gdb_string_h) $(regcache_h) $(arm_tdep_h) $(gregset_h) \
+ $(target_h) $(linux_nat_h)
arm-linux-tdep.o: arm-linux-tdep.c $(defs_h) $(target_h) $(value_h) \
$(gdbtypes_h) $(floatformat_h) $(gdbcore_h) $(frame_h) $(regcache_h) \
$(doublest_h) $(solib_svr4_h) $(osabi_h) $(arm_tdep_h) \
@@ -2013,7 +2017,8 @@ hppa-hpux-tdep.o: hppa-hpux-tdep.c $(def
$(hppa_tdep_h) $(solib_som_h) $(solib_pa64_h) $(regset_h) \
$(exceptions_h) $(gdb_string_h)
hppa-linux-nat.o: hppa-linux-nat.c $(defs_h) $(gdbcore_h) $(regcache_h) \
- $(gdb_string_h) $(inferior_h) $(hppa_tdep_h) $(gregset_h)
+ $(gdb_string_h) $(inferior_h) $(hppa_tdep_h) $(gregset_h) \
+ $(target_h) $(linux_nat_h)
hppa-linux-tdep.o: hppa-linux-tdep.c $(defs_h) $(gdbcore_h) $(osabi_h) \
$(target_h) $(objfiles_h) $(solib_svr4_h) $(glibc_tdep_h) \
$(frame_unwind_h) $(trad_frame_h) $(dwarf2_frame_h) $(value_h) \
@@ -2050,7 +2055,7 @@ i386gnu-tdep.o: i386gnu-tdep.c $(defs_h)
i386-linux-nat.o: i386-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
$(regcache_h) $(linux_nat_h) $(gdb_assert_h) $(gdb_string_h) \
$(gregset_h) $(i387_tdep_h) $(i386_tdep_h) $(i386_linux_tdep_h) \
- $(gdb_proc_service_h)
+ $(gdb_proc_service_h) $(target_h)
i386-linux-tdep.o: i386-linux-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \
$(value_h) $(regcache_h) $(inferior_h) $(osabi_h) $(reggroups_h) \
$(dwarf2_frame_h) $(gdb_string_h) $(i386_tdep_h) \
@@ -2092,7 +2097,7 @@ i387-tdep.o: i387-tdep.c $(defs_h) $(dou
$(gdb_assert_h) $(gdb_string_h) $(i386_tdep_h) $(i387_tdep_h)
ia64-linux-nat.o: ia64-linux-nat.c $(defs_h) $(gdb_string_h) $(inferior_h) \
$(target_h) $(gdbcore_h) $(regcache_h) $(ia64_tdep_h) $(gdb_wait_h) \
- $(gregset_h)
+ $(gregset_h) $(linux_nat_h)
ia64-linux-tdep.o: ia64-linux-tdep.c $(defs_h) $(ia64_tdep_h) \
$(arch_utils_h) $(gdbcore_h) $(regcache_h) $(osabi_h) $(solib_svr4_h)
ia64-tdep.o: ia64-tdep.c $(defs_h) $(inferior_h) $(gdbcore_h) \
@@ -2174,8 +2179,8 @@ linespec.o: linespec.c $(defs_h) $(symta
$(objc_lang_h) $(linespec_h) $(exceptions_h)
linux-nat.o: linux-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdb_string_h) \
$(gdb_wait_h) $(gdb_assert_h) $(linux_nat_h) $(gdbthread_h) \
- $(gdbcmd_h) $(regcache_h) $(elf_bfd_h) $(gregset_h) $(gdbcore_h) \
- $(gdbthread_h) $(gdb_stat_h)
+ $(gdbcmd_h) $(regcache_h) $(inf_ptrace.h) $(auxv.h) $(elf_bfd_h) \
+ $(gregset_h) $(gdbcore_h) $(gdbthread_h) $(gdb_stat_h)
linux-thread-db.o: linux-thread-db.c $(defs_h) $(gdb_assert_h) \
$(gdb_proc_service_h) $(gdb_thread_db_h) $(bfd_h) $(exceptions_h) \
$(gdbthread_h) $(inferior_h) $(symfile_h) $(objfiles_h) $(target_h) \
@@ -2194,7 +2199,7 @@ m2-valprint.o: m2-valprint.c $(defs_h) $
$(m2_lang_h) $(c_lang_h)
m32r-linux-nat.o: m32r-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
$(regcache_h) $(linux_nat_h) $(gdb_assert_h) $(gdb_string_h) \
- $(gregset_h) $(m32r_tdep_h)
+ $(gregset_h) $(m32r_tdep_h) $(target_h)
m32r-linux-tdep.o: m32r-linux-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \
$(value_h) $(regcache_h) $(inferior_h) $(osabi_h) $(reggroups_h) \
$(regset_h) $(gdb_string_h) $(glibc_tdep_h) $(solib_svr4_h) \
@@ -2225,7 +2230,7 @@ m68kbsd-tdep.o: m68kbsd-tdep.c $(defs_h)
m68klinux-nat.o: m68klinux-nat.c $(defs_h) $(frame_h) $(inferior_h) \
$(language_h) $(gdbcore_h) $(gdb_string_h) $(regcache_h) \
$(m68k_tdep_h) $(gdb_stat_h) $(floatformat_h) $(target_h) \
- $(gregset_h)
+ $(gregset_h) $(target_h) $(linux_nat_h)
m68klinux-tdep.o: m68klinux-tdep.c $(defs_h) $(gdbcore_h) $(doublest_h) \
$(floatformat_h) $(frame_h) $(target_h) $(gdb_string_h) \
$(gdbtypes_h) $(osabi_h) $(regcache_h) $(objfiles_h) $(symtab_h) \
@@ -2276,7 +2281,8 @@ mips64obsd-tdep.o: mips64obsd-tdep.c $(d
$(regset_h) $(trad_frame_h) $(tramp_frame_h) $(gdb_assert_h) \
$(gdb_string_h) $(mips_tdep_h) $(solib_svr4_h)
mips-irix-tdep.o: mips-irix-tdep.c $(defs_h) $(osabi_h) $(elf_bfd_h)
-mips-linux-nat.o: mips-linux-nat.c $(defs_h) $(mips_tdep_h)
+mips-linux-nat.o: mips-linux-nat.c $(defs_h) $(mips_tdep_h) $(target_h) \
+ $(linux_nat_h)
mips-linux-tdep.o: mips-linux-tdep.c $(defs_h) $(gdbcore_h) $(target_h) \
$(solib_svr4_h) $(osabi_h) $(mips_tdep_h) $(gdb_string_h) \
$(gdb_assert_h) $(frame_h) $(regcache_h) $(trad_frame_h) \
@@ -2368,7 +2374,8 @@ ppcbug-rom.o: ppcbug-rom.c $(defs_h) $(g
$(serial_h) $(regcache_h)
ppc-linux-nat.o: ppc-linux-nat.c $(defs_h) $(gdb_string_h) $(frame_h) \
$(inferior_h) $(gdbcore_h) $(regcache_h) $(gdb_assert_h) \
- $(gdb_wait_h) $(gregset_h) $(ppc_tdep_h)
+ $(gdb_wait_h) $(gregset_h) $(ppc_tdep_h) $(target_h) \
+ $(linux_nat_h)
ppc-linux-tdep.o: ppc-linux-tdep.c $(defs_h) $(frame_h) $(inferior_h) \
$(symtab_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(symfile_h) \
$(objfiles_h) $(regcache_h) $(value_h) $(osabi_h) $(regset_h) \
@@ -2479,7 +2486,7 @@ rs6000-tdep.o: rs6000-tdep.c $(defs_h) $
$(ppc_tdep_h) $(gdb_assert_h) $(dis_asm_h) $(trad_frame_h) \
$(frame_unwind_h) $(frame_base_h) $(reggroups_h)
s390-nat.o: s390-nat.c $(defs_h) $(tm_h) $(regcache_h) $(inferior_h) \
- $(s390_tdep_h)
+ $(s390_tdep_h) $(target_h) $(linux_nat_h)
s390-tdep.o: s390-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \
$(symtab_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(objfiles_h) \
$(tm_h) $(__bfd_bfd_h) $(floatformat_h) $(regcache_h) \
@@ -2579,7 +2586,7 @@ sparc64fbsd-tdep.o: sparc64fbsd-tdep.c $
$(target_h) $(trad_frame_h) $(gdb_assert_h) $(gdb_string_h) \
$(sparc64_tdep_h) $(solib_svr4_h)
sparc64-linux-nat.o: sparc64-linux-nat.c $(defs_h) $(sparc64_tdep_h) \
- $(sparc_nat_h)
+ $(sparc_nat_h) $(inferior_h) $(target_h) $(linux_nat_h)
sparc64-linux-tdep.o: sparc64-linux-tdep.c $(defs_h) $(frame_h) \
$(frame_unwind_h) $(gdbarch_h) $(osabi_h) $(solib_svr4_h) \
$(symtab_h) $(trad_frame_h) $(tramp_frame_h) $(sparc64_tdep_h)
@@ -2602,6 +2609,8 @@ sparc64-tdep.o: sparc64-tdep.c $(defs_h)
$(gdbcore_h) $(gdbtypes_h) $(inferior_h) $(symtab_h) $(objfiles_h) \
$(osabi_h) $(regcache_h) $(target_h) $(value_h) $(gdb_assert_h) \
$(gdb_string_h) $(sparc64_tdep_h)
+sparc-linux-nat.o: sparc-linux-nat.c $(defs_h) $(inferior_h) $(target_h) \
+ $(linux_nat_h)
sparc-linux-tdep.o: sparc-linux-tdep.c $(defs_h) $(floatformat_h) $(frame_h) \
$(frame_unwind_h) $(gdbarch_h) $(gdbcore_h) $(osabi_h) $(regcache_h) \
$(solib_svr4_h) $(symtab_h) $(trad_frame_h) $(tramp_frame_h) \
Index: alpha-linux-nat.c
===================================================================
RCS file: alpha-linux-nat.c
diff -N alpha-linux-nat.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ alpha-linux-nat.c 4 Sep 2005 20:58:29 -0000
@@ -0,0 +1,32 @@
+/* Low level Alpha GNU/Linux interface, for GDB when running native.
+ Copyright 2005
+ 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. */
+
+#include "defs.h"
+#include "target.h"
+#include "linux-nat.h"
+
+void _initialialize_alpha_linux_nat (void);
+
+void
+_initialize_alpha_linux_nat (void)
+{
+ add_target (linux_target ());
+}
Index: amd64-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64-linux-nat.c,v
retrieving revision 1.9
diff -u -p -r1.9 amd64-linux-nat.c
--- amd64-linux-nat.c 5 Jan 2005 15:43:42 -0000 1.9
+++ amd64-linux-nat.c 4 Sep 2005 20:58:29 -0000
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux x86-64.

- Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Jiri Smid, SuSE Labs.

This file is part of GDB.
@@ -147,8 +147,8 @@ fill_fpregset (elf_fpregset_t *fpregsetp
this for all registers (including the floating point and SSE
registers). */

-void
-fetch_inferior_registers (int regnum)
+static void
+amd64_linux_fetch_inferior_registers (int regnum)
{
int tid;

@@ -184,8 +184,8 @@ fetch_inferior_registers (int regnum)
-1, do this for all registers (including the floating-point and SSE
registers). */

-void
-store_inferior_registers (int regnum)
+static void
+amd64_linux_store_inferior_registers (int regnum)
{
int tid;

@@ -360,11 +360,13 @@ ps_get_thread_area (const struct ps_proc
}
\f

-void
-child_post_startup_inferior (ptid_t ptid)
+static void (*super_post_startup_inferior) (ptid_t ptid);
+
+static void
+amd64_linux_child_post_startup_inferior (ptid_t ptid)
{
i386_cleanup_dregs ();
- linux_child_post_startup_inferior (ptid);
+ super_post_startup_inferior (ptid);
}
\f

@@ -374,6 +376,8 @@ void _initialize_amd64_linux_nat (void);
void
_initialize_amd64_linux_nat (void)
{
+ struct target_ops *t;
+
amd64_native_gregset32_reg_offset = amd64_linux_gregset32_reg_offset;
amd64_native_gregset32_num_regs = I386_LINUX_NUM_REGS;
amd64_native_gregset64_reg_offset = amd64_linux_gregset64_reg_offset;
@@ -382,4 +386,18 @@ _initialize_amd64_linux_nat (void)
== amd64_native_gregset32_num_regs);
gdb_assert (ARRAY_SIZE (amd64_linux_gregset64_reg_offset)
== amd64_native_gregset64_num_regs);
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Override the GNU/Linux inferior startup hook. */
+ super_post_startup_inferior = t->to_post_startup_inferior;
+ t->to_post_startup_inferior = amd64_linux_child_post_startup_inferior;
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = amd64_linux_fetch_inferior_registers;
+ t->to_store_registers = amd64_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
}
Index: arm-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-linux-nat.c,v
retrieving revision 1.23
diff -u -p -r1.23 arm-linux-nat.c
--- arm-linux-nat.c 29 Mar 2005 16:58:23 -0000 1.23
+++ arm-linux-nat.c 4 Sep 2005 20:58:29 -0000
@@ -1,5 +1,6 @@
/* GNU/Linux on ARM native support.
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2004, 2005
+ Free Software Foundation, Inc.

This file is part of GDB.

@@ -23,6 +24,8 @@
#include "gdbcore.h"
#include "gdb_string.h"
#include "regcache.h"
+#include "target.h"
+#include "linux-nat.h"

#include "arm-tdep.h"

@@ -547,8 +550,8 @@ store_regs (void)
regno == -1, otherwise fetch all general registers or all floating
point registers depending upon the value of regno. */

-void
-fetch_inferior_registers (int regno)
+static void
+arm_linux_fetch_inferior_registers (int regno)
{
if (-1 == regno)
{
@@ -569,8 +572,8 @@ fetch_inferior_registers (int regno)
regno == -1, otherwise store all general registers or all floating
point registers depending upon the value of regno. */

-void
-store_inferior_registers (int regno)
+static void
+arm_linux_store_inferior_registers (int regno)
{
if (-1 == regno)
{
@@ -716,8 +719,22 @@ get_linux_version (unsigned int *vmajor,
return ((*vmajor << 16) | (*vminor << 8) | *vrelease);
}

+void _initialize_arm_linux_nat (void);
+
void
_initialize_arm_linux_nat (void)
{
+ struct target_ops *t;
+
os_version = get_linux_version (&os_major, &os_minor, &os_release);
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = arm_linux_fetch_inferior_registers;
+ t->to_store_registers = arm_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
}
Index: hppa-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-linux-nat.c,v
retrieving revision 1.9
diff -u -p -r1.9 hppa-linux-nat.c
--- hppa-linux-nat.c 11 Feb 2005 04:05:50 -0000 1.9
+++ hppa-linux-nat.c 4 Sep 2005 20:58:29 -0000
@@ -1,6 +1,6 @@
/* Functions specific to running GDB native on HPPA running GNU/Linux.

- Copyright 2004 Free Software Foundation, Inc.
+ Copyright 2004, 2005 Free Software Foundation, Inc.

This file is part of GDB.

@@ -24,6 +24,8 @@
#include "regcache.h"
#include "gdb_string.h"
#include "inferior.h"
+#include "target.h"
+#include "linux-nat.h"

#include <sys/procfs.h>
#include <sys/ptrace.h>
@@ -267,8 +269,8 @@ store_register (int regno)
regno == -1, otherwise fetch all general registers or all floating
point registers depending upon the value of regno. */

-void
-fetch_inferior_registers (int regno)
+static void
+hppa_linux_fetch_inferior_registers (int regno)
{
if (-1 == regno)
{
@@ -285,8 +287,8 @@ fetch_inferior_registers (int regno)
regno == -1, otherwise store all general registers or all floating
point registers depending upon the value of regno. */

-void
-store_inferior_registers (int regno)
+static void
+hppa_linux_store_inferior_registers (int regno)
{
if (-1 == regno)
{
@@ -374,3 +376,21 @@ fill_fpregset (gdb_fpregset_t *fpregsetp
regcache_raw_collect (current_regcache, i, to);
}
}
+
+void _initialize_hppa_linux_nat (void);
+
+void
+_initialize_hppa_linux_nat (void)
+{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = arm_linux_fetch_inferior_registers;
+ t->to_store_registers = arm_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
+}
Index: i386-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-linux-nat.c,v
retrieving revision 1.66
diff -u -p -r1.66 i386-linux-nat.c
--- i386-linux-nat.c 13 Aug 2005 22:03:46 -0000 1.66
+++ i386-linux-nat.c 4 Sep 2005 20:58:29 -0000
@@ -24,6 +24,7 @@
#include "inferior.h"
#include "gdbcore.h"
#include "regcache.h"
+#include "target.h"
#include "linux-nat.h"

#include "gdb_assert.h"
@@ -480,8 +481,8 @@ cannot_store_register (int regno)
this for all registers (including the floating point and SSE
registers). */

-void
-fetch_inferior_registers (int regno)
+static void
+i386_linux_fetch_inferior_registers (int regno)
{
int tid;

@@ -514,7 +515,7 @@ fetch_inferior_registers (int regno)
/* The call above might reset `have_ptrace_getregs'. */
if (!have_ptrace_getregs)
{
- fetch_inferior_registers (regno);
+ i386_linux_fetch_inferior_registers (regno);
return;
}

@@ -552,8 +553,8 @@ fetch_inferior_registers (int regno)
/* Store register REGNO back into the child process. If REGNO is -1,
do this for all registers (including the floating point and SSE
registers). */
-void
-store_inferior_registers (int regno)
+static void
+i386_linux_store_inferior_registers (int regno)
{
int tid;

@@ -755,8 +756,8 @@ static const unsigned char linux_syscall
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
+i386_linux_resume (ptid_t ptid, int step, enum target_signal signal)
{
int pid = PIDGET (ptid);

@@ -814,9 +815,34 @@ child_resume (ptid_t ptid, int step, enu
perror_with_name (("ptrace"));
}

-void
-child_post_startup_inferior (ptid_t ptid)
+static void (*super_post_startup_inferior) (ptid_t ptid);
+
+static void
+i386_linux_child_post_startup_inferior (ptid_t ptid)
{
i386_cleanup_dregs ();
- linux_child_post_startup_inferior (ptid);
+ super_post_startup_inferior (ptid);
+}
+
+void
+_initialize_i386_linux_nat (void)
+{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Override the default ptrace resume method. */
+ t->to_resume = i386_linux_resume;
+
+ /* Override the GNU/Linux inferior startup hook. */
+ super_post_startup_inferior = t->to_post_startup_inferior;
+ t->to_post_startup_inferior = i386_linux_child_post_startup_inferior;
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = i386_linux_fetch_inferior_registers;
+ t->to_store_registers = i386_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
}
Index: i386-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-nat.c,v
retrieving revision 1.11
diff -u -p -r1.11 i386-nat.c
--- i386-nat.c 21 Feb 2005 17:14:03 -0000 1.11
+++ i386-nat.c 4 Sep 2005 20:58:30 -0000
@@ -1,6 +1,6 @@
/* Native-dependent code for the i386.

- Copyright 2001, 2004 Free Software Foundation, Inc.
+ Copyright 2001, 2004, 2005 Free Software Foundation, Inc.

This file is part of GDB.

@@ -231,8 +231,6 @@ i386_cleanup_dregs (void)
dr_status_mirror = 0;
}

-#ifndef LINUX_CHILD_POST_STARTUP_INFERIOR
-
/* Reset all debug registers at each new startup to avoid missing
watchpoints after restart. */

@@ -242,8 +240,6 @@ child_post_startup_inferior (ptid_t ptid
i386_cleanup_dregs ();
}

-#endif /* LINUX_CHILD_POST_STARTUP_INFERIOR */
-
/* Print the values of the mirrored debug registers. This is called
when maint_show_dr is non-zero. To set that up, type "maint
show-debug-regs" at GDB's prompt. */
Index: ia64-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-linux-nat.c,v
retrieving revision 1.28
diff -u -p -r1.28 ia64-linux-nat.c
--- ia64-linux-nat.c 11 Feb 2005 04:05:51 -0000 1.28
+++ ia64-linux-nat.c 4 Sep 2005 20:58:30 -0000
@@ -28,6 +28,7 @@
#include "gdbcore.h"
#include "regcache.h"
#include "ia64-tdep.h"
+#include "linux-nat.h"

#include <signal.h>
#include <sys/ptrace.h>
@@ -666,12 +667,38 @@ ia64_linux_stopped_by_watchpoint (void)
return ia64_linux_stopped_data_address (&addr);
}

-LONGEST
-ia64_linux_xfer_unwind_table (struct target_ops *ops,
- enum target_object object,
- const char *annex,
- void *readbuf, const void *writebuf,
- ULONGEST offset, LONGEST len)
+LONGEST (*super_xfer_partial) (struct target_ops *, enum target_object,
+ const char *, void *, const void *,
+ ULONGEST, LONGEST);
+
+static LONGEST
+ia64_linux_xfer_partial (struct target_ops *ops,
+ enum target_object object,
+ const char *annex,
+ void *readbuf, const void *writebuf,
+ ULONGEST offset, LONGEST len)
+{
+ if (object == TARGET_OBJECT_UNWIND_TABLE && writebuf == NULL && offset == 0)
+ return syscall (__NR_getunwind, readbuf, len);
+
+ return super_xfer_partial (ops, object, annex, readbuf, writebuf,
+ offset, len);
+}
+
+void _initialize_ia64_linux_nat (void);
+
+void
+_initialize_ia64_linux_nat (void)
{
- return syscall (__NR_getunwind, readbuf, len);
+ struct target_ops *t = linux_target ();
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Override the default to_xfer_partial. */
+ super_xfer_partial = t->to_xfer_partial;
+ t->to_xfer_partial = ia64_linux_xfer_partial;
+
+ /* Register the target. */
+ add_target (t);
}
Index: inf-ptrace.c
===================================================================
RCS file: /cvs/src/src/gdb/inf-ptrace.c,v
retrieving revision 1.25
diff -u -p -r1.25 inf-ptrace.c
--- inf-ptrace.c 4 Sep 2005 16:18:19 -0000 1.25
+++ inf-ptrace.c 4 Sep 2005 20:58:30 -0000
@@ -626,8 +626,14 @@ inf_ptrace_fetch_register (int regnum)
PTRACE_TYPE_RET *buf;
int pid, i;

+ if (gdbarch_cannot_fetch_register (current_gdbarch, regnum))
+ {
+ regcache_raw_supply (current_regcache, regnum, NULL);
+ return;
+ }
+
/* Cater for systems like GNU/Linux, that implement threads as
- seperate processes. */
+ separate processes. */
pid = ptid_get_lwp (inferior_ptid);
if (pid == 0)
pid = ptid_get_pid (inferior_ptid);
@@ -639,7 +645,7 @@ inf_ptrace_fetch_register (int regnum)
gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
buf = alloca (size);

- /* Read the register contents from the inferior a chuck at the time. */
+ /* Read the register contents from the inferior a chunk at a time. */
for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
{
errno = 0;
@@ -676,8 +682,11 @@ inf_ptrace_store_register (int regnum)
PTRACE_TYPE_RET *buf;
int pid, i;

+ if (gdbarch_cannot_store_register (current_gdbarch, regnum))
+ return;
+
/* Cater for systems like GNU/Linux, that implement threads as
- seperate processes. */
+ separate processes. */
pid = ptid_get_lwp (inferior_ptid);
if (pid == 0)
pid = ptid_get_pid (inferior_ptid);
@@ -689,7 +698,7 @@ inf_ptrace_store_register (int regnum)
gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
buf = alloca (size);

- /* Write the register contents into the inferior a chunk at the time. */
+ /* Write the register contents into the inferior a chunk at a time. */
regcache_raw_collect (current_regcache, regnum, buf);
for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
{
Index: linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-nat.c,v
retrieving revision 1.32
diff -u -p -r1.32 linux-nat.c
--- linux-nat.c 4 Sep 2005 16:18:20 -0000 1.32
+++ linux-nat.c 4 Sep 2005 20:58:31 -0000
@@ -34,6 +34,8 @@
#include "gdbthread.h"
#include "gdbcmd.h"
#include "regcache.h"
+#include "inf-ptrace.h"
+#include "auxv.h"
#include <sys/param.h> /* for MAXPATHLEN */
#include <sys/procfs.h> /* for elf_gregset etc. */
#include "elf-bfd.h" /* for elfcore_write_* */
@@ -81,6 +83,16 @@
#define __WALL 0x40000000 /* Wait for any child. */
#endif

+/* The single-threaded native GNU/Linux target_ops. We save a pointer for
+ the use of the multi-threaded target. */
+static struct target_ops *linux_ops;
+
+/* The saved to_xfer_partial method, inherited from inf-ptrace.c. Called
+ by our to_xfer_partial. */
+LONGEST (*super_xfer_partial) (struct target_ops *, enum target_object,
+ const char *, gdb_byte *, const gdb_byte *,
+ ULONGEST, LONGEST);
+
static int debug_linux_nat;
static void
show_debug_linux_nat (struct ui_file *file, int from_tty,
@@ -319,20 +331,12 @@ child_post_attach (int pid)
linux_enable_event_reporting (pid_to_ptid (pid));
}

-void
+static void
linux_child_post_startup_inferior (ptid_t ptid)
{
linux_enable_event_reporting (ptid);
}

-#ifndef LINUX_CHILD_POST_STARTUP_INFERIOR
-void
-child_post_startup_inferior (ptid_t ptid)
-{
- linux_child_post_startup_inferior (ptid);
-}
-#endif
-
int
child_follow_fork (struct target_ops *ops, int follow_child)
{
@@ -913,7 +917,7 @@ linux_nat_attach (char *args, int from_t

/* FIXME: We should probably accept a list of process id's, and
attach all of them. */
- deprecated_child_ops.to_attach (args, from_tty);
+ linux_ops->to_attach (args, from_tty);

/* Add the initial process as the first LWP to the list. */
lp = add_lwp (BUILD_LWP (GET_PID (inferior_ptid), GET_PID (inferior_ptid)));
@@ -1023,7 +1027,7 @@ linux_nat_detach (char *args, int from_t
sigemptyset (&blocked_mask);

inferior_ptid = pid_to_ptid (GET_PID (inferior_ptid));
- deprecated_child_ops.to_detach (args, from_tty);
+ linux_ops->to_detach (args, from_tty);
}

/* Resume LP. */
@@ -1035,7 +1039,8 @@ resume_callback (struct lwp_info *lp, vo
{
struct thread_info *tp;

- child_resume (pid_to_ptid (GET_LWP (lp->ptid)), 0, TARGET_SIGNAL_0);
+ linux_ops->to_resume (pid_to_ptid (GET_LWP (lp->ptid)),
+ 0, TARGET_SIGNAL_0);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"RC: PTRACE_CONT %s, 0, 0 (resume sibling)\n",
@@ -1109,7 +1114,7 @@ linux_nat_resume (ptid_t ptid, int step,
if (resume_all)
iterate_over_lwps (resume_callback, NULL);

- child_resume (ptid, step, signo);
+ linux_ops->to_resume (ptid, step, signo);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLR: %s %s, %s (resume event thread)\n",
@@ -1683,8 +1688,6 @@ resumed_callback (struct lwp_info *lp, v
return lp->resumed;
}

-#ifdef CHILD_WAIT
-
/* We need to override child_wait to support attaching to cloned
processes, since a normal wait (as done by the default version)
ignores those processes. */
@@ -1789,8 +1792,6 @@ child_wait (ptid_t ptid, struct target_w
return pid_to_ptid (pid);
}

-#endif
-
/* Stop an active thread, verify it still exists, then resume it. */

static int
@@ -1899,8 +1900,8 @@ retry:
/* Resume the thread. It should halt immediately returning the
pending SIGSTOP. */
registers_changed ();
- child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
- TARGET_SIGNAL_0);
+ linux_ops->to_resume (pid_to_ptid (GET_LWP (lp->ptid)),
+ lp->step, TARGET_SIGNAL_0);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLW: %s %s, 0, 0 (expect SIGSTOP)\n",
@@ -2101,8 +2102,8 @@ retry:
lp->signalled = 0;

registers_changed ();
- child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
- TARGET_SIGNAL_0);
+ linux_ops->to_resume (pid_to_ptid (GET_LWP (lp->ptid)),
+ lp->step, TARGET_SIGNAL_0);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLW: %s %s, 0, 0 (discard SIGSTOP)\n",
@@ -2161,7 +2162,8 @@ retry:
newly attached threads may cause an unwanted delay in
getting them running. */
registers_changed ();
- child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step, signo);
+ linux_ops->to_resume (pid_to_ptid (GET_LWP (lp->ptid)),
+ lp->step, signo);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLW: %s %s, %s (preempt 'handle')\n",
@@ -2310,7 +2312,7 @@ static void
linux_nat_create_inferior (char *exec_file, char *allargs, char **env,
int from_tty)
{
- deprecated_child_ops.to_create_inferior (exec_file, allargs, env, from_tty);
+ linux_ops->to_create_inferior (exec_file, allargs, env, from_tty);
}

static void
@@ -2325,23 +2327,23 @@ linux_nat_mourn_inferior (void)
sigprocmask (SIG_SETMASK, &normal_mask, NULL);
sigemptyset (&blocked_mask);

- deprecated_child_ops.to_mourn_inferior ();
+ linux_ops->to_mourn_inferior ();
}

-static int
-linux_nat_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
- int write, struct mem_attrib *attrib,
- struct target_ops *target)
+static LONGEST
+linux_nat_xfer_partial (struct target_ops *ops, enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, LONGEST len)
{
struct cleanup *old_chain = save_inferior_ptid ();
- int xfer;
+ LONGEST xfer;

if (is_lwp (inferior_ptid))
inferior_ptid = pid_to_ptid (GET_LWP (inferior_ptid));

- xfer = linux_proc_xfer_memory (memaddr, myaddr, len, write, attrib, target);
- if (xfer == 0)
- xfer = child_xfer_memory (memaddr, myaddr, len, write, attrib, target);
+ xfer = linux_ops->to_xfer_partial (ops, object, annex, readbuf, writebuf,
+ offset, len);

do_cleanups (old_chain);
return xfer;
@@ -2380,6 +2382,26 @@ linux_nat_pid_to_str (ptid_t ptid)
}

static void
+linux_nat_fetch_registers (int regnum)
+{
+ /* to_fetch_registers will honor the LWP ID, so we can use it directly. */
+ linux_ops->to_fetch_registers (regnum);
+}
+
+static void
+linux_nat_store_registers (int regnum)
+{
+ /* to_store_registers will honor the LWP ID, so we can use it directly. */
+ linux_ops->to_store_registers (regnum);
+}
+
+static void
+linux_nat_child_post_startup_inferior (ptid_t ptid)
+{
+ linux_ops->to_post_startup_inferior (ptid);
+}
+
+static void
init_linux_nat_ops (void)
{
#if 0
@@ -2392,17 +2414,16 @@ init_linux_nat_ops (void)
linux_nat_ops.to_detach = linux_nat_detach;
linux_nat_ops.to_resume = linux_nat_resume;
linux_nat_ops.to_wait = linux_nat_wait;
- /* fetch_inferior_registers and store_inferior_registers will
- honor the LWP id, so we can use them directly. */
- linux_nat_ops.to_fetch_registers = fetch_inferior_registers;
- linux_nat_ops.to_store_registers = store_inferior_registers;
- linux_nat_ops.deprecated_xfer_memory = linux_nat_xfer_memory;
+ linux_nat_ops.to_fetch_registers = linux_nat_fetch_registers;
+ linux_nat_ops.to_store_registers = linux_nat_store_registers;
+ linux_nat_ops.to_xfer_partial = linux_nat_xfer_partial;
linux_nat_ops.to_kill = linux_nat_kill;
linux_nat_ops.to_create_inferior = linux_nat_create_inferior;
linux_nat_ops.to_mourn_inferior = linux_nat_mourn_inferior;
linux_nat_ops.to_thread_alive = linux_nat_thread_alive;
linux_nat_ops.to_pid_to_str = linux_nat_pid_to_str;
- linux_nat_ops.to_post_startup_inferior = child_post_startup_inferior;
+ linux_nat_ops.to_post_startup_inferior
+ = linux_nat_child_post_startup_inferior;
linux_nat_ops.to_post_attach = child_post_attach;
linux_nat_ops.to_insert_fork_catchpoint = child_insert_fork_catchpoint;
linux_nat_ops.to_insert_vfork_catchpoint = child_insert_vfork_catchpoint;
@@ -2948,14 +2969,22 @@ linux_nat_info_proc_cmd (char *args, int
}
}

-int
-linux_proc_xfer_memory (CORE_ADDR addr, gdb_byte *myaddr, int len, int write,
- struct mem_attrib *attrib, struct target_ops *target)
+/* Implement the to_xfer_partial interface for memory reads using the /proc
+ filesystem. Because we can use a single read() call for /proc, this
+ can be much more efficient than banging away at PTRACE_PEEKTEXT,
+ but it doesn't support writes. */
+
+static LONGEST
+linux_proc_xfer_partial (struct target_ops *ops, enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, LONGEST len)
{
- int fd, ret;
+ LONGEST ret;
+ int fd;
char filename[64];

- if (write)
+ if (object != TARGET_OBJECT_MEMORY || !readbuf)
return 0;

/* Don't bother for one word. */
@@ -2974,9 +3003,9 @@ linux_proc_xfer_memory (CORE_ADDR addr,
32-bit platforms (for instance, SPARC debugging a SPARC64
application). */
#ifdef HAVE_PREAD64
- if (pread64 (fd, myaddr, len, addr) != len)
+ if (pread64 (fd, readbuf, len, offset) != len)
#else
- if (lseek (fd, addr, SEEK_SET) == -1 || read (fd, myaddr, len) != len)
+ if (lseek (fd, offset, SEEK_SET) == -1 || read (fd, readbuf, len) != len)
#endif
ret = 0;
else
@@ -3067,15 +3096,67 @@ linux_proc_pending_signals (int pid, sig
fclose (procfile);
}

+static LONGEST
+linux_xfer_partial (struct target_ops *ops, enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
+{
+ LONGEST xfer;
+
+ if (object == TARGET_OBJECT_AUXV)
+ return procfs_xfer_auxv (ops, object, annex, readbuf, writebuf,
+ offset, len);
+
+ xfer = linux_proc_xfer_partial (ops, object, annex, readbuf, writebuf,
+ offset, len);
+ if (xfer != 0)
+ return xfer;
+
+ return super_xfer_partial (ops, object, annex, readbuf, writebuf,
+ offset, len);
+}
+
+/* Create a prototype generic Linux target. The client can override
+ it with local methods. */
+
+struct target_ops *
+linux_target (void)
+{
+ struct target_ops *t;
+
+ /* FIXME drow/2005-09-04: The hardcoded use of register_addr should go
+ away. This requires disentangling the various definitions of it
+ (particularly alpha-nat.c's). */
+#ifdef FETCH_INFERIOR_REGISTERS
+ t = inf_ptrace_target ();
+#else
+ t = inf_ptrace_trad_target (register_addr);
+#endif
+ t->to_wait = child_wait;
+ t->to_kill = kill_inferior;
+ t->to_insert_fork_catchpoint = child_insert_fork_catchpoint;
+ t->to_insert_vfork_catchpoint = child_insert_vfork_catchpoint;
+ t->to_insert_exec_catchpoint = child_insert_exec_catchpoint;
+ t->to_pid_to_exec_file = child_pid_to_exec_file;
+ t->to_post_startup_inferior = linux_child_post_startup_inferior;
+ t->to_post_attach = child_post_attach;
+ t->to_follow_fork = child_follow_fork;
+ t->to_find_memory_regions = linux_nat_find_memory_regions;
+ t->to_make_corefile_notes = linux_nat_make_corefile_notes;
+
+ super_xfer_partial = t->to_xfer_partial;
+ t->to_xfer_partial = linux_xfer_partial;
+
+ linux_ops = t;
+ return t;
+}
+
void
_initialize_linux_nat (void)
{
struct sigaction action;
extern void thread_db_init (struct target_ops *);

- deprecated_child_ops.to_find_memory_regions = linux_nat_find_memory_regions;
- deprecated_child_ops.to_make_corefile_notes = linux_nat_make_corefile_notes;
-
add_info ("proc", linux_nat_info_proc_cmd, _("\
Show /proc process information about any running process.\n\
Specify any process id, or use the program being debugged by default.\n\
Index: linux-nat.h
===================================================================
RCS file: /cvs/src/src/gdb/linux-nat.h,v
retrieving revision 1.7
diff -u -p -r1.7 linux-nat.h
--- linux-nat.h 9 Aug 2005 16:35:45 -0000 1.7
+++ linux-nat.h 4 Sep 2005 20:58:31 -0000
@@ -1,5 +1,7 @@
/* Native debugging support for GNU/Linux (LWP layer).
- Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.

This file is part of GDB.

@@ -63,14 +65,6 @@ struct lwp_info
struct lwp_info *next;
};

-/* Read/write to target memory via the Linux kernel's "proc file
- system". */
-struct mem_attrib;
-struct target_ops;
-
-extern int linux_proc_xfer_memory (CORE_ADDR addr, gdb_byte *myaddr, int len,
- int write, struct mem_attrib *attrib,
- struct target_ops *target);

/* Find process PID's pending signal set from /proc/pid/status. */
void linux_proc_pending_signals (int pid, sigset_t *pending, sigset_t *blocked, sigset_t *ignored);
@@ -80,9 +74,12 @@ extern void linux_record_stopped_pid (in
extern void linux_enable_event_reporting (ptid_t ptid);
extern ptid_t linux_handle_extended_wait (int pid, int status,
struct target_waitstatus *ourstatus);
-extern void linux_child_post_startup_inferior (ptid_t ptid);

/* Iterator function for lin-lwp's lwp list. */
struct lwp_info *iterate_over_lwps (int (*callback) (struct lwp_info *,
void *),
void *data);
+
+/* Create a prototype generic Linux target. The client can override
+ it with local methods. */
+struct target_ops * linux_target (void);
Index: linux-thread-db.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-thread-db.c,v
retrieving revision 1.9
diff -u -p -r1.9 linux-thread-db.c
--- linux-thread-db.c 28 May 2005 16:44:29 -0000 1.9
+++ linux-thread-db.c 4 Sep 2005 20:58:31 -0000
@@ -1,6 +1,7 @@
/* libthread_db assisted debugging support, generic parts.

- Copyright 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2003, 2004, 2005
+ Free Software Foundation, Inc.

This file is part of GDB.

@@ -961,12 +962,13 @@ thread_db_wait (ptid_t ptid, struct targ
return ptid;
}

-static int
-thread_db_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
- struct mem_attrib *attrib, struct target_ops *target)
+static LONGEST
+thread_db_xfer_partial (struct target_ops *ops, enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
{
struct cleanup *old_chain = save_inferior_ptid ();
- int xfer;
+ LONGEST xfer;

if (is_thread (inferior_ptid))
{
@@ -978,9 +980,8 @@ thread_db_xfer_memory (CORE_ADDR memaddr
inferior_ptid = lwp_from_thread (inferior_ptid);
}

- xfer =
- target_beneath->deprecated_xfer_memory (memaddr, myaddr, len, write,
- attrib, target);
+ xfer = target_beneath->to_xfer_partial (ops, object, annex,
+ readbuf, writebuf, offset, len);

do_cleanups (old_chain);
return xfer;
@@ -1298,7 +1299,7 @@ init_thread_db_ops (void)
thread_db_ops.to_wait = thread_db_wait;
thread_db_ops.to_fetch_registers = thread_db_fetch_registers;
thread_db_ops.to_store_registers = thread_db_store_registers;
- thread_db_ops.deprecated_xfer_memory = thread_db_xfer_memory;
+ thread_db_ops.to_xfer_partial = thread_db_xfer_partial;
thread_db_ops.to_kill = thread_db_kill;
thread_db_ops.to_create_inferior = thread_db_create_inferior;
thread_db_ops.to_post_startup_inferior = thread_db_post_startup_inferior;
Index: m32r-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/m32r-linux-nat.c,v
retrieving revision 1.2
diff -u -p -r1.2 m32r-linux-nat.c
--- m32r-linux-nat.c 11 Feb 2005 18:13:51 -0000 1.2
+++ m32r-linux-nat.c 4 Sep 2005 20:58:31 -0000
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux m32r.

- Copyright 2004 Free Software Foundation, Inc.
+ Copyright 2004, 2005 Free Software Foundation, Inc.

This file is part of GDB.

@@ -24,6 +24,7 @@
#include "gdbcore.h"
#include "regcache.h"
#include "linux-nat.h"
+#include "target.h"

#include "gdb_assert.h"
#include "gdb_string.h"
@@ -187,8 +188,8 @@ fill_fpregset (gdb_fpregset_t *fpregs, i
this for all registers (including the floating point and SSE
registers). */

-void
-fetch_inferior_registers (int regno)
+static void
+m32r_linux_fetch_inferior_registers (int regno)
{
int tid;

@@ -213,8 +214,8 @@ fetch_inferior_registers (int regno)
/* Store register REGNO back into the child process. If REGNO is -1,
do this for all registers (including the floating point and SSE
registers). */
-void
-store_inferior_registers (int regno)
+static void
+m32r_linux_store_inferior_registers (int regno)
{
int tid;

@@ -233,3 +234,21 @@ store_inferior_registers (int regno)
internal_error (__FILE__, __LINE__,
_("Got request to store bad register number %d."), regno);
}
+
+void _initialize_m32r_linux_nat (void);
+
+void
+_initialize_m32r_linux_nat (void)
+{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = m32r_linux_fetch_inferior_registers;
+ t->to_store_registers = m32r_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
+}
Index: m68klinux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/m68klinux-nat.c,v
retrieving revision 1.28
diff -u -p -r1.28 m68klinux-nat.c
--- m68klinux-nat.c 11 Feb 2005 18:13:51 -0000 1.28
+++ m68klinux-nat.c 4 Sep 2005 20:58:31 -0000
@@ -1,7 +1,7 @@
/* Motorola m68k native support for GNU/Linux.

- Copyright 1996, 1998, 2000, 2001, 2002 Free Software Foundation,
- Inc.
+ Copyright 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.

This file is part of GDB.

@@ -27,6 +27,8 @@
#include "gdbcore.h"
#include "gdb_string.h"
#include "regcache.h"
+#include "target.h"
+#include "linux-nat.h"

#include "m68k-tdep.h"

@@ -170,7 +172,7 @@ fetch_register (int regno)
If REGNO is negative, do this for all registers.
Otherwise, REGNO specifies which register (so we can save time). */

-void
+static void
old_fetch_inferior_registers (int regno)
{
if (regno >= 0)
@@ -237,7 +239,7 @@ store_register (int regno)
If REGNO is negative, do this for all registers.
Otherwise, REGNO specifies which register (so we can save time). */

-void
+static void
old_store_inferior_registers (int regno)
{
if (regno >= 0)
@@ -442,8 +444,8 @@ static void store_fpregs (int tid, int r
this for all registers (including the floating point and SSE
registers). */

-void
-fetch_inferior_registers (int regno)
+static void
+m68k_linux_fetch_inferior_registers (int regno)
{
int tid;

@@ -498,8 +500,8 @@ fetch_inferior_registers (int regno)
/* Store register REGNO back into the child process. If REGNO is -1,
do this for all registers (including the floating point and SSE
registers). */
-void
-store_inferior_registers (int regno)
+static void
+m68k_linux_store_inferior_registers (int regno)
{
int tid;

@@ -616,8 +618,22 @@ static struct core_fns linux_elf_core_fn
NULL /* next */
};

+void _initialize_m68k_linux_nat (void);
+
void
_initialize_m68k_linux_nat (void)
{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = m68k_linux_fetch_inferior_registers;
+ t->to_store_registers = m68k_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
+
deprecated_add_core_fns (&linux_elf_core_fns);
}
Index: mips-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-linux-nat.c,v
retrieving revision 1.9
diff -u -p -r1.9 mips-linux-nat.c
--- mips-linux-nat.c 30 Oct 2004 22:54:40 -0000 1.9
+++ mips-linux-nat.c 4 Sep 2005 20:58:31 -0000
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux on MIPS processors.

- Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.

This file is part of GDB.

@@ -21,6 +21,8 @@

#include "defs.h"
#include "mips-tdep.h"
+#include "target.h"
+#include "linux-nat.h"

/* Pseudo registers can not be read. ptrace does not provide a way to
read (or set) MIPS_PS_REGNUM, and there's no point in reading or
@@ -62,3 +64,11 @@ mips_linux_cannot_store_register (int re
else
return 1;
}
+
+void _initialize_mips_linux_nat (void);
+
+void
+_initialize_mips_linux_nat (void)
+{
+ add_target (linux_target ());
+}
Index: ppc-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-linux-nat.c,v
retrieving revision 1.54
diff -u -p -r1.54 ppc-linux-nat.c
--- ppc-linux-nat.c 11 Feb 2005 18:13:51 -0000 1.54
+++ ppc-linux-nat.c 4 Sep 2005 20:58:31 -0000
@@ -1,7 +1,7 @@
/* PPC GNU/Linux native support.

Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001, 2002,
- 2003 Free Software Foundation, Inc.
+ 2003, 2004, 2005 Free Software Foundation, Inc.

This file is part of GDB.

@@ -27,6 +27,8 @@
#include "gdbcore.h"
#include "regcache.h"
#include "gdb_assert.h"
+#include "target.h"
+#include "linux-nat.h"

#include <sys/types.h>
#include <sys/param.h>
@@ -494,8 +496,8 @@ fetch_ppc_registers (int tid)
/* Fetch registers from the child process. Fetch all registers if
regno == -1, otherwise fetch all general registers or all floating
point registers depending upon the value of regno. */
-void
-fetch_inferior_registers (int regno)
+static void
+ppc_linux_fetch_inferior_registers (int regno)
{
/* Overload thread id onto process id */
int tid = TIDGET (inferior_ptid);
@@ -775,8 +777,8 @@ store_ppc_registers (int tid)
store_spe_register (tid, -1);
}

-void
-store_inferior_registers (int regno)
+static void
+ppc_linux_store_inferior_registers (int regno)
{
/* Overload thread id onto process id */
int tid = TIDGET (inferior_ptid);
@@ -883,3 +885,21 @@ fill_fpregset (gdb_fpregset_t *fpregsetp
right_fill_reg (tdep->ppc_fpscr_regnum, (fpp + 8 * 32));
}
}
+
+void _initialize_ppc_linux_nat (void);
+
+void
+_initialize_ppc_linux_nat (void)
+{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = ppc_linux_fetch_inferior_registers;
+ t->to_store_registers = ppc_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
+}
Index: s390-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/s390-nat.c,v
retrieving revision 1.13
diff -u -p -r1.13 s390-nat.c
--- s390-nat.c 11 Feb 2005 18:13:52 -0000 1.13
+++ s390-nat.c 4 Sep 2005 20:58:31 -0000
@@ -1,5 +1,5 @@
/* S390 native-dependent code for GDB, the GNU debugger.
- Copyright 2001, 2003 Free Software Foundation, Inc
+ Copyright 2001, 2003, 2004, 2005 Free Software Foundation, Inc

Contributed by D.J. Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
for IBM Deutschland Entwicklung GmbH, IBM Corporation.
@@ -25,6 +25,8 @@
#include "tm.h"
#include "regcache.h"
#include "inferior.h"
+#include "target.h"
+#include "linux-nat.h"

#include "s390-tdep.h"

@@ -200,8 +202,8 @@ store_fpregs (int tid, int regnum)

/* Fetch register REGNUM from the child process. If REGNUM is -1, do
this for all registers. */
-void
-fetch_inferior_registers (int regnum)
+static void
+s390_linux_fetch_inferior_registers (int regnum)
{
int tid = s390_inferior_tid ();

@@ -216,8 +218,8 @@ fetch_inferior_registers (int regnum)

/* Store register REGNUM back into the child process. If REGNUM is
-1, do this for all registers. */
-void
-store_inferior_registers (int regnum)
+static void
+s390_linux_store_inferior_registers (int regnum)
{
int tid = s390_inferior_tid ();

@@ -357,3 +359,20 @@ kernel_u_size (void)
return sizeof (struct user);
}

+void _initialize_s390_nat (void);
+
+void
+_initialize_s390_nat (void)
+{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = s390_linux_fetch_inferior_registers;
+ t->to_store_registers = s390_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
+}
Index: sparc-linux-nat.c
===================================================================
RCS file: sparc-linux-nat.c
diff -N sparc-linux-nat.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sparc-linux-nat.c 4 Sep 2005 20:58:31 -0000
@@ -0,0 +1,43 @@
+/* Native-dependent code for GNU/Linux SPARC.
+ Copyright 2005
+ 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. */
+
+#include "defs.h"
+#include "inferior.h"
+#include "target.h"
+#include "linux-nat.h"
+
+void _initialialize_sparc_linux_nat (void);
+
+void
+_initialize_sparc_linux_nat (void)
+{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = fetch_inferior_registers;
+ t->to_store_registers = store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
+}
Index: sparc64-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc64-linux-nat.c,v
retrieving revision 1.2
diff -u -p -r1.2 sparc64-linux-nat.c
--- sparc64-linux-nat.c 3 Jan 2004 10:08:44 -0000 1.2
+++ sparc64-linux-nat.c 4 Sep 2005 20:58:31 -0000
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux UltraSPARC.

- Copyright 2003 Free Software Foundation, Inc.
+ Copyright 2003, 2005 Free Software Foundation, Inc.

This file is part of GDB.

@@ -23,6 +23,9 @@

#include "sparc64-tdep.h"
#include "sparc-nat.h"
+#include "inferior.h"
+#include "target.h"
+#include "linux-nat.h"

static const struct sparc_gregset sparc64_linux_ptrace_gregset =
{
@@ -44,5 +47,17 @@ void _initialize_sparc64_linux_nat (void
void
_initialize_sparc64_linux_nat (void)
{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = fetch_inferior_registers;
+ t->to_store_registers = store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
+
sparc_gregset = &sparc64_linux_ptrace_gregset;
}
Index: config/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/nm-linux.h,v
retrieving revision 1.24
diff -u -p -r1.24 nm-linux.h
--- config/nm-linux.h 20 Sep 2004 16:39:34 -0000 1.24
+++ config/nm-linux.h 4 Sep 2005 20:58:31 -0000
@@ -1,6 +1,7 @@
/* Native support for GNU/Linux.

- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.

This file is part of GDB.

@@ -42,11 +43,6 @@ struct target_ops;
#endif
\f

-/* Override child_wait in `inftarg.c'. */
-struct target_waitstatus;
-extern ptid_t child_wait (ptid_t ptid, struct target_waitstatus *ourstatus);
-#define CHILD_WAIT
-
extern void lin_lwp_attach_lwp (ptid_t ptid, int verbose);
#define ATTACH_LWP(ptid, verbose) lin_lwp_attach_lwp ((ptid), (verbose))

@@ -58,17 +54,3 @@ extern void lin_thread_get_thread_signal

#define GDB_GREGSET_T elf_gregset_t
#define GDB_FPREGSET_T elf_fpregset_t
-
-/* Override child_pid_to_exec_file in 'inftarg.c'. */
-#define CHILD_PID_TO_EXEC_FILE
-
-#define CHILD_INSERT_FORK_CATCHPOINT
-#define CHILD_INSERT_VFORK_CATCHPOINT
-#define CHILD_INSERT_EXEC_CATCHPOINT
-#define CHILD_POST_STARTUP_INFERIOR
-#define CHILD_POST_ATTACH
-#define CHILD_FOLLOW_FORK
-#define DEPRECATED_KILL_INFERIOR
-
-#define NATIVE_XFER_AUXV procfs_xfer_auxv
-#include "auxv.h" /* Declares it. */
Index: config/alpha/alpha-linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/alpha/alpha-linux.mh,v
retrieving revision 1.17
diff -u -p -r1.17 alpha-linux.mh
--- config/alpha/alpha-linux.mh 14 Nov 2004 18:47:50 -0000 1.17
+++ config/alpha/alpha-linux.mh 4 Sep 2005 20:58:31 -0000
@@ -1,6 +1,6 @@
# Host: Little-endian Alpha running Linux
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o \
+NATDEPFILES= inf-ptrace.o corelow.o alpha-nat.o alpha-linux-nat.o \
fork-child.o proc-service.o linux-thread-db.o gcore.o \
linux-nat.o

Index: config/arm/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/arm/linux.mh,v
retrieving revision 1.15
diff -u -p -r1.15 linux.mh
--- config/arm/linux.mh 14 Nov 2004 18:47:51 -0000 1.15
+++ config/arm/linux.mh 4 Sep 2005 20:58:31 -0000
@@ -1,7 +1,7 @@
# Host: ARM based machine running GNU/Linux

NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
+NATDEPFILES= inf-ptrace.o fork-child.o corelow.o \
core-regset.o arm-linux-nat.o gcore.o \
proc-service.o linux-thread-db.o linux-nat.o

Index: config/djgpp/fnchange.lst
===================================================================
RCS file: /cvs/src/src/gdb/config/djgpp/fnchange.lst,v
retrieving revision 1.92
diff -u -p -r1.92 fnchange.lst
--- config/djgpp/fnchange.lst 29 May 2005 07:36:09 -0000 1.92
+++ config/djgpp/fnchange.lst 4 Sep 2005 20:58:31 -0000
@@ -83,6 +83,8 @@
@V@/gdb/alphabsd-nat.c @V@/gdb/alphb-nat.c
@V@/gdb/alphabsd-tdep.c @V@/gdb/alphb-tdep.c
@V@/gdb/alphanbsd-tdep.c @V@/gdb/alphnb-tdep.c
+@V@/gdb/alpha-linux-nat.c @V@/gdb/alphl-nat.c
+@V@/gdb/alpha-linux-tdep.c @V@/gdb/alphl-tdep.c
@V@/gdb/arm-linux-nat.c @V@/gdb/armlin-nat.c
@V@/gdb/arm-linux-tdep.c @V@/gdb/armlin-tdep.c
@V@/gdb/armnbsd-nat.c @V@/gdb/armnbd-nat.c
@@ -201,6 +203,8 @@
@V@/gdb/sparc64-sol2-tdep.c @V@/gdb/sp64s2-tdep.c
@V@/gdb/sparcnbsd-nat.c @V@/gdb/spnb-nat.c
@V@/gdb/sparcnbsd-tdep.c @V@/gdb/spnb-tdep.c
+@V@/gdb/sparc-linux-nat.c @V@/gdb/splx-nat.c
+@V@/gdb/sparc-linux-tdep.c @V@/gdb/splx-tdep.c
@V@/gdb/sparc-sol2-nat.c @V@/gdb/spsol2-nat.c
@V@/gdb/sparc-sol2-tdep.c @V@/gdb/spsol2-tdep.c
@V@/gdb/testsuite/.gdbinit @V@/gdb/testsuite/gdb.ini
Index: config/i386/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/linux.mh,v
retrieving revision 1.17
diff -u -p -r1.17 linux.mh
--- config/i386/linux.mh 14 Nov 2004 18:47:51 -0000 1.17
+++ config/i386/linux.mh 4 Sep 2005 20:58:31 -0000
@@ -1,7 +1,7 @@
# Host: Intel 386 running GNU/Linux.

NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
+NATDEPFILES= inf-ptrace.o fork-child.o corelow.o \
core-aout.o i386-nat.o i386-linux-nat.o \
proc-service.o linux-thread-db.o gcore.o \
linux-nat.o
Index: config/i386/linux64.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/linux64.mh,v
retrieving revision 1.5
diff -u -p -r1.5 linux64.mh
--- config/i386/linux64.mh 14 Nov 2004 18:47:51 -0000 1.5
+++ config/i386/linux64.mh 4 Sep 2005 20:58:31 -0000
@@ -1,5 +1,5 @@
# Host: GNU/Linux x86-64
-NATDEPFILES= infptrace.o inftarg.o fork-child.o \
+NATDEPFILES= inf-ptrace.o fork-child.o \
i386-nat.o amd64-nat.o amd64-linux-nat.o linux-nat.o \
proc-service.o linux-thread-db.o gcore.o
NAT_FILE= nm-linux64.h
Index: config/i386/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-linux.h,v
retrieving revision 1.21
diff -u -p -r1.21 nm-linux.h
--- config/i386/nm-linux.h 20 Sep 2004 16:39:35 -0000 1.21
+++ config/i386/nm-linux.h 4 Sep 2005 20:58:31 -0000
@@ -1,7 +1,8 @@
/* Native support for GNU/Linux x86.

Copyright 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ 1998, 1999, 2000, 2001, 2002, 2003, 2005
+ Free Software Foundation, Inc.

This file is part of GDB.

@@ -79,16 +80,4 @@ extern int cannot_store_register (int re
#define FILL_FPXREGSET
#endif

-/* Override child_resume in `infptrace.c'. */
-#define DEPRECATED_CHILD_RESUME
-
-/* `linux-nat.c' and `i386-nat.c' have their own versions of
- child_post_startup_inferior. Define this to use the copy in
- `i386-linux-nat.c' instead, which calls both.
-
- NOTE drow/2003-08-17: This is ugly beyond words, but properly
- fixing it will require some serious surgery. Ideally the target
- stack could be used for this. */
-#define LINUX_CHILD_POST_STARTUP_INFERIOR
-
#endif /* nm-linux.h */
Index: config/i386/nm-linux64.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-linux64.h,v
retrieving revision 1.2
diff -u -p -r1.2 nm-linux64.h
--- config/i386/nm-linux64.h 15 Aug 2004 16:10:23 -0000 1.2
+++ config/i386/nm-linux64.h 4 Sep 2005 20:58:31 -0000
@@ -1,6 +1,6 @@
/* Native support for GNU/Linux x86-64.

- Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.

Contributed by Jiri Smid, SuSE Labs.

@@ -55,9 +55,4 @@ extern unsigned long amd64_linux_dr_get_
/* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */
#define FETCH_INFERIOR_REGISTERS

-/* `linux-nat.c' and `i386-nat.c' have their own versions of
- child_post_startup_inferior. Define this to use the copy in
- `x86-86-linux-nat.c' instead, which calls both. */
-#define LINUX_CHILD_POST_STARTUP_INFERIOR
-
#endif /* nm-linux64.h */
Index: config/ia64/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/ia64/linux.mh,v
retrieving revision 1.18
diff -u -p -r1.18 linux.mh
--- config/ia64/linux.mh 14 Nov 2004 18:47:51 -0000 1.18
+++ config/ia64/linux.mh 4 Sep 2005 20:58:31 -0000
@@ -1,7 +1,7 @@
# Host: Intel IA-64 running GNU/Linux

NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o gcore.o \
+NATDEPFILES= inf-ptrace.o fork-child.o corelow.o gcore.o \
core-aout.o core-regset.o ia64-linux-nat.o \
proc-service.o linux-thread-db.o linux-nat.o

Index: config/ia64/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/ia64/nm-linux.h,v
retrieving revision 1.16
diff -u -p -r1.16 nm-linux.h
--- config/ia64/nm-linux.h 8 Oct 2004 17:30:48 -0000 1.16
+++ config/ia64/nm-linux.h 4 Sep 2005 20:58:31 -0000
@@ -1,6 +1,6 @@
/* Native support for GNU/Linux, for GDB, the GNU debugger.

- Copyright 1999, 2000, 2001, 2004
+ Copyright 1999, 2000, 2001, 2004, 2005
Free Software Foundation, Inc.

This file is part of GDB.
@@ -75,15 +75,4 @@ extern int ia64_linux_insert_watchpoint
extern int ia64_linux_remove_watchpoint (ptid_t ptid, CORE_ADDR addr,
int len);

-#include "target.h"
-
-#define NATIVE_XFER_UNWIND_TABLE ia64_linux_xfer_unwind_table
-extern LONGEST ia64_linux_xfer_unwind_table (struct target_ops *ops,
- enum target_object object,
- const char *annex,
- void *readbuf,
- const void *writebuf,
- ULONGEST offset,
- LONGEST len);
-
#endif /* #ifndef NM_LINUX_H */
Index: config/m32r/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/m32r/linux.mh,v
retrieving revision 1.2
diff -u -p -r1.2 linux.mh
--- config/m32r/linux.mh 14 Nov 2004 18:47:51 -0000 1.2
+++ config/m32r/linux.mh 4 Sep 2005 20:58:31 -0000
@@ -1,7 +1,7 @@
# Host: M32R based machine running GNU/Linux

NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
+NATDEPFILES= inf-ptrace.o fork-child.o corelow.o \
m32r-linux-nat.o gcore.o proc-service.o linux-thread-db.o \
linux-nat.o

Index: config/m68k/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/m68k/linux.mh,v
retrieving revision 1.16
diff -u -p -r1.16 linux.mh
--- config/m68k/linux.mh 14 Nov 2004 18:47:51 -0000 1.16
+++ config/m68k/linux.mh 4 Sep 2005 20:58:31 -0000
@@ -1,7 +1,7 @@
# Host: Motorola m68k running GNU/Linux.

NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o \
+NATDEPFILES= inf-ptrace.o fork-child.o \
corelow.o core-aout.o m68klinux-nat.o gcore.o \
proc-service.o linux-thread-db.o linux-nat.o

Index: config/mips/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/linux.mh,v
retrieving revision 1.9
diff -u -p -r1.9 linux.mh
--- config/mips/linux.mh 14 Nov 2004 18:47:51 -0000 1.9
+++ config/mips/linux.mh 4 Sep 2005 20:58:31 -0000
@@ -1,6 +1,6 @@
# Host: Linux/MIPS
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o mips-linux-nat.o \
+NATDEPFILES= inf-ptrace.o fork-child.o mips-linux-nat.o \
linux-thread-db.o proc-service.o gcore.o \
linux-nat.o

Index: config/pa/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/pa/linux.mh,v
retrieving revision 1.5
diff -u -p -r1.5 linux.mh
--- config/pa/linux.mh 14 Nov 2004 18:47:51 -0000 1.5
+++ config/pa/linux.mh 4 Sep 2005 20:58:31 -0000
@@ -1,7 +1,7 @@
# Host: Hewlett-Packard PA-RISC machine, running Linux
XDEPFILES=
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o gcore.o \
+NATDEPFILES= inf-ptrace.o fork-child.o corelow.o gcore.o \
core-regset.o hppa-linux-nat.o \
proc-service.o linux-thread-db.o linux-nat.o

Index: config/powerpc/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/powerpc/linux.mh,v
retrieving revision 1.18
diff -u -p -r1.18 linux.mh
--- config/powerpc/linux.mh 14 Nov 2004 18:47:51 -0000 1.18
+++ config/powerpc/linux.mh 4 Sep 2005 20:58:31 -0000
@@ -3,7 +3,7 @@
XM_CLIBS=

NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o \
+NATDEPFILES= inf-ptrace.o fork-child.o \
ppc-linux-nat.o proc-service.o linux-thread-db.o \
gcore.o linux-nat.o

Index: config/powerpc/ppc64-linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/powerpc/ppc64-linux.mh,v
retrieving revision 1.7
diff -u -p -r1.7 ppc64-linux.mh
--- config/powerpc/ppc64-linux.mh 14 Nov 2004 18:47:51 -0000 1.7
+++ config/powerpc/ppc64-linux.mh 4 Sep 2005 20:58:31 -0000
@@ -3,7 +3,7 @@
XM_CLIBS=

NAT_FILE= nm-ppc64-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o \
+NATDEPFILES= inf-ptrace.o fork-child.o \
ppc-linux-nat.o proc-service.o linux-thread-db.o \
gcore.o linux-nat.o

Index: config/s390/s390.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/s390/s390.mh,v
retrieving revision 1.12
diff -u -p -r1.12 s390.mh
--- config/s390/s390.mh 14 Nov 2004 18:47:52 -0000 1.12
+++ config/s390/s390.mh 4 Sep 2005 20:58:31 -0000
@@ -1,5 +1,5 @@
# Host: S390, running Linux
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o s390-nat.o \
+NATDEPFILES= inf-ptrace.o fork-child.o corelow.o s390-nat.o \
gcore.o linux-thread-db.o proc-service.o linux-nat.o
LOADLIBES = -ldl -rdynamic
Index: config/sparc/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/linux.mh,v
retrieving revision 1.15
diff -u -p -r1.15 linux.mh
--- config/sparc/linux.mh 14 Nov 2004 18:47:52 -0000 1.15
+++ config/sparc/linux.mh 4 Sep 2005 20:58:31 -0000
@@ -1,8 +1,7 @@
# Host: GNU/Linux SPARC
NAT_FILE= nm-linux.h
-NATDEPFILES= sparc-nat.o sparc-sol2-nat.o \
+NATDEPFILES= sparc-nat.o sparc-sol2-nat.o sparc-linux-nat.o \
corelow.o core-regset.o fork-child.o inf-ptrace.o \
- infptrace.o inftarg.o \
proc-service.o linux-thread-db.o \
gcore.o linux-nat.o

Index: config/sparc/linux64.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/linux64.mh,v
retrieving revision 1.6
diff -u -p -r1.6 linux64.mh
--- config/sparc/linux64.mh 14 Nov 2004 18:47:52 -0000 1.6
+++ config/sparc/linux64.mh 4 Sep 2005 20:58:31 -0000
@@ -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 inf-ptrace.o infptrace.o inftarg.o \
+ fork-child.o inf-ptrace.o \
proc-service.o linux-thread-db.o \
gcore.o linux-nat.o