From de732108dddc7254366a437fae458ecac7d45b84 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Wed, 25 Apr 2007 22:10:09 +0000 Subject: [PATCH] * core-aout.c: Delete file. * Makefile.in (ALLDEPFILES): Remove core-aout.c. (core-aout.o): Delete rule. * gdbcore.h (kernel_u_addr, KERNEL_U_ADDR): Remove. * config/alpha/nm-linux.h (U_REGS_OFFSET): Remove. * arm-linux-nat.c (arm_linux_kernel_u_size): Remove. * config/arm/nm-linux.h (U_REGS_OFFSET, KERNEL_U_SIZE, KERNEL_U_ADDR): Remove. * i386-linux-nat.c (register_u_addr, kernel_u_size): Remove. (cannot_fetch_register, cannot_store_register): Remove. (fetch_register): Inline cannot_fetch_register and register_addr. (store_register): Inline cannot_store_register and register_addr. * config/i386/linux.mh (NATDEPFILES): Remove core-aout.o. * config/i386/nm-linux.h (KERNEL_U_SIZE, KERNEL_U_ADDR, REGISTER_U_ADDR, CANNOT_FETCH_REGISTER, CANNOT_STORE_REGISTER): Remove. * m68klinux-nat.c (m68k_linux_register_u_addr, kernel_u_size): Remove. (fetch_register): Inline register_addr. (store_register): Inline register_addr. * config/m68k/linux.mh (NATDEPFILES): Remove core-aout.o. * config/m68k/nm-linux.h (KERNEL_U_SIZE, KERNEL_U_ADDR, U_REGS_OFFSET, REGISTER_U_ADDR): Remove. * config/mips/nm-irix5.h (REGISTER_U_ADDR): Remove. * config/mips/nm-linux.h (KERNEL_U_SIZE, U_REGS_OFFSET, REGISTER_U_ADDR): Remove. * hppa-linux-nat.c (register_addr): Rename to ... (hppa_linux_register_addr): ... this. Make static. (fetch_register, store_register): Adapt callers. * config/pa/nm-linux.h (U_REGS_OFFSET): Remove. * ppc-linux-nat.c (kernel_u_size): Remove. * config/powerpc/nm-linux.h (KERNEL_U_SIZE, KERNEL_U_ADDR): Remove. * vax-nat.c (vax_kernel_u_addr, vax_register_u_addr): Make static. * config/vax/vax.mh (NATDEPFILES): Remove core-aout.o. (NAT_FILE): Remove. * config/vax/nm-vax.h: Delete file. --- gdb/ChangeLog | 46 ++++++++++++++ gdb/Makefile.in | 4 +- gdb/arm-linux-nat.c | 6 -- gdb/config/alpha/nm-linux.h | 4 -- gdb/config/arm/nm-linux.h | 12 ---- gdb/config/i386/linux.mh | 2 +- gdb/config/i386/nm-linux.h | 23 ------- gdb/config/m68k/linux.mh | 2 +- gdb/config/m68k/nm-linux.h | 16 ----- gdb/config/mips/nm-irix5.h | 6 -- gdb/config/mips/nm-linux.h | 12 ---- gdb/config/pa/nm-linux.h | 2 - gdb/config/powerpc/nm-linux.h | 9 --- gdb/config/vax/nm-vax.h | 32 ---------- gdb/config/vax/vax.mh | 4 +- gdb/core-aout.c | 144 ------------------------------------------ gdb/gdbcore.h | 5 -- gdb/hppa-linux-nat.c | 8 +-- gdb/i386-linux-nat.c | 47 ++------------ gdb/m68klinux-nat.c | 26 +------- gdb/ppc-linux-nat.c | 6 -- gdb/vax-nat.c | 4 +- 22 files changed, 62 insertions(+), 358 deletions(-) delete mode 100644 gdb/config/vax/nm-vax.h delete mode 100644 gdb/core-aout.c diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9e0c142..6299fed 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,49 @@ +2007-04-25 Ulrich Weigand + + * core-aout.c: Delete file. + * Makefile.in (ALLDEPFILES): Remove core-aout.c. + (core-aout.o): Delete rule. + * gdbcore.h (kernel_u_addr, KERNEL_U_ADDR): Remove. + + * config/alpha/nm-linux.h (U_REGS_OFFSET): Remove. + + * arm-linux-nat.c (arm_linux_kernel_u_size): Remove. + * config/arm/nm-linux.h (U_REGS_OFFSET, KERNEL_U_SIZE, + KERNEL_U_ADDR): Remove. + + * i386-linux-nat.c (register_u_addr, kernel_u_size): Remove. + (cannot_fetch_register, cannot_store_register): Remove. + (fetch_register): Inline cannot_fetch_register and register_addr. + (store_register): Inline cannot_store_register and register_addr. + * config/i386/linux.mh (NATDEPFILES): Remove core-aout.o. + * config/i386/nm-linux.h (KERNEL_U_SIZE, KERNEL_U_ADDR, + REGISTER_U_ADDR, CANNOT_FETCH_REGISTER, CANNOT_STORE_REGISTER): + Remove. + + * m68klinux-nat.c (m68k_linux_register_u_addr, kernel_u_size): Remove. + (fetch_register): Inline register_addr. + (store_register): Inline register_addr. + * config/m68k/linux.mh (NATDEPFILES): Remove core-aout.o. + * config/m68k/nm-linux.h (KERNEL_U_SIZE, KERNEL_U_ADDR, + U_REGS_OFFSET, REGISTER_U_ADDR): Remove. + + * config/mips/nm-irix5.h (REGISTER_U_ADDR): Remove. + * config/mips/nm-linux.h (KERNEL_U_SIZE, U_REGS_OFFSET, + REGISTER_U_ADDR): Remove. + + * hppa-linux-nat.c (register_addr): Rename to ... + (hppa_linux_register_addr): ... this. Make static. + (fetch_register, store_register): Adapt callers. + * config/pa/nm-linux.h (U_REGS_OFFSET): Remove. + + * ppc-linux-nat.c (kernel_u_size): Remove. + * config/powerpc/nm-linux.h (KERNEL_U_SIZE, KERNEL_U_ADDR): Remove. + + * vax-nat.c (vax_kernel_u_addr, vax_register_u_addr): Make static. + * config/vax/vax.mh (NATDEPFILES): Remove core-aout.o. + (NAT_FILE): Remove. + * config/vax/nm-vax.h: Delete file. + 2007-04-20 Mark Shinwell * MAINTAINERS (Write After Approval): Add myself. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 3082bf7..775c255 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1433,7 +1433,7 @@ ALLDEPFILES = \ armnbsd-nat.c armbsd-tdep.c armnbsd-tdep.c armobsd-tdep.c \ avr-tdep.c \ bsd-uthread.c bsd-kvm.c \ - core-regset.c core-aout.c corelow.c \ + core-regset.c corelow.c \ dcache.c exec.c \ fbsd-nat.c \ fork-child.c \ @@ -1876,8 +1876,6 @@ completer.o: completer.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ $(filenames_h) $(language_h) $(cli_decode_h) $(gdbcmd_h) \ $(readline_h) $(completer_h) copying.o: copying.c $(defs_h) $(command_h) $(gdbcmd_h) -core-aout.o: core-aout.c $(defs_h) $(gdbcore_h) $(value_h) $(regcache_h) \ - $(gdb_dirent_h) $(gdb_stat_h) corefile.o: corefile.c $(defs_h) $(gdb_string_h) $(inferior_h) $(symtab_h) \ $(command_h) $(gdbcmd_h) $(bfd_h) $(target_h) $(gdbcore_h) \ $(dis_asm_h) $(gdb_stat_h) $(completer_h) $(exceptions_h) diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index 05b48a7..b50f896 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -529,12 +529,6 @@ supply_fpregset (gdb_fpregset_t *fpregsetp) arm_linux_supply_nwfpe (NULL, current_regcache, -1, fpregsetp, 0); } -int -arm_linux_kernel_u_size (void) -{ - return (sizeof (struct user)); -} - /* Fetch the thread-local storage pointer for libthread_db. */ ps_err_e diff --git a/gdb/config/alpha/nm-linux.h b/gdb/config/alpha/nm-linux.h index 9fe362c..97811f7 100644 --- a/gdb/config/alpha/nm-linux.h +++ b/gdb/config/alpha/nm-linux.h @@ -25,10 +25,6 @@ #include "config/nm-linux.h" -/* ptrace register ``addresses'' are absolute. */ - -#define U_REGS_OFFSET 0 - /* Given a pointer to either a gregset_t or fpregset_t, return a pointer to the first register. */ #define ALPHA_REGSET_BASE(regsetp) ((long *) (regsetp)) diff --git a/gdb/config/arm/nm-linux.h b/gdb/config/arm/nm-linux.h index 0e2cdf5..97371d2 100644 --- a/gdb/config/arm/nm-linux.h +++ b/gdb/config/arm/nm-linux.h @@ -23,18 +23,6 @@ #include "config/nm-linux.h" -/* ptrace register ``addresses'' are absolute. */ - -#define U_REGS_OFFSET 0 - -/* Return sizeof user struct to callers in less machine dependent routines */ -extern int kernel_u_size (void); -#define KERNEL_U_SIZE arm_linux_kernel_u_size() - -/* This is the amount to subtract from u.u_ar0 - to get the offset in the core file of the register values. */ -#define KERNEL_U_ADDR 0x0 - /* Override copies of {fetch,store}_inferior_registers in infptrace.c. */ #define FETCH_INFERIOR_REGISTERS diff --git a/gdb/config/i386/linux.mh b/gdb/config/i386/linux.mh index 62fff99..92c2d96 100644 --- a/gdb/config/i386/linux.mh +++ b/gdb/config/i386/linux.mh @@ -2,7 +2,7 @@ NAT_FILE= nm-linux.h NATDEPFILES= inf-ptrace.o fork-child.o corelow.o \ - core-aout.o i386-nat.o i386-linux-nat.o \ + i386-nat.o i386-linux-nat.o \ proc-service.o linux-thread-db.o gcore.o \ linux-nat.o linux-fork.o diff --git a/gdb/config/i386/nm-linux.h b/gdb/config/i386/nm-linux.h index 4779026..8ee5696 100644 --- a/gdb/config/i386/nm-linux.h +++ b/gdb/config/i386/nm-linux.h @@ -29,20 +29,6 @@ #include "i386/nm-i386.h" #include "config/nm-linux.h" -/* Support for the user area. */ - -/* Return the size of the user struct. */ -extern int kernel_u_size (void); -#define KERNEL_U_SIZE kernel_u_size() - -/* This is the amount to substract from u.u_ar0 to get the offset in - the core file of the register values. */ -#define KERNEL_U_ADDR 0 - -extern CORE_ADDR register_u_addr (CORE_ADDR blockend, int regnum); -#define REGISTER_U_ADDR(addr, blockend, regnum) \ - (addr) = register_u_addr (blockend, regnum) - /* Provide access to the i386 hardware debugging registers. */ extern void i386_linux_dr_set_control (unsigned long control); @@ -65,15 +51,6 @@ extern unsigned long i386_linux_dr_get_status (void); /* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */ #define FETCH_INFERIOR_REGISTERS -/* Nevertheless, define CANNOT_{FETCH,STORE}_REGISTER, because we - might fall back on the code `infptrace.c' (well a copy of that code - in `i386-linux-nat.c' for now) and we can access only the - general-purpose registers in that way. */ -extern int cannot_fetch_register (int regno); -extern int cannot_store_register (int regno); -#define CANNOT_FETCH_REGISTER(regno) cannot_fetch_register (regno) -#define CANNOT_STORE_REGISTER(regno) cannot_store_register (regno) - #ifdef HAVE_PTRACE_GETFPXREGS /* Include register set support for the SSE registers. */ #define FILL_FPXREGSET diff --git a/gdb/config/m68k/linux.mh b/gdb/config/m68k/linux.mh index 871632d..e77a6c5 100644 --- a/gdb/config/m68k/linux.mh +++ b/gdb/config/m68k/linux.mh @@ -2,7 +2,7 @@ NAT_FILE= nm-linux.h NATDEPFILES= inf-ptrace.o fork-child.o \ - corelow.o core-aout.o m68klinux-nat.o gcore.o \ + corelow.o m68klinux-nat.o gcore.o \ proc-service.o linux-thread-db.o linux-nat.o linux-fork.o # The dynamically loaded libthread_db needs access to symbols in the diff --git a/gdb/config/m68k/nm-linux.h b/gdb/config/m68k/nm-linux.h index c02868e..7f5a427 100644 --- a/gdb/config/m68k/nm-linux.h +++ b/gdb/config/m68k/nm-linux.h @@ -23,22 +23,6 @@ #include "config/nm-linux.h" -/* Return sizeof user struct to callers in less machine dependent routines */ - -#define KERNEL_U_SIZE kernel_u_size() -extern int kernel_u_size (void); - -/* This is the amount to subtract from u.u_ar0 - to get the offset in the core file of the register values. */ -#define KERNEL_U_ADDR 0x0 - -#define U_REGS_OFFSET 0 - -#define REGISTER_U_ADDR(addr, blockend, regno) \ - (addr) = m68k_linux_register_u_addr ((blockend),(regno)); - -extern int m68k_linux_register_u_addr (int, int); - /* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */ #define FETCH_INFERIOR_REGISTERS diff --git a/gdb/config/mips/nm-irix5.h b/gdb/config/mips/nm-irix5.h index d775af1..6733fa5 100644 --- a/gdb/config/mips/nm-irix5.h +++ b/gdb/config/mips/nm-irix5.h @@ -49,9 +49,3 @@ extern int procfs_set_watchpoint (ptid_t, CORE_ADDR, int, int, int); #define TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(SIZE) 1 -/* Override register locations in upage for SGI machines */ -#define REGISTER_U_ADDR(addr, blockend, regno) \ - if (regno < PC_REGNUM) \ - addr = regno; \ - else \ - addr = regno + NSIG_HNDLRS; /* Skip over signal handlers */ diff --git a/gdb/config/mips/nm-linux.h b/gdb/config/mips/nm-linux.h index 8042316..81cfbfa 100644 --- a/gdb/config/mips/nm-linux.h +++ b/gdb/config/mips/nm-linux.h @@ -24,18 +24,6 @@ #include "config/nm-linux.h" -/* Return sizeof user struct to callers in less machine dependent - routines. Hard coded for cross-compilation friendliness. */ - -#define KERNEL_U_SIZE 504 - -/* ptrace register ``addresses'' are absolute. */ - -#define U_REGS_OFFSET 0 - -#define REGISTER_U_ADDR(addr, blockend, regno) \ - (addr) = mips_register_addr ((regno),(blockend)) - int mips_linux_cannot_fetch_register (int regno); int mips_linux_cannot_store_register (int regno); #define CANNOT_FETCH_REGISTER(regno) mips_linux_cannot_fetch_register (regno) diff --git a/gdb/config/pa/nm-linux.h b/gdb/config/pa/nm-linux.h index cfe0974..b6023b4 100644 --- a/gdb/config/pa/nm-linux.h +++ b/gdb/config/pa/nm-linux.h @@ -23,8 +23,6 @@ #include "config/nm-linux.h" -#define U_REGS_OFFSET 0 - /* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */ #define FETCH_INFERIOR_REGISTERS diff --git a/gdb/config/powerpc/nm-linux.h b/gdb/config/powerpc/nm-linux.h index 8678c2c..5d367f6 100644 --- a/gdb/config/powerpc/nm-linux.h +++ b/gdb/config/powerpc/nm-linux.h @@ -23,15 +23,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define NM_LINUX_H -/* Return sizeof user struct to callers in less machine dependent routines */ - -#define KERNEL_U_SIZE kernel_u_size() -extern int kernel_u_size (void); - -/* This is the amount to subtract from u.u_ar0 - to get the offset in the core file of the register values. */ -#define KERNEL_U_ADDR 0x0 - #define FETCH_INFERIOR_REGISTERS #endif /* #ifndef NM_LINUX_H */ diff --git a/gdb/config/vax/nm-vax.h b/gdb/config/vax/nm-vax.h deleted file mode 100644 index c0bf2b0..0000000 --- a/gdb/config/vax/nm-vax.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Native-dependent definitions for VAXen under 4.2 BSD and ULTRIX. - - Copyright 1986, 1987, 1989, 1992, 2004, 2007 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef NM_VAX_H -#define NM_VAX_H - -extern CORE_ADDR vax_kernel_u_addr; -#define KERNEL_U_ADDR vax_kernel_u_addr - -extern CORE_ADDR vax_register_u_addr (CORE_ADDR u_ar0, int regnum); -#define REGISTER_U_ADDR(addr, u_ar0, regnum) \ - (addr) = vax_register_u_addr (u_ar0, regnum) - -#endif /* nm-vax.h */ diff --git a/gdb/config/vax/vax.mh b/gdb/config/vax/vax.mh index 46b85d1..69c548d 100644 --- a/gdb/config/vax/vax.mh +++ b/gdb/config/vax/vax.mh @@ -1,4 +1,2 @@ # Host: VAX running 4.2BSD or Ultrix -NATDEPFILES= vax-nat.o fork-child.o inf-ptrace.o \ - corelow.o core-aout.o -NAT_FILE= nm-vax.h +NATDEPFILES= vax-nat.o fork-child.o inf-ptrace.o corelow.o diff --git a/gdb/core-aout.c b/gdb/core-aout.c deleted file mode 100644 index 873896a..0000000 --- a/gdb/core-aout.c +++ /dev/null @@ -1,144 +0,0 @@ -/* Extract registers from a "standard" core file, for GDB. - Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, - 1999, 2000, 2001, 2007 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* Typically used on systems that have a.out format executables. - corefile.c is supposed to contain the more machine-independent - aspects of reading registers from core files, while this file is - more machine specific. */ - -#include "defs.h" - -#ifdef HAVE_PTRACE_H -#include -#else -#ifdef HAVE_SYS_PTRACE_H -#include -#endif -#endif - -#include -#include -#include "gdbcore.h" -#include "value.h" -#include "regcache.h" - -/* These are needed on various systems to expand REGISTER_U_ADDR. */ -#include "gdb_dirent.h" -#include -#include "gdb_stat.h" -#include - -#ifndef CORE_REGISTER_ADDR -#define CORE_REGISTER_ADDR(regno, regptr) register_addr(regno, regptr) -#endif /* CORE_REGISTER_ADDR */ - -#ifdef NEED_SYS_CORE_H -#include -#endif - -static void fetch_core_registers (char *, unsigned, int, CORE_ADDR); - -void _initialize_core_aout (void); - -/* Extract the register values out of the core file and store - them where `read_register' will find them. - - CORE_REG_SECT points to the register values themselves, read into memory. - CORE_REG_SIZE is the size of that area. - WHICH says which set of registers we are handling (0 = int, 2 = float - on machines where they are discontiguous). - REG_ADDR is the offset from u.u_ar0 to the register values relative to - core_reg_sect. This is used with old-fashioned core files to - locate the registers in a large upage-plus-stack ".reg" section. - Original upage address X is at location core_reg_sect+x+reg_addr. - */ - -static void -fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, - CORE_ADDR reg_addr) -{ - int regno; - CORE_ADDR addr; - int bad_reg = -1; - CORE_ADDR reg_ptr = -reg_addr; /* Original u.u_ar0 is -reg_addr. */ - int numregs = NUM_REGS; - - /* If u.u_ar0 was an absolute address in the core file, relativize it now, - so we can use it as an offset into core_reg_sect. When we're done, - "register 0" will be at core_reg_sect+reg_ptr, and we can use - CORE_REGISTER_ADDR to offset to the other registers. If this is a modern - core file without a upage, reg_ptr will be zero and this is all a big - NOP. */ - if (reg_ptr > core_reg_size) - reg_ptr -= KERNEL_U_ADDR; - - for (regno = 0; regno < numregs; regno++) - { - addr = CORE_REGISTER_ADDR (regno, reg_ptr); - if (addr >= core_reg_size - && bad_reg < 0) - bad_reg = regno; - else - regcache_raw_supply (current_regcache, regno, core_reg_sect + addr); - } - - if (bad_reg >= 0) - error (_("Register %s not found in core file."), REGISTER_NAME (bad_reg)); -} - - -#ifdef REGISTER_U_ADDR - -/* Return the address in the core dump or inferior of register REGNO. - BLOCKEND is the address of the end of the user structure. */ - -CORE_ADDR -register_addr (int regno, CORE_ADDR blockend) -{ - CORE_ADDR addr; - - if (regno < 0 || regno >= NUM_REGS) - error (_("Invalid register number %d."), regno); - - REGISTER_U_ADDR (addr, blockend, regno); - - return addr; -} - -#endif /* REGISTER_U_ADDR */ - - -/* Register that we are able to handle aout (trad-core) file formats. */ - -static struct core_fns aout_core_fns = -{ - bfd_target_unknown_flavour, /* core_flavour */ - default_check_format, /* check_format */ - default_core_sniffer, /* core_sniffer */ - fetch_core_registers, /* core_read_registers */ - NULL /* next */ -}; - -void -_initialize_core_aout (void) -{ - deprecated_add_core_fns (&aout_core_fns); -} diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h index eb4b87fd..ea2411e 100644 --- a/gdb/gdbcore.h +++ b/gdb/gdbcore.h @@ -130,11 +130,6 @@ extern void validate_files (void); extern CORE_ADDR register_addr (int regno, CORE_ADDR blockend); -#if !defined (KERNEL_U_ADDR) -extern CORE_ADDR kernel_u_addr; -#define KERNEL_U_ADDR kernel_u_addr -#endif - /* The target vector for core files. */ extern struct target_ops core_ops; diff --git a/gdb/hppa-linux-nat.c b/gdb/hppa-linux-nat.c index d8f6834..ec6f545 100644 --- a/gdb/hppa-linux-nat.c +++ b/gdb/hppa-linux-nat.c @@ -153,8 +153,8 @@ static const int u_offsets[] = PT_FR31, PT_FR31 + 4, }; -CORE_ADDR -register_addr (int regno, CORE_ADDR blockend) +static CORE_ADDR +hppa_linux_register_addr (int regno, CORE_ADDR blockend) { CORE_ADDR addr; @@ -233,7 +233,7 @@ fetch_register (int regno) tid = PIDGET (inferior_ptid); /* Not a threaded program. */ errno = 0; - val = ptrace (PTRACE_PEEKUSER, tid, register_addr (regno, 0), 0); + val = ptrace (PTRACE_PEEKUSER, tid, hppa_linux_register_addr (regno, 0), 0); if (errno != 0) error (_("Couldn't read register %s (#%d): %s."), REGISTER_NAME (regno), regno, safe_strerror (errno)); @@ -259,7 +259,7 @@ store_register (int regno) errno = 0; regcache_raw_collect (current_regcache, regno, &val); - ptrace (PTRACE_POKEUSER, tid, register_addr (regno, 0), val); + ptrace (PTRACE_POKEUSER, tid, hppa_linux_register_addr (regno, 0), val); if (errno != 0) error (_("Couldn't write register %s (#%d): %s."), REGISTER_NAME (regno), regno, safe_strerror (errno)); diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index 93b335b..dfa260e 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -137,26 +137,6 @@ int have_ptrace_getfpxregs = ; -/* Support for the user struct. */ - -/* Return the address of register REGNUM. BLOCKEND is the value of - u.u_ar0, which should point to the registers. */ - -CORE_ADDR -register_u_addr (CORE_ADDR blockend, int regnum) -{ - return (blockend + 4 * regmap[regnum]); -} - -/* Return the size of the user struct. */ - -int -kernel_u_size (void) -{ - return (sizeof (struct user)); -} - - /* Accessing registers through the U area, one at a time. */ /* Fetch one register. */ @@ -168,7 +148,7 @@ fetch_register (int regno) int val; gdb_assert (!have_ptrace_getregs); - if (cannot_fetch_register (regno)) + if (regmap[regno] == -1) { regcache_raw_supply (current_regcache, regno, NULL); return; @@ -180,7 +160,7 @@ fetch_register (int regno) tid = PIDGET (inferior_ptid); /* Not a threaded program. */ errno = 0; - val = ptrace (PTRACE_PEEKUSER, tid, register_addr (regno, 0), 0); + val = ptrace (PTRACE_PEEKUSER, tid, 4 * regmap[regno], 0); if (errno != 0) error (_("Couldn't read register %s (#%d): %s."), REGISTER_NAME (regno), regno, safe_strerror (errno)); @@ -197,7 +177,7 @@ store_register (int regno) int val; gdb_assert (!have_ptrace_getregs); - if (cannot_store_register (regno)) + if (regmap[regno] == -1) return; /* GNU/Linux LWP ID's are process ID's. */ @@ -207,7 +187,7 @@ store_register (int regno) errno = 0; regcache_raw_collect (current_regcache, regno, &val); - ptrace (PTRACE_POKEUSER, tid, register_addr (regno, 0), val); + ptrace (PTRACE_POKEUSER, tid, 4 * regmap[regno], val); if (errno != 0) error (_("Couldn't write register %s (#%d): %s."), REGISTER_NAME (regno), regno, safe_strerror (errno)); @@ -458,25 +438,6 @@ static int store_fpxregs (int tid, int regno) { return 0; } /* Transferring arbitrary registers between GDB and inferior. */ -/* Check if register REGNO in the child process is accessible. - If we are accessing registers directly via the U area, only the - general-purpose registers are available. - All registers should be accessible if we have GETREGS support. */ - -int -cannot_fetch_register (int regno) -{ - gdb_assert (regno >= 0 && regno < NUM_REGS); - return (!have_ptrace_getregs && regmap[regno] == -1); -} - -int -cannot_store_register (int regno) -{ - gdb_assert (regno >= 0 && regno < NUM_REGS); - return (!have_ptrace_getregs && regmap[regno] == -1); -} - /* Fetch register REGNO from the child process. If REGNO is -1, do this for all registers (including the floating point and SSE registers). */ diff --git a/gdb/m68klinux-nat.c b/gdb/m68klinux-nat.c index 7cb9dea..f082f32 100644 --- a/gdb/m68klinux-nat.c +++ b/gdb/m68klinux-nat.c @@ -92,16 +92,6 @@ int have_ptrace_getregs = -/* BLOCKEND is the value of u.u_ar0, and points to the place where GS - is stored. */ - -int -m68k_linux_register_u_addr (int blockend, int regnum) -{ - return (blockend + 4 * regmap[regnum]); -} - - /* Fetching registers directly from the U area, one at a time. */ /* FIXME: This duplicates code from `inptrace.c'. The problem is that we @@ -127,7 +117,6 @@ fetch_register (int regno) CORE_ADDR regaddr; char mess[128]; /* For messages */ int i; - unsigned int offset; /* Offset of registers within the u area. */ char buf[MAX_REGISTER_SIZE]; int tid; @@ -143,9 +132,7 @@ fetch_register (int regno) if (tid == 0) tid = PIDGET (inferior_ptid); /* no thread id, just use process id */ - offset = U_REGS_OFFSET; - - regaddr = register_addr (regno, offset); + regaddr = 4 * regmap[regno]; for (i = 0; i < register_size (current_gdbarch, regno); i += sizeof (PTRACE_TYPE_RET)) { @@ -192,7 +179,6 @@ store_register (int regno) CORE_ADDR regaddr; char mess[128]; /* For messages */ int i; - unsigned int offset; /* Offset of registers within the u area. */ int tid; char buf[MAX_REGISTER_SIZE]; @@ -206,9 +192,7 @@ store_register (int regno) if (tid == 0) tid = PIDGET (inferior_ptid); /* no thread id, just use process id */ - offset = U_REGS_OFFSET; - - regaddr = register_addr (regno, offset); + regaddr = 4 * regmap[regno]; /* Put the contents of regno into a local buffer */ regcache_raw_collect (current_regcache, regno, buf); @@ -595,12 +579,6 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, } -int -kernel_u_size (void) -{ - return (sizeof (struct user)); -} - /* Register that we are able to handle GNU/Linux ELF core file formats. */ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index 217e5e7..7cd43a9 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -152,12 +152,6 @@ static CORE_ADDR last_stopped_data_address = 0; error. */ int have_ptrace_getsetevrregs = 1; -int -kernel_u_size (void) -{ - return (sizeof (struct user)); -} - /* *INDENT-OFF* */ /* registers layout, as presented by the ptrace interface: PT_R0, PT_R1, PT_R2, PT_R3, PT_R4, PT_R5, PT_R6, PT_R7, diff --git a/gdb/vax-nat.c b/gdb/vax-nat.c index b4252d4..900a2a9 100644 --- a/gdb/vax-nat.c +++ b/gdb/vax-nat.c @@ -48,7 +48,7 @@ /* Address of the user structure. This is the the value for 32V; 3BSD uses a different value, but hey, who's still using those systems? */ -CORE_ADDR vax_kernel_u_addr = 0x80020000; +static CORE_ADDR vax_kernel_u_addr = 0x80020000; /* Location of the user's stored registers; usage is `u.u_ar0[XX]'. For 4.2BSD and ULTRIX these are negative! See . */ @@ -59,7 +59,7 @@ static int vax_register_index[] = AP, FP, SP, PC, PS }; -CORE_ADDR +static CORE_ADDR vax_register_u_addr (CORE_ADDR u_ar0, int regnum) { gdb_assert (regnum >= 0 && regnum < ARRAY_SIZE (vax_register_index)); -- 2.7.4