+2017-05-23 John Baldwin <jhb@FreeBSD.org>
+
+ * mips-fbsd-nat.c (getregs_supplies): Fix upper bound comparison.
+ (getpfpregs_supplies): New function.
+ (mips_fbsd_fetch_inferior_registers): Remove early exit and use
+ getfpregs_supplies.
+ (mips_fbsd_store_inferior_registers): Likewise.
+
2017-05-22 Pedro Alves <palves@redhat.com>
* MAINTAINERS (Host/Native): Add John Baldwin as FreeBSD
#include "mips-fbsd-tdep.h"
#include "inf-ptrace.h"
-/* Determine if PT_GETREGS fetches this register. */
+/* Determine if PT_GETREGS fetches REGNUM. */
static bool
getregs_supplies (struct gdbarch *gdbarch, int regnum)
{
return (regnum >= MIPS_ZERO_REGNUM
- && regnum <= gdbarch_pc_regnum (gdbarch));
+ && regnum <= mips_regnum (gdbarch)->pc);
+}
+
+/* Determine if PT_GETFPREGS fetches REGNUM. */
+
+static bool
+getfpregs_supplies (struct gdbarch *gdbarch, int regnum)
+{
+ return (regnum >= mips_regnum (gdbarch)->fp0
+ && regnum < mips_regnum (gdbarch)->fp_implementation_revision);
}
/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
perror_with_name (_("Couldn't get registers"));
mips_fbsd_supply_gregs (regcache, regnum, ®s, sizeof (register_t));
- if (regnum != -1)
- return;
}
- if (regnum == -1
- || regnum >= gdbarch_fp0_regnum (get_regcache_arch (regcache)))
+ if (regnum == -1 || getfpregs_supplies (gdbarch, regnum))
{
struct fpreg fpregs;
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't write registers"));
-
- if (regnum != -1)
- return;
}
- if (regnum == -1
- || regnum >= gdbarch_fp0_regnum (get_regcache_arch (regcache)))
+ if (regnum == -1 || getfpregs_supplies (gdbarch, regnum))
{
struct fpreg fpregs;