From 3e00823eb4110b19fff21fe8cfc01f5c20c3b112 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Sun, 29 Apr 2007 19:44:22 +0000 Subject: [PATCH] * m68klinux-nat.c: Remove #ifndef USE_PROC_FS check. * m68k-tdep.c: Remove code within #ifdef USE_PROC_FS. * mips-linux-nat.c: Include "gregset.h". (supply_gregset, fill_gregset, supply_fpregset, fill_fpregset): Move from mips-linux-tdep.c. Change parameter type to gdb_gregset_t. * mips-linux-tdep.c (supply_gregset, fill_gregset, supply_fpregset, fill_fpregset): Move to mips-linux-nat.c. * Makefile.in (m68k-tdep.o, mips-linux-nat.o): Update dependencies. --- gdb/ChangeLog | 13 +++++ gdb/Makefile.in | 6 +- gdb/m68k-tdep.c | 133 ------------------------------------------ gdb/m68klinux-nat.c | 19 +----- gdb/mips-linux-nat.c | 40 +++++++++++++ gdb/mips-linux-tdep.c | 42 ------------- 6 files changed, 59 insertions(+), 194 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 19503bc6fd2..64803ed684f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +2007-04-29 Ulrich Weigand + + * m68klinux-nat.c: Remove #ifndef USE_PROC_FS check. + * m68k-tdep.c: Remove code within #ifdef USE_PROC_FS. + + * mips-linux-nat.c: Include "gregset.h". + (supply_gregset, fill_gregset, supply_fpregset, fill_fpregset): Move + from mips-linux-tdep.c. Change parameter type to gdb_gregset_t. + * mips-linux-tdep.c (supply_gregset, fill_gregset, supply_fpregset, + fill_fpregset): Move to mips-linux-nat.c. + + * Makefile.in (m68k-tdep.o, mips-linux-nat.o): Update dependencies. + 2007-04-28 Ulrich Weigand * regcache.c (deprecated_read_register_gen): Remove, inline ... diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 92ca08bb2e2..3725ef43497 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -2291,7 +2291,7 @@ m68k-tdep.o: m68k-tdep.c $(defs_h) $(dwarf2_frame_h) $(frame_h) \ $(frame_base_h) $(frame_unwind_h) $(gdbtypes_h) $(symtab_h) \ $(gdbcore_h) $(value_h) $(gdb_string_h) $(gdb_assert_h) \ $(inferior_h) $(regcache_h) $(arch_utils_h) $(osabi_h) $(dis_asm_h) \ - $(m68k_tdep_h) $(gregset_h) + $(m68k_tdep_h) m88kbsd-nat.o: m88kbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \ $(target_h) $(m88k_tdep_h) $(inf_ptrace_h) m88k-tdep.o: m88k-tdep.c $(defs_h) $(arch_utils_h) $(dis_asm_h) $(frame_h) \ @@ -2341,8 +2341,8 @@ mips64obsd-tdep.o: mips64obsd-tdep.c $(defs_h) $(osabi_h) $(regcache_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) $(target_h) \ - $(linux_nat_h) $(gdb_proc_service_h) $(mips_linux_tdep_h) \ - $(inferior_h) + $(linux_nat_h) $(gdb_proc_service_h) $(gregset_h) \ + $(mips_linux_tdep_h) $(inferior_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) \ diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index 3e9ad8df1cb..d928d74a98d 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -953,139 +953,6 @@ m68k_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame) return frame_id_build (fp + 8, frame_pc_unwind (next_frame)); } -#ifdef USE_PROC_FS /* Target dependent support for /proc */ - -#include - -/* Prototypes for supply_gregset etc. */ -#include "gregset.h" - -/* The /proc interface divides the target machine's register set up into - two different sets, the general register set (gregset) and the floating - point register set (fpregset). For each set, there is an ioctl to get - the current register set and another ioctl to set the current values. - - The actual structure passed through the ioctl interface is, of course, - naturally machine dependent, and is different for each set of registers. - For the m68k for example, the general register set is typically defined - by: - - typedef int gregset_t[18]; - - #define R_D0 0 - ... - #define R_PS 17 - - and the floating point set by: - - typedef struct fpregset { - int f_pcr; - int f_psr; - int f_fpiaddr; - int f_fpregs[8][3]; (8 regs, 96 bits each) - } fpregset_t; - - These routines provide the packing and unpacking of gregset_t and - fpregset_t formatted data. - - */ - -/* Atari SVR4 has R_SR but not R_PS */ - -#if !defined (R_PS) && defined (R_SR) -#define R_PS R_SR -#endif - -/* Given a pointer to a general register set in /proc format (gregset_t *), - unpack the register contents and supply them as gdb's idea of the current - register values. */ - -void -supply_gregset (gregset_t *gregsetp) -{ - int regi; - greg_t *regp = (greg_t *) gregsetp; - - for (regi = 0; regi < R_PC; regi++) - { - regcache_raw_supply (current_regcache, regi, (char *) (regp + regi)); - } - regcache_raw_supply (current_regcache, PS_REGNUM, (char *) (regp + R_PS)); - regcache_raw_supply (current_regcache, PC_REGNUM, (char *) (regp + R_PC)); -} - -void -fill_gregset (gregset_t *gregsetp, int regno) -{ - int regi; - greg_t *regp = (greg_t *) gregsetp; - - for (regi = 0; regi < R_PC; regi++) - { - if (regno == -1 || regno == regi) - regcache_raw_collect (current_regcache, regi, regp + regi); - } - if (regno == -1 || regno == PS_REGNUM) - regcache_raw_collect (current_regcache, PS_REGNUM, regp + R_PS); - if (regno == -1 || regno == PC_REGNUM) - regcache_raw_collect (current_regcache, PC_REGNUM, regp + R_PC); -} - -#if defined (FP0_REGNUM) - -/* Given a pointer to a floating point register set in /proc format - (fpregset_t *), unpack the register contents and supply them as gdb's - idea of the current floating point register values. */ - -void -supply_fpregset (fpregset_t *fpregsetp) -{ - int regi; - char *from; - - for (regi = FP0_REGNUM; regi < M68K_FPC_REGNUM; regi++) - { - from = (char *) &(fpregsetp->f_fpregs[regi - FP0_REGNUM][0]); - regcache_raw_supply (current_regcache, regi, from); - } - regcache_raw_supply (current_regcache, M68K_FPC_REGNUM, - (char *) &(fpregsetp->f_pcr)); - regcache_raw_supply (current_regcache, M68K_FPS_REGNUM, - (char *) &(fpregsetp->f_psr)); - regcache_raw_supply (current_regcache, M68K_FPI_REGNUM, - (char *) &(fpregsetp->f_fpiaddr)); -} - -/* Given a pointer to a floating point register set in /proc format - (fpregset_t *), update the register specified by REGNO from gdb's idea - of the current floating point register set. If REGNO is -1, update - them all. */ - -void -fill_fpregset (fpregset_t *fpregsetp, int regno) -{ - int regi; - - for (regi = FP0_REGNUM; regi < M68K_FPC_REGNUM; regi++) - { - if (regno == -1 || regno == regi) - regcache_raw_collect (current_regcache, regi, - &fpregsetp->f_fpregs[regi - FP0_REGNUM][0]); - } - if (regno == -1 || regno == M68K_FPC_REGNUM) - regcache_raw_collect (current_regcache, M68K_FPC_REGNUM, - &fpregsetp->f_pcr); - if (regno == -1 || regno == M68K_FPS_REGNUM) - regcache_raw_collect (current_regcache, M68K_FPS_REGNUM, - &fpregsetp->f_psr); - if (regno == -1 || regno == M68K_FPI_REGNUM) - regcache_raw_collect (current_regcache, M68K_FPI_REGNUM, - &fpregsetp->f_fpiaddr); -} - -#endif /* defined (FP0_REGNUM) */ - -#endif /* USE_PROC_FS */ /* Figure out where the longjmp will land. Slurp the args out of the stack. We expect the first arg to be a pointer to the jmp_buf structure from which diff --git a/gdb/m68klinux-nat.c b/gdb/m68klinux-nat.c index f082f32eeba..f8a24bb6e4e 100644 --- a/gdb/m68klinux-nat.c +++ b/gdb/m68klinux-nat.c @@ -51,6 +51,9 @@ #include "floatformat.h" #include "target.h" + +/* Prototypes for supply_gregset etc. */ +#include "gregset.h" /* This table must line up with REGISTER_NAME in "m68k-tdep.c". */ static const int regmap[] = @@ -238,20 +241,6 @@ old_store_inferior_registers (int regno) (elf_gregset_t *), unpack the register contents and supply them as gdb's idea of the current register values. */ - -/* Note both m68k-tdep.c and m68klinux-nat.c contain definitions - for supply_gregset and supply_fpregset. The definitions - in m68k-tdep.c are valid if USE_PROC_FS is defined. Otherwise, - the definitions in m68klinux-nat.c will be used. This is a - bit of a hack. The supply_* routines do not belong in - *_tdep.c files. But, there are several lynx ports that currently - depend on these definitions. */ - -#ifndef USE_PROC_FS - -/* Prototypes for supply_gregset etc. */ -#include "gregset.h" - void supply_gregset (elf_gregset_t *gregsetp) { @@ -413,8 +402,6 @@ store_fpregs (int tid, int regno) static void fetch_fpregs (int tid) {} static void store_fpregs (int tid, int regno) {} -#endif - #endif /* Transferring arbitrary registers between GDB and inferior. */ diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c index b4c275a3445..9470078aa19 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c @@ -28,6 +28,7 @@ #include "mips-linux-tdep.h" #include "gdb_proc_service.h" +#include "gregset.h" #include @@ -172,6 +173,45 @@ ps_get_thread_area (const struct ps_prochandle *ph, return PS_OK; } +/* Wrapper functions. These are only used by libthread_db. */ + +void +supply_gregset (gdb_gregset_t *gregsetp) +{ + if (mips_isa_regsize (current_gdbarch) == 4) + mips_supply_gregset ((void *) gregsetp); + else + mips64_supply_gregset ((void *) gregsetp); +} + +void +fill_gregset (gdb_gregset_t *gregsetp, int regno) +{ + if (mips_isa_regsize (current_gdbarch) == 4) + mips_fill_gregset ((void *) gregsetp, regno); + else + mips64_fill_gregset ((void *) gregsetp, regno); +} + +void +supply_fpregset (gdb_fpregset_t *fpregsetp) +{ + if (mips_isa_regsize (current_gdbarch) == 4) + mips_supply_fpregset ((void *) fpregsetp); + else + mips64_supply_fpregset ((void *) fpregsetp); +} + +void +fill_fpregset (gdb_fpregset_t *fpregsetp, int regno) +{ + if (mips_isa_regsize (current_gdbarch) == 4) + mips_fill_fpregset ((void *) fpregsetp, regno); + else + mips64_fill_fpregset ((void *) fpregsetp, regno); +} + + /* Fetch REGNO (or all registers if REGNO == -1) from the target using PTRACE_GETREGS et al. */ diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index dec2f4215e6..dd04af0e46f 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -979,48 +979,6 @@ mips_linux_n32n64_sigframe_init (const struct tramp_frame *self, func)); } -/* Wrapper functions. These are only used by libthread_db. */ - -void -supply_gregset (mips_elf_gregset_t *gregsetp) -{ - if (mips_isa_regsize (current_gdbarch) == 4) - mips_supply_gregset (gregsetp); - else - mips64_supply_gregset ((void *) gregsetp); -} - -void -fill_gregset (mips_elf_gregset_t *gregsetp, int regno) -{ - if (mips_isa_regsize (current_gdbarch) == 4) - mips_fill_gregset (gregsetp, regno); - else - mips64_fill_gregset ((void *) gregsetp, regno); -} - -/* Likewise, unpack an elf_fpregset_t. */ - -void -supply_fpregset (mips_elf_fpregset_t *fpregsetp) -{ - if (mips_isa_regsize (current_gdbarch) == 4) - mips_supply_fpregset (fpregsetp); - else - mips64_supply_fpregset ((void *) fpregsetp); -} - -/* Likewise, pack one or all floating point registers into an - elf_fpregset_t. */ - -void -fill_fpregset (mips_elf_fpregset_t *fpregsetp, int regno) -{ - if (mips_isa_regsize (current_gdbarch) == 4) - mips_fill_fpregset (fpregsetp, regno); - else - mips64_fill_fpregset ((void *) fpregsetp, regno); -} /* Initialize one of the GNU/Linux OS ABIs. */