diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 41 | ||||
-rw-r--r-- | gdb/Makefile.in | 2 | ||||
-rw-r--r-- | gdb/mips-linux-nat.c | 27 | ||||
-rw-r--r-- | gdb/mips-linux-tdep.c | 209 | ||||
-rw-r--r-- | gdb/mips-linux-tdep.h | 16 | ||||
-rw-r--r-- | gdb/mipsnbsd-nat.c | 8 | ||||
-rw-r--r-- | gdb/mipsnbsd-tdep.c | 20 | ||||
-rw-r--r-- | gdb/mipsnbsd-tdep.h | 8 |
8 files changed, 198 insertions, 133 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 62afb81..149a38c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,46 @@ 2007-05-06 Ulrich Weigand <uweigand@de.ibm.com> + * mips-linux-tdep.c (supply_32bit_reg): Add REGCACHE parameter. Use it + instead of current_regcache. + (mips_supply_gregset): Likewise. Pass REGCACHE to supply_32bit_reg. + Make GREGSETP const, remove superfluous casts. + (mips_fill_gregset): Add REGCACHE parameter; replace current_regcache. + (mips_supply_fpregset): Likewise. Make FPREGSETP const, remove + superfluous casts. + (mips_fill_fpregset): Add REGCACHE parameter; replace current_regcache. + (supply_64bit_reg): Likewise + (mips64_supply_gregset): Likewise. Pass REGCACHE to supply_64bit_reg. + Make GREGSETP const, adapt casts accordingly. + (mips64_fill_gregset): Add REGCACHE parameter; replace current_regcache. + (mips64_supply_fpregset): Likewise. Make FPREGSET const, adapt + casts accordingly. + (mips64_fill_fpregset): Add REGCACHE parameter; replace current_regcache. + (fetch_core_registers): Pass current_regcache to mips{64}_(supply|fill)_ + helper routines. + * mips-linux-tdep.h (mips_supply_gregset, mips_fill_gregset, + mips_supply_fpregset, mips_fill_fpregset, mips64_supply_gregset, + mips64_fill_gregset, mips64_supply_fpregset, mips64_fill_fpregset): + Adapt prototypes. + * mips-linux-nat.c: Include "regcache.h". + (supply_gregset, fill_gregset, supply_fpregset, fill_fpregset): Pass + current_regcache to mips{64}_(supply|fill)_ helper routines. + (mips64_linux_regsets_fetch_registers): Likewise. + (mips64_linux_regsets_store_registers): Likewise. + + * mipsnbsd-tdep.c (mipsnbsd_supply_reg, mipsnbsd_supply_fpreg): Add + REGCACHE argument; replace current_regcache. Make REGS const. + (mipsnbds_fill_reg, mipsnbsd_fill_fpreg): Add REGCACHE argument; + replace current_regcache. + * mipsnbsd-tdep.h (ipsnbsd_supply_reg, mipsnbsd_supply_fpreg, + mipsnbds_fill_reg, mipsnbsd_fill_fpreg): Adapt prototypes. + * mipsnbsd-nat.c (mipsnbsd_fetch_inferior_registers, + mipsnbsd_store_inferior_registers): Pass current_regcache to + mipsnbsd_(supply|fill)_... helper routines. + + * Makefile.in (mips-linux-nat.o): Update dependencies. + +2007-05-06 Ulrich Weigand <uweigand@de.ibm.com> + * i387-tdep.c (i387_fill_fsave, i387_fill_fxsave): Remove. * i387-tdep.h (i387_fill_fsave, i387_fill_fxsave): Remove prototypes. * i368-linux-nat.c (supply_fpregset, supply_fpxregset): Replace diff --git a/gdb/Makefile.in b/gdb/Makefile.in index b85ffbc..40823b6 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -2341,7 +2341,7 @@ 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) $(gregset_h) \ + $(regcache_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) \ diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c index 9470078..6265724 100644 --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c @@ -24,6 +24,7 @@ #include "inferior.h" #include "mips-tdep.h" #include "target.h" +#include "regcache.h" #include "linux-nat.h" #include "mips-linux-tdep.h" @@ -179,36 +180,36 @@ void supply_gregset (gdb_gregset_t *gregsetp) { if (mips_isa_regsize (current_gdbarch) == 4) - mips_supply_gregset ((void *) gregsetp); + mips_supply_gregset (current_regcache, (void *) gregsetp); else - mips64_supply_gregset ((void *) gregsetp); + mips64_supply_gregset (current_regcache, (void *) gregsetp); } void fill_gregset (gdb_gregset_t *gregsetp, int regno) { if (mips_isa_regsize (current_gdbarch) == 4) - mips_fill_gregset ((void *) gregsetp, regno); + mips_fill_gregset (current_regcache, (void *) gregsetp, regno); else - mips64_fill_gregset ((void *) gregsetp, regno); + mips64_fill_gregset (current_regcache, (void *) gregsetp, regno); } void supply_fpregset (gdb_fpregset_t *fpregsetp) { if (mips_isa_regsize (current_gdbarch) == 4) - mips_supply_fpregset ((void *) fpregsetp); + mips_supply_fpregset (current_regcache, (void *) fpregsetp); else - mips64_supply_fpregset ((void *) fpregsetp); + mips64_supply_fpregset (current_regcache, (void *) fpregsetp); } void fill_fpregset (gdb_fpregset_t *fpregsetp, int regno) { if (mips_isa_regsize (current_gdbarch) == 4) - mips_fill_fpregset ((void *) fpregsetp, regno); + mips_fill_fpregset (current_regcache, (void *) fpregsetp, regno); else - mips64_fill_fpregset ((void *) fpregsetp, regno); + mips64_fill_fpregset (current_regcache, (void *) fpregsetp, regno); } @@ -249,7 +250,8 @@ mips64_linux_regsets_fetch_registers (int regno) perror_with_name (_("Couldn't get registers")); } - mips64_supply_gregset (®s); + mips64_supply_gregset (current_regcache, + (const mips64_elf_gregset_t *) ®s); } if (regno == -1 || is_fp) @@ -267,7 +269,8 @@ mips64_linux_regsets_fetch_registers (int regno) perror_with_name (_("Couldn't get FP registers")); } - mips64_supply_fpregset (&fp_regs); + mips64_supply_fpregset (current_regcache, + (const mips64_elf_fpregset_t *) &fp_regs); } } @@ -301,7 +304,7 @@ mips64_linux_regsets_store_registers (int regno) if (ptrace (PTRACE_GETREGS, tid, 0L, (PTRACE_TYPE_ARG3) ®s) == -1) perror_with_name (_("Couldn't get registers")); - mips64_fill_gregset (®s, regno); + mips64_fill_gregset (current_regcache, ®s, regno); if (ptrace (PTRACE_SETREGS, tid, 0L, (PTRACE_TYPE_ARG3) ®s) == -1) perror_with_name (_("Couldn't set registers")); @@ -315,7 +318,7 @@ mips64_linux_regsets_store_registers (int regno) (PTRACE_TYPE_ARG3) &fp_regs) == -1) perror_with_name (_("Couldn't get FP registers")); - mips64_fill_fpregset (&fp_regs, regno); + mips64_fill_fpregset (current_regcache, &fp_regs, regno); if (ptrace (PTRACE_SETFPREGS, tid, 0L, (PTRACE_TYPE_ARG3) &fp_regs) == -1) diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index dd04af0..2407cc7 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -69,53 +69,55 @@ mips_linux_get_longjmp_target (CORE_ADDR *pc) is 8. */ static void -supply_32bit_reg (int regnum, const void *addr) +supply_32bit_reg (struct regcache *regcache, int regnum, const void *addr) { gdb_byte buf[MAX_REGISTER_SIZE]; store_signed_integer (buf, register_size (current_gdbarch, regnum), extract_signed_integer (addr, 4)); - regcache_raw_supply (current_regcache, regnum, buf); + regcache_raw_supply (regcache, regnum, buf); } /* Unpack an elf_gregset_t into GDB's register cache. */ void -mips_supply_gregset (mips_elf_gregset_t *gregsetp) +mips_supply_gregset (struct regcache *regcache, + const mips_elf_gregset_t *gregsetp) { int regi; - mips_elf_greg_t *regp = *gregsetp; + const mips_elf_greg_t *regp = *gregsetp; char zerobuf[MAX_REGISTER_SIZE]; memset (zerobuf, 0, MAX_REGISTER_SIZE); for (regi = EF_REG0; regi <= EF_REG31; regi++) - supply_32bit_reg ((regi - EF_REG0), (char *)(regp + regi)); + supply_32bit_reg (regcache, regi - EF_REG0, regp + regi); - supply_32bit_reg (mips_regnum (current_gdbarch)->lo, - (char *)(regp + EF_LO)); - supply_32bit_reg (mips_regnum (current_gdbarch)->hi, - (char *)(regp + EF_HI)); + supply_32bit_reg (regcache, mips_regnum (current_gdbarch)->lo, + regp + EF_LO); + supply_32bit_reg (regcache, mips_regnum (current_gdbarch)->hi, + regp + EF_HI); - supply_32bit_reg (mips_regnum (current_gdbarch)->pc, - (char *)(regp + EF_CP0_EPC)); - supply_32bit_reg (mips_regnum (current_gdbarch)->badvaddr, - (char *)(regp + EF_CP0_BADVADDR)); - supply_32bit_reg (MIPS_PS_REGNUM, (char *)(regp + EF_CP0_STATUS)); - supply_32bit_reg (mips_regnum (current_gdbarch)->cause, - (char *)(regp + EF_CP0_CAUSE)); + supply_32bit_reg (regcache, mips_regnum (current_gdbarch)->pc, + regp + EF_CP0_EPC); + supply_32bit_reg (regcache, mips_regnum (current_gdbarch)->badvaddr, + regp + EF_CP0_BADVADDR); + supply_32bit_reg (regcache, MIPS_PS_REGNUM, regp + EF_CP0_STATUS); + supply_32bit_reg (regcache, mips_regnum (current_gdbarch)->cause, + regp + EF_CP0_CAUSE); /* Fill inaccessible registers with zero. */ - regcache_raw_supply (current_regcache, MIPS_UNUSED_REGNUM, zerobuf); + regcache_raw_supply (regcache, MIPS_UNUSED_REGNUM, zerobuf); for (regi = MIPS_FIRST_EMBED_REGNUM; regi < MIPS_LAST_EMBED_REGNUM; regi++) - regcache_raw_supply (current_regcache, regi, zerobuf); + regcache_raw_supply (regcache, regi, zerobuf); } /* Pack our registers (or one register) into an elf_gregset_t. */ void -mips_fill_gregset (mips_elf_gregset_t *gregsetp, int regno) +mips_fill_gregset (const struct regcache *regcache, + mips_elf_gregset_t *gregsetp, int regno) { int regaddr, regi; mips_elf_greg_t *regp = *gregsetp; @@ -125,21 +127,25 @@ mips_fill_gregset (mips_elf_gregset_t *gregsetp, int regno) { memset (regp, 0, sizeof (mips_elf_gregset_t)); for (regi = 0; regi < 32; regi++) - mips_fill_gregset (gregsetp, regi); - mips_fill_gregset (gregsetp, mips_regnum (current_gdbarch)->lo); - mips_fill_gregset (gregsetp, mips_regnum (current_gdbarch)->hi); - mips_fill_gregset (gregsetp, mips_regnum (current_gdbarch)->pc); - mips_fill_gregset (gregsetp, mips_regnum (current_gdbarch)->badvaddr); - mips_fill_gregset (gregsetp, MIPS_PS_REGNUM); - mips_fill_gregset (gregsetp, mips_regnum (current_gdbarch)->cause); - + mips_fill_gregset (regcache, gregsetp, regi); + mips_fill_gregset (regcache, gregsetp, + mips_regnum (current_gdbarch)->lo); + mips_fill_gregset (regcache, gregsetp, + mips_regnum (current_gdbarch)->hi); + mips_fill_gregset (regcache, gregsetp, + mips_regnum (current_gdbarch)->pc); + mips_fill_gregset (regcache, gregsetp, + mips_regnum (current_gdbarch)->badvaddr); + mips_fill_gregset (regcache, gregsetp, MIPS_PS_REGNUM); + mips_fill_gregset (regcache, gregsetp, + mips_regnum (current_gdbarch)->cause); return; } if (regno < 32) { dst = regp + regno + EF_REG0; - regcache_raw_collect (current_regcache, regno, dst); + regcache_raw_collect (regcache, regno, dst); return; } @@ -161,14 +167,15 @@ mips_fill_gregset (mips_elf_gregset_t *gregsetp, int regno) if (regaddr != -1) { dst = regp + regaddr; - regcache_raw_collect (current_regcache, regno, dst); + regcache_raw_collect (regcache, regno, dst); } } /* Likewise, unpack an elf_fpregset_t. */ void -mips_supply_fpregset (mips_elf_fpregset_t *fpregsetp) +mips_supply_fpregset (struct regcache *regcache, + const mips_elf_fpregset_t *fpregsetp) { int regi; char zerobuf[MAX_REGISTER_SIZE]; @@ -176,15 +183,14 @@ mips_supply_fpregset (mips_elf_fpregset_t *fpregsetp) memset (zerobuf, 0, MAX_REGISTER_SIZE); for (regi = 0; regi < 32; regi++) - regcache_raw_supply (current_regcache, FP0_REGNUM + regi, - (char *)(*fpregsetp + regi)); + regcache_raw_supply (regcache, FP0_REGNUM + regi, *fpregsetp + regi); - regcache_raw_supply (current_regcache, + regcache_raw_supply (regcache, mips_regnum (current_gdbarch)->fp_control_status, - (char *)(*fpregsetp + 32)); + *fpregsetp + 32); /* FIXME: how can we supply FCRIR? The ABI doesn't tell us. */ - regcache_raw_supply (current_regcache, + regcache_raw_supply (regcache, mips_regnum (current_gdbarch)->fp_implementation_revision, zerobuf); } @@ -193,27 +199,28 @@ mips_supply_fpregset (mips_elf_fpregset_t *fpregsetp) elf_fpregset_t. */ void -mips_fill_fpregset (mips_elf_fpregset_t *fpregsetp, int regno) +mips_fill_fpregset (const struct regcache *regcache, + mips_elf_fpregset_t *fpregsetp, int regno) { char *from, *to; if ((regno >= FP0_REGNUM) && (regno < FP0_REGNUM + 32)) { to = (char *) (*fpregsetp + regno - FP0_REGNUM); - regcache_raw_collect (current_regcache, regno, to); + regcache_raw_collect (regcache, regno, to); } else if (regno == mips_regnum (current_gdbarch)->fp_control_status) { to = (char *) (*fpregsetp + 32); - regcache_raw_collect (current_regcache, regno, to); + regcache_raw_collect (regcache, regno, to); } else if (regno == -1) { int regi; for (regi = 0; regi < 32; regi++) - mips_fill_fpregset (fpregsetp, FP0_REGNUM + regi); - mips_fill_fpregset (fpregsetp, + mips_fill_fpregset (regcache, fpregsetp, FP0_REGNUM + regi); + mips_fill_fpregset (regcache, fpregsetp, mips_regnum (current_gdbarch)->fp_control_status); } } @@ -255,55 +262,59 @@ mips64_linux_get_longjmp_target (CORE_ADDR *pc) /* Supply a 64-bit register. */ void -supply_64bit_reg (int regnum, const gdb_byte *buf) +supply_64bit_reg (struct regcache *regcache, int regnum, + const gdb_byte *buf) { if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG && register_size (current_gdbarch, regnum) == 4) - regcache_raw_supply (current_regcache, regnum, buf + 4); + regcache_raw_supply (regcache, regnum, buf + 4); else - regcache_raw_supply (current_regcache, regnum, buf); + regcache_raw_supply (regcache, regnum, buf); } /* Unpack a 64-bit elf_gregset_t into GDB's register cache. */ void -mips64_supply_gregset (mips64_elf_gregset_t *gregsetp) +mips64_supply_gregset (struct regcache *regcache, + const mips64_elf_gregset_t *gregsetp) { int regi; - mips64_elf_greg_t *regp = *gregsetp; + const mips64_elf_greg_t *regp = *gregsetp; gdb_byte zerobuf[MAX_REGISTER_SIZE]; memset (zerobuf, 0, MAX_REGISTER_SIZE); for (regi = MIPS64_EF_REG0; regi <= MIPS64_EF_REG31; regi++) - supply_64bit_reg (regi - MIPS64_EF_REG0, (gdb_byte *)(regp + regi)); - - supply_64bit_reg (mips_regnum (current_gdbarch)->lo, - (gdb_byte *) (regp + MIPS64_EF_LO)); - supply_64bit_reg (mips_regnum (current_gdbarch)->hi, - (gdb_byte *) (regp + MIPS64_EF_HI)); - - supply_64bit_reg (mips_regnum (current_gdbarch)->pc, - (gdb_byte *) (regp + MIPS64_EF_CP0_EPC)); - supply_64bit_reg (mips_regnum (current_gdbarch)->badvaddr, - (gdb_byte *) (regp + MIPS64_EF_CP0_BADVADDR)); - supply_64bit_reg (MIPS_PS_REGNUM, - (gdb_byte *) (regp + MIPS64_EF_CP0_STATUS)); - supply_64bit_reg (mips_regnum (current_gdbarch)->cause, - (gdb_byte *) (regp + MIPS64_EF_CP0_CAUSE)); + supply_64bit_reg (regcache, regi - MIPS64_EF_REG0, + (const gdb_byte *)(regp + regi)); + + supply_64bit_reg (regcache, mips_regnum (current_gdbarch)->lo, + (const gdb_byte *) (regp + MIPS64_EF_LO)); + supply_64bit_reg (regcache, mips_regnum (current_gdbarch)->hi, + (const gdb_byte *) (regp + MIPS64_EF_HI)); + + supply_64bit_reg (regcache, mips_regnum (current_gdbarch)->pc, + (const gdb_byte *) (regp + MIPS64_EF_CP0_EPC)); + supply_64bit_reg (regcache, mips_regnum (current_gdbarch)->badvaddr, + (const gdb_byte *) (regp + MIPS64_EF_CP0_BADVADDR)); + supply_64bit_reg (regcache, MIPS_PS_REGNUM, + (const gdb_byte *) (regp + MIPS64_EF_CP0_STATUS)); + supply_64bit_reg (regcache, mips_regnum (current_gdbarch)->cause, + (const gdb_byte *) (regp + MIPS64_EF_CP0_CAUSE)); /* Fill inaccessible registers with zero. */ - regcache_raw_supply (current_regcache, MIPS_UNUSED_REGNUM, zerobuf); + regcache_raw_supply (regcache, MIPS_UNUSED_REGNUM, zerobuf); for (regi = MIPS_FIRST_EMBED_REGNUM; regi < MIPS_LAST_EMBED_REGNUM; regi++) - regcache_raw_supply (current_regcache, regi, zerobuf); + regcache_raw_supply (regcache, regi, zerobuf); } /* Pack our registers (or one register) into a 64-bit elf_gregset_t. */ void -mips64_fill_gregset (mips64_elf_gregset_t *gregsetp, int regno) +mips64_fill_gregset (const struct regcache *regcache, + mips64_elf_gregset_t *gregsetp, int regno) { int regaddr, regi; mips64_elf_greg_t *regp = *gregsetp; @@ -313,16 +324,18 @@ mips64_fill_gregset (mips64_elf_gregset_t *gregsetp, int regno) { memset (regp, 0, sizeof (mips64_elf_gregset_t)); for (regi = 0; regi < 32; regi++) - mips64_fill_gregset (gregsetp, regi); - mips64_fill_gregset (gregsetp, mips_regnum (current_gdbarch)->lo); - mips64_fill_gregset (gregsetp, mips_regnum (current_gdbarch)->hi); - mips64_fill_gregset (gregsetp, mips_regnum (current_gdbarch)->pc); - mips64_fill_gregset (gregsetp, + mips64_fill_gregset (regcache, gregsetp, regi); + mips64_fill_gregset (regcache, gregsetp, + mips_regnum (current_gdbarch)->lo); + mips64_fill_gregset (regcache, gregsetp, + mips_regnum (current_gdbarch)->hi); + mips64_fill_gregset (regcache, gregsetp, + mips_regnum (current_gdbarch)->pc); + mips64_fill_gregset (regcache, gregsetp, mips_regnum (current_gdbarch)->badvaddr); - mips64_fill_gregset (gregsetp, MIPS_PS_REGNUM); - mips64_fill_gregset (gregsetp, + mips64_fill_gregset (regcache, gregsetp, MIPS_PS_REGNUM); + mips64_fill_gregset (regcache, gregsetp, mips_regnum (current_gdbarch)->cause); - return; } @@ -348,7 +361,7 @@ mips64_fill_gregset (mips64_elf_gregset_t *gregsetp, int regno) gdb_byte buf[MAX_REGISTER_SIZE]; LONGEST val; - regcache_raw_collect (current_regcache, regno, buf); + regcache_raw_collect (regcache, regno, buf); val = extract_signed_integer (buf, register_size (current_gdbarch, regno)); dst = regp + regaddr; @@ -359,7 +372,8 @@ mips64_fill_gregset (mips64_elf_gregset_t *gregsetp, int regno) /* Likewise, unpack an elf_fpregset_t. */ void -mips64_supply_fpregset (mips64_elf_fpregset_t *fpregsetp) +mips64_supply_fpregset (struct regcache *regcache, + const mips64_elf_fpregset_t *fpregsetp) { int regi; @@ -368,31 +382,33 @@ mips64_supply_fpregset (mips64_elf_fpregset_t *fpregsetp) if (register_size (current_gdbarch, FP0_REGNUM) == 4) for (regi = 0; regi < 32; regi++) { - gdb_byte *reg_ptr = (gdb_byte *) (*fpregsetp + (regi & ~1)); + const gdb_byte *reg_ptr = (const gdb_byte *)(*fpregsetp + (regi & ~1)); if ((TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) != (regi & 1)) reg_ptr += 4; - regcache_raw_supply (current_regcache, FP0_REGNUM + regi, reg_ptr); + regcache_raw_supply (regcache, FP0_REGNUM + regi, reg_ptr); } else for (regi = 0; regi < 32; regi++) - regcache_raw_supply (current_regcache, FP0_REGNUM + regi, - (char *)(*fpregsetp + regi)); + regcache_raw_supply (regcache, FP0_REGNUM + regi, + (const char *)(*fpregsetp + regi)); - supply_32bit_reg (mips_regnum (current_gdbarch)->fp_control_status, - (gdb_byte *)(*fpregsetp + 32)); + supply_32bit_reg (regcache, mips_regnum (current_gdbarch)->fp_control_status, + (const gdb_byte *)(*fpregsetp + 32)); /* The ABI doesn't tell us how to supply FCRIR, and core dumps don't include it - but the result of PTRACE_GETFPREGS does. The best we can do is to assume that its value is present. */ - supply_32bit_reg (mips_regnum (current_gdbarch)->fp_implementation_revision, - (gdb_byte *)(*fpregsetp + 32) + 4); + supply_32bit_reg (regcache, + mips_regnum (current_gdbarch)->fp_implementation_revision, + (const gdb_byte *)(*fpregsetp + 32) + 4); } /* Likewise, pack one or all floating point registers into an elf_fpregset_t. */ void -mips64_fill_fpregset (mips64_elf_fpregset_t *fpregsetp, int regno) +mips64_fill_fpregset (const struct regcache *regcache, + mips64_elf_fpregset_t *fpregsetp, int regno) { gdb_byte *to; @@ -407,12 +423,12 @@ mips64_fill_fpregset (mips64_elf_fpregset_t *fpregsetp, int regno) to = (gdb_byte *) (*fpregsetp + (regi & ~1)); if ((TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) != (regi & 1)) to += 4; - regcache_raw_collect (current_regcache, regno, to); + regcache_raw_collect (regcache, regno, to); } else { to = (gdb_byte *) (*fpregsetp + regno - FP0_REGNUM); - regcache_raw_collect (current_regcache, regno, to); + regcache_raw_collect (regcache, regno, to); } } else if (regno == mips_regnum (current_gdbarch)->fp_control_status) @@ -420,7 +436,7 @@ mips64_fill_fpregset (mips64_elf_fpregset_t *fpregsetp, int regno) gdb_byte buf[MAX_REGISTER_SIZE]; LONGEST val; - regcache_raw_collect (current_regcache, regno, buf); + regcache_raw_collect (regcache, regno, buf); val = extract_signed_integer (buf, register_size (current_gdbarch, regno)); to = (gdb_byte *) (*fpregsetp + 32); @@ -431,7 +447,7 @@ mips64_fill_fpregset (mips64_elf_fpregset_t *fpregsetp, int regno) gdb_byte buf[MAX_REGISTER_SIZE]; LONGEST val; - regcache_raw_collect (current_regcache, regno, buf); + regcache_raw_collect (regcache, regno, buf); val = extract_signed_integer (buf, register_size (current_gdbarch, regno)); to = (gdb_byte *) (*fpregsetp + 32) + 4; @@ -442,11 +458,12 @@ mips64_fill_fpregset (mips64_elf_fpregset_t *fpregsetp, int regno) int regi; for (regi = 0; regi < 32; regi++) - mips64_fill_fpregset (fpregsetp, FP0_REGNUM + regi); - mips64_fill_fpregset (fpregsetp, + mips64_fill_fpregset (regcache, fpregsetp, FP0_REGNUM + regi); + mips64_fill_fpregset (regcache, fpregsetp, mips_regnum (current_gdbarch)->fp_control_status); - mips64_fill_fpregset (fpregsetp, (mips_regnum (current_gdbarch) - ->fp_implementation_revision)); + mips64_fill_fpregset (regcache, fpregsetp, + (mips_regnum (current_gdbarch) + ->fp_implementation_revision)); } } @@ -468,12 +485,14 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, if (core_reg_size == sizeof (gregset)) { memcpy ((char *) &gregset, core_reg_sect, sizeof (gregset)); - mips_supply_gregset (&gregset); + mips_supply_gregset (current_regcache, + (const mips_elf_gregset_t *) &gregset); } else if (core_reg_size == sizeof (gregset64)) { memcpy ((char *) &gregset64, core_reg_sect, sizeof (gregset64)); - mips64_supply_gregset (&gregset64); + mips64_supply_gregset (current_regcache, + (const mips64_elf_gregset_t *) &gregset64); } else { @@ -485,13 +504,15 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, if (core_reg_size == sizeof (fpregset)) { memcpy ((char *) &fpregset, core_reg_sect, sizeof (fpregset)); - mips_supply_fpregset (&fpregset); + mips_supply_fpregset (current_regcache, + (const mips_elf_fpregset_t *) &fpregset); } else if (core_reg_size == sizeof (fpregset64)) { memcpy ((char *) &fpregset64, core_reg_sect, sizeof (fpregset64)); - mips64_supply_fpregset (&fpregset64); + mips64_supply_fpregset (current_regcache, + (const mips64_elf_fpregset_t *) &fpregset64); } else { diff --git a/gdb/mips-linux-tdep.h b/gdb/mips-linux-tdep.h index d8c6743..213a745 100644 --- a/gdb/mips-linux-tdep.h +++ b/gdb/mips-linux-tdep.h @@ -50,10 +50,10 @@ typedef mips_elf_fpreg_t mips_elf_fpregset_t[ELF_NFPREG]; #define EF_SIZE 180 -void mips_supply_gregset (mips_elf_gregset_t *); -void mips_fill_gregset (mips_elf_gregset_t *, int); -void mips_supply_fpregset (mips_elf_fpregset_t *); -void mips_fill_fpregset (mips_elf_fpregset_t *, int); +void mips_supply_gregset (struct regcache *, const mips_elf_gregset_t *); +void mips_fill_gregset (const struct regcache *, mips_elf_gregset_t *, int); +void mips_supply_fpregset (struct regcache *, const mips_elf_fpregset_t *); +void mips_fill_fpregset (const struct regcache *, mips_elf_fpregset_t *, int); /* 64-bit support. */ @@ -88,7 +88,7 @@ typedef mips64_elf_fpreg_t mips64_elf_fpregset_t[MIPS64_ELF_NFPREG]; #define MIPS64_EF_SIZE 304 -void mips64_supply_gregset (mips64_elf_gregset_t *); -void mips64_fill_gregset (mips64_elf_gregset_t *, int); -void mips64_supply_fpregset (mips64_elf_fpregset_t *); -void mips64_fill_fpregset (mips64_elf_fpregset_t *, int); +void mips64_supply_gregset (struct regcache *, const mips64_elf_gregset_t *); +void mips64_fill_gregset (const struct regcache *, mips64_elf_gregset_t *, int); +void mips64_supply_fpregset (struct regcache *, const mips64_elf_fpregset_t *); +void mips64_fill_fpregset (const struct regcache *, mips64_elf_fpregset_t *, int); diff --git a/gdb/mipsnbsd-nat.c b/gdb/mipsnbsd-nat.c index 086466c..2bea684 100644 --- a/gdb/mipsnbsd-nat.c +++ b/gdb/mipsnbsd-nat.c @@ -50,7 +50,7 @@ mipsnbsd_fetch_inferior_registers (int regno) (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't get registers")); - mipsnbsd_supply_reg ((char *) ®s, regno); + mipsnbsd_supply_reg (current_regcache, (char *) ®s, regno); if (regno != -1) return; } @@ -63,7 +63,7 @@ mipsnbsd_fetch_inferior_registers (int regno) (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) perror_with_name (_("Couldn't get floating point status")); - mipsnbsd_supply_fpreg ((char *) &fpregs, regno); + mipsnbsd_supply_fpreg (current_regcache, (char *) &fpregs, regno); } } @@ -78,7 +78,7 @@ mipsnbsd_store_inferior_registers (int regno) (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't get registers")); - mipsnbsd_fill_reg ((char *) ®s, regno); + mipsnbsd_fill_reg (current_regcache, (char *) ®s, regno); if (ptrace (PT_SETREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) ®s, 0) == -1) @@ -96,7 +96,7 @@ mipsnbsd_store_inferior_registers (int regno) (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) perror_with_name (_("Couldn't get floating point status")); - mipsnbsd_fill_fpreg ((char *) &fpregs, regno); + mipsnbsd_fill_fpreg (current_regcache, (char *) &fpregs, regno); if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) diff --git a/gdb/mipsnbsd-tdep.c b/gdb/mipsnbsd-tdep.c index d55708d..3e69d1c 100644 --- a/gdb/mipsnbsd-tdep.c +++ b/gdb/mipsnbsd-tdep.c @@ -142,7 +142,7 @@ mipsnbsd_regset_from_core_section (struct gdbarch *gdbarch, ptrace register structure used by NetBSD/mips. */ void -mipsnbsd_supply_reg (char *regs, int regno) +mipsnbsd_supply_reg (struct regcache *regcache, const char *regs, int regno) { int i; @@ -151,27 +151,27 @@ mipsnbsd_supply_reg (char *regs, int regno) if (regno == i || regno == -1) { if (CANNOT_FETCH_REGISTER (i)) - regcache_raw_supply (current_regcache, i, NULL); + regcache_raw_supply (regcache, i, NULL); else - regcache_raw_supply (current_regcache, i, + regcache_raw_supply (regcache, i, regs + (i * mips_isa_regsize (current_gdbarch))); } } } void -mipsnbsd_fill_reg (char *regs, int regno) +mipsnbsd_fill_reg (const struct regcache *regcache, char *regs, int regno) { int i; for (i = 0; i <= PC_REGNUM; i++) if ((regno == i || regno == -1) && ! CANNOT_STORE_REGISTER (i)) - regcache_raw_collect (current_regcache, i, + regcache_raw_collect (regcache, i, regs + (i * mips_isa_regsize (current_gdbarch))); } void -mipsnbsd_supply_fpreg (char *fpregs, int regno) +mipsnbsd_supply_fpreg (struct regcache *regcache, const char *fpregs, int regno) { int i; @@ -182,23 +182,23 @@ mipsnbsd_supply_fpreg (char *fpregs, int regno) if (regno == i || regno == -1) { if (CANNOT_FETCH_REGISTER (i)) - regcache_raw_supply (current_regcache, i, NULL); + regcache_raw_supply (regcache, i, NULL); else - regcache_raw_supply (current_regcache, i, + regcache_raw_supply (regcache, i, fpregs + ((i - FP0_REGNUM) * mips_isa_regsize (current_gdbarch))); } } } void -mipsnbsd_fill_fpreg (char *fpregs, int regno) +mipsnbsd_fill_fpreg (const struct regcache *regcache, char *fpregs, int regno) { int i; for (i = FP0_REGNUM; i <= mips_regnum (current_gdbarch)->fp_control_status; i++) if ((regno == i || regno == -1) && ! CANNOT_STORE_REGISTER (i)) - regcache_raw_collect (current_regcache, i, + regcache_raw_collect (regcache, i, fpregs + ((i - FP0_REGNUM) * mips_isa_regsize (current_gdbarch))); } diff --git a/gdb/mipsnbsd-tdep.h b/gdb/mipsnbsd-tdep.h index 61efd2e..deaccd6 100644 --- a/gdb/mipsnbsd-tdep.h +++ b/gdb/mipsnbsd-tdep.h @@ -22,11 +22,11 @@ #ifndef MIPSNBSD_TDEP_H #define MIPSNBSD_TDEP_H -void mipsnbsd_supply_reg (char *, int); -void mipsnbsd_fill_reg (char *, int); +void mipsnbsd_supply_reg (struct regcache *, const char *, int); +void mipsnbsd_fill_reg (const struct regcache *, char *, int); -void mipsnbsd_supply_fpreg (char *, int); -void mipsnbsd_fill_fpreg (char *, int); +void mipsnbsd_supply_fpreg (struct regcache *, const char *, int); +void mipsnbsd_fill_fpreg (const struct regcache *, char *, int); #define SIZEOF_STRUCT_REG (38 * mips_isa_regsize (current_gdbarch)) #define SIZEOF_STRUCT_FPREG (33 * mips_isa_regsize (current_gdbarch)) |