* 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.
This commit is contained in:
Ulrich Weigand 2007-04-29 19:44:22 +00:00
parent b1d53152e0
commit 3e00823eb4
6 changed files with 59 additions and 194 deletions

View File

@ -1,3 +1,16 @@
2007-04-29 Ulrich Weigand <uweigand@de.ibm.com>
* 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 <uweigand@de.ibm.com>
* regcache.c (deprecated_read_register_gen): Remove, inline ...

View File

@ -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) \

View File

@ -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 <sys/procfs.h>
/* 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

View File

@ -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. */

View File

@ -28,6 +28,7 @@
#include "mips-linux-tdep.h"
#include "gdb_proc_service.h"
#include "gregset.h"
#include <sys/ptrace.h>
@ -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. */

View File

@ -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. */