From: drow Date: Sat, 10 Sep 2005 18:11:01 +0000 (+0000) Subject: * Makefile.in (ALLDEPFILES): Update. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=2946633e7c2fb6df523072099077a6e0dd2afaba;p=pf3gnuchains%2Fpf3gnuchains3x.git * 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. * ia64-tdep.c (getunwind_table): Revert 2005-06-08 change; use target_read_partial and document the problem. * inf-ptrace.c (inf_ptrace_fetch_register): Use CANNOT_FETCH_REGISTER. Fix some comments. (inf_ptrace_store_register): Use 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_register_u_offset, 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. --- diff --git a/gdb/Makefile.in b/gdb/Makefile.in index efc2d66490..ea8bc96dd1 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -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_h) $(alpha_tdep_h) \ $(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 $(defs_h) $(arch_utils_h) $(frame_h) \ 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) $(arch_utils_h) $(buildsym_h) \ $(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 $(defs_h) $(arch_utils_h) $(gdbcore_h) \ $(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) $(osabi_h) $(i386_tdep_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) $(doublest_h) $(floatformat_h) $(frame_h) \ $(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) $(symtab_h) $(frame_h) $(command_h) \ $(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) $(symtab_h) $(gdbtypes_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) $(arch_utils_h) $(frame_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 $(defs_h) $(osabi_h) $(regcache_h) \ $(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) \ @@ -2369,7 +2375,8 @@ ppcbug-rom.o: ppcbug-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \ $(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) \ @@ -2480,7 +2487,7 @@ rs6000-tdep.o: rs6000-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(symtab_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) \ @@ -2580,7 +2587,7 @@ sparc64fbsd-tdep.o: sparc64fbsd-tdep.c $(defs_h) $(frame_h) \ $(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) @@ -2603,6 +2610,8 @@ sparc64-tdep.o: sparc64-tdep.c $(defs_h) $(arch_utils_h) $(dwarf2_frame_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) \ diff --git a/gdb/alpha-linux-nat.c b/gdb/alpha-linux-nat.c new file mode 100644 index 0000000000..fc75fe5857 --- /dev/null +++ b/gdb/alpha-linux-nat.c @@ -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 ()); +} diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c index 023d161a90..b89fc872e3 100644 --- a/gdb/amd64-linux-nat.c +++ b/gdb/amd64-linux-nat.c @@ -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, int regnum) 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_prochandle *ph, } -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); } @@ -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); } diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index 8059af6c05..84aaaf6b4e 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -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); } diff --git a/gdb/config/alpha/alpha-linux.mh b/gdb/config/alpha/alpha-linux.mh index 1650d79dd0..5ee0ec30aa 100644 --- a/gdb/config/alpha/alpha-linux.mh +++ b/gdb/config/alpha/alpha-linux.mh @@ -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 diff --git a/gdb/config/arm/linux.mh b/gdb/config/arm/linux.mh index ee2ae542aa..34a168956a 100644 --- a/gdb/config/arm/linux.mh +++ b/gdb/config/arm/linux.mh @@ -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 diff --git a/gdb/config/djgpp/fnchange.lst b/gdb/config/djgpp/fnchange.lst index f1d950db4f..15e6608d99 100644 --- a/gdb/config/djgpp/fnchange.lst +++ b/gdb/config/djgpp/fnchange.lst @@ -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 diff --git a/gdb/config/i386/linux.mh b/gdb/config/i386/linux.mh index 84c92cf457..ec058a5daf 100644 --- a/gdb/config/i386/linux.mh +++ b/gdb/config/i386/linux.mh @@ -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 diff --git a/gdb/config/i386/linux64.mh b/gdb/config/i386/linux64.mh index 8124ee3ddb..b764ca5d2c 100644 --- a/gdb/config/i386/linux64.mh +++ b/gdb/config/i386/linux64.mh @@ -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 diff --git a/gdb/config/i386/nm-linux.h b/gdb/config/i386/nm-linux.h index 40c3e05ec0..f6af1af0f6 100644 --- a/gdb/config/i386/nm-linux.h +++ b/gdb/config/i386/nm-linux.h @@ -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 regno); #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 */ diff --git a/gdb/config/i386/nm-linux64.h b/gdb/config/i386/nm-linux64.h index dacbc81060..5d1568cbba 100644 --- a/gdb/config/i386/nm-linux64.h +++ b/gdb/config/i386/nm-linux64.h @@ -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_status (void); /* 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 */ diff --git a/gdb/config/ia64/linux.mh b/gdb/config/ia64/linux.mh index 35b7289034..2e43f333ae 100644 --- a/gdb/config/ia64/linux.mh +++ b/gdb/config/ia64/linux.mh @@ -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 diff --git a/gdb/config/ia64/nm-linux.h b/gdb/config/ia64/nm-linux.h index fb8675f69e..8f66649f78 100644 --- a/gdb/config/ia64/nm-linux.h +++ b/gdb/config/ia64/nm-linux.h @@ -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 (ptid_t ptid, CORE_ADDR addr, 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 */ diff --git a/gdb/config/m32r/linux.mh b/gdb/config/m32r/linux.mh index 12d28770b3..0986bab39b 100644 --- a/gdb/config/m32r/linux.mh +++ b/gdb/config/m32r/linux.mh @@ -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 diff --git a/gdb/config/m68k/linux.mh b/gdb/config/m68k/linux.mh index ee5a992c64..e867396811 100644 --- a/gdb/config/m68k/linux.mh +++ b/gdb/config/m68k/linux.mh @@ -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 diff --git a/gdb/config/mips/linux.mh b/gdb/config/mips/linux.mh index a92b9c6d6f..56f4f9cb70 100644 --- a/gdb/config/mips/linux.mh +++ b/gdb/config/mips/linux.mh @@ -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 diff --git a/gdb/config/nm-linux.h b/gdb/config/nm-linux.h index fc784e3e83..39e78cfa8e 100644 --- a/gdb/config/nm-linux.h +++ b/gdb/config/nm-linux.h @@ -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 -/* 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_signals (sigset_t *mask); #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. */ diff --git a/gdb/config/pa/linux.mh b/gdb/config/pa/linux.mh index 212084ebd7..59b4c58d2b 100644 --- a/gdb/config/pa/linux.mh +++ b/gdb/config/pa/linux.mh @@ -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 diff --git a/gdb/config/powerpc/linux.mh b/gdb/config/powerpc/linux.mh index 3a2d04e434..8b3cbbbd8c 100644 --- a/gdb/config/powerpc/linux.mh +++ b/gdb/config/powerpc/linux.mh @@ -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 diff --git a/gdb/config/powerpc/ppc64-linux.mh b/gdb/config/powerpc/ppc64-linux.mh index e4bc79cbef..0a4a4abb9d 100644 --- a/gdb/config/powerpc/ppc64-linux.mh +++ b/gdb/config/powerpc/ppc64-linux.mh @@ -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 diff --git a/gdb/config/s390/s390.mh b/gdb/config/s390/s390.mh index d197161cad..b01882888c 100644 --- a/gdb/config/s390/s390.mh +++ b/gdb/config/s390/s390.mh @@ -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 diff --git a/gdb/config/sparc/linux.mh b/gdb/config/sparc/linux.mh index 6d9e5a4cbd..bc52fb7b4a 100644 --- a/gdb/config/sparc/linux.mh +++ b/gdb/config/sparc/linux.mh @@ -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 diff --git a/gdb/config/sparc/linux64.mh b/gdb/config/sparc/linux64.mh index af8c70fe17..26514cfd4f 100644 --- a/gdb/config/sparc/linux64.mh +++ b/gdb/config/sparc/linux64.mh @@ -2,7 +2,7 @@ NAT_FILE= nm-linux.h NATDEPFILES= sparc-nat.o sparc64-nat.o sparc-sol2-nat.o sparc64-linux-nat.o \ corelow.o core-regset.o \ - fork-child.o 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 diff --git a/gdb/hppa-linux-nat.c b/gdb/hppa-linux-nat.c index 9a1abba4f5..94a5cc8812 100644 --- a/gdb/hppa-linux-nat.c +++ b/gdb/hppa-linux-nat.c @@ -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 #include @@ -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, int regno) 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); +} diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index 2037a899d5..47bcb236c5 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -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[] = { 0xcd, 0x80 }; 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, enum target_signal signal) 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); } diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c index 518da8855d..2da2380da7 100644 --- a/gdb/i386-nat.c +++ b/gdb/i386-nat.c @@ -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. */ diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c index cb9a438dee..f570a967a6 100644 --- a/gdb/ia64-linux-nat.c +++ b/gdb/ia64-linux-nat.c @@ -28,6 +28,7 @@ #include "gdbcore.h" #include "regcache.h" #include "ia64-tdep.h" +#include "linux-nat.h" #include #include @@ -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) +static LONGEST (*super_xfer_partial) (struct target_ops *, enum target_object, + const char *, gdb_byte *, const gdb_byte *, + ULONGEST, LONGEST); + +static LONGEST +ia64_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) +{ + 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); } diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 0e1968382e..ac43d26ad5 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -2460,17 +2460,19 @@ getunwind_table (void *buf, size_t len) { LONGEST x; - /* FIXME: This is a temporary solution to backtracing syscalls in corefiles. - To do this properly, the AUXV section should be used. This - fix will work as long as the kernel used to generate the corefile - is equivalent to the kernel used to debug the corefile. */ - x = ia64_linux_xfer_unwind_table (¤t_target, - TARGET_OBJECT_UNWIND_TABLE, NULL, - buf, NULL, 0, len); + /* FIXME drow/2005-09-10: This code used to call + ia64_linux_xfer_unwind_table directly to fetch the unwind table + for the currently running ia64-linux kernel. That data should + come from the core file and be accessed via the auxv vector; if + we want to preserve fall back to the running kernel's table, then + we should find a way to override the corefile layer's + xfer_partial method. */ + x = target_read_partial (¤t_target, TARGET_OBJECT_UNWIND_TABLE, NULL, + buf, 0, len); return (int)x; } - + /* Get the kernel unwind table. */ static int get_kernel_table (unw_word_t ip, unw_dyn_info_t *di) diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c index 07ebb9d412..d12d1ad321 100644 --- a/gdb/inf-ptrace.c +++ b/gdb/inf-ptrace.c @@ -626,8 +626,14 @@ inf_ptrace_fetch_register (int regnum) PTRACE_TYPE_RET *buf; int pid, i; + if (CANNOT_FETCH_REGISTER (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 (CANNOT_STORE_REGISTER (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++) { diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 582bcfb895..61c0effa52 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -34,6 +34,8 @@ #include "gdbthread.h" #include "gdbcmd.h" #include "regcache.h" +#include "inf-ptrace.h" +#include "auxv.h" #include /* for MAXPATHLEN */ #include /* 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. */ +static 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_tty) /* 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_tty) 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, void *data) { 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, enum target_signal signo) 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, void *data) 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_waitstatus *ourstatus) 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 from_tty) } } -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, gdb_byte *myaddr, int len, int write, 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,80 @@ linux_proc_pending_signals (int pid, sigset_t *pending, sigset_t *blocked, sigse 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); +} + +#ifndef FETCH_INFERIOR_REGISTERS + +/* Return the address in the core dump or inferior of register + REGNO. */ + +static CORE_ADDR +linux_register_u_offset (int regno) +{ + /* 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). */ + return register_addr (regno, 0); +} + +#endif + +/* Create a prototype generic Linux target. The client can override + it with local methods. */ + +struct target_ops * +linux_target (void) +{ + struct target_ops *t; + +#ifdef FETCH_INFERIOR_REGISTERS + t = inf_ptrace_target (); +#else + t = inf_ptrace_trad_target (linux_register_u_offset); +#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\ diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h index a90094319e..6630550200 100644 --- a/gdb/linux-nat.h +++ b/gdb/linux-nat.h @@ -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 (int pid); 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); diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index 9a7ead8b1c..6bd5b429fc 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -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 target_waitstatus *ourstatus) 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, gdb_byte *myaddr, int len, int write, 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; diff --git a/gdb/m32r-linux-nat.c b/gdb/m32r-linux-nat.c index a8c5031cf8..8dcce7d1c3 100644 --- a/gdb/m32r-linux-nat.c +++ b/gdb/m32r-linux-nat.c @@ -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, int regno) 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); +} diff --git a/gdb/m68klinux-nat.c b/gdb/m68klinux-nat.c index c135accce4..a9a4c96e90 100644 --- a/gdb/m68klinux-nat.c +++ b/gdb/m68klinux-nat.c @@ -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 regno) {} 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_fns = 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); } diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c index 835ba58785..e05c373175 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c @@ -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 regno) else return 1; } + +void _initialize_mips_linux_nat (void); + +void +_initialize_mips_linux_nat (void) +{ + add_target (linux_target ()); +} diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index 90a9919286..6f611a27da 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -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 #include @@ -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, int regno) 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); +} diff --git a/gdb/s390-nat.c b/gdb/s390-nat.c index 0fa7003bba..98610d987b 100644 --- a/gdb/s390-nat.c +++ b/gdb/s390-nat.c @@ -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); +} diff --git a/gdb/sparc-linux-nat.c b/gdb/sparc-linux-nat.c new file mode 100644 index 0000000000..5c64853e39 --- /dev/null +++ b/gdb/sparc-linux-nat.c @@ -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); +} diff --git a/gdb/sparc64-linux-nat.c b/gdb/sparc64-linux-nat.c index 56ee293693..268392a498 100644 --- a/gdb/sparc64-linux-nat.c +++ b/gdb/sparc64-linux-nat.c @@ -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; }