X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Friscv-fbsd-nat.c;h=24381e0dccf949f4a0f479d9a02317e99ae073eb;hb=fb46334198d8d4f82133033758cb75f086d864ad;hp=ad4ea1e0ad1d70651297764f0073295e96153e11;hpb=74792ff782431ec6113b9a8a8e85b95f46094c7f;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/riscv-fbsd-nat.c b/gdb/riscv-fbsd-nat.c index ad4ea1e0ad..24381e0dcc 100644 --- a/gdb/riscv-fbsd-nat.c +++ b/gdb/riscv-fbsd-nat.c @@ -1,6 +1,6 @@ /* Native-dependent code for FreeBSD/riscv. - Copyright (C) 2018 Free Software Foundation, Inc. + Copyright (C) 2018-2019 Free Software Foundation, Inc. This file is part of GDB. @@ -18,6 +18,7 @@ along with this program. If not, see . */ #include "defs.h" +#include "regcache.h" #include "target.h" #include @@ -40,15 +41,16 @@ static riscv_fbsd_nat_target the_riscv_fbsd_nat_target; /* Determine if PT_GETREGS fetches REGNUM. */ static bool -getregs_supplies (struct gdbarch *gdbarch, int regnum) +getregs_supplies (int regnum) { - return (regnum >= RISCV_RA_REGNUM && regnum <= RISCV_PC_REGNUM); + return ((regnum >= RISCV_RA_REGNUM && regnum <= RISCV_PC_REGNUM) + || regnum == RISCV_CSR_SSTATUS_REGNUM); } /* Determine if PT_GETFPREGS fetches REGNUM. */ static bool -getfpregs_supplies (struct gdbarch *gdbarch, int regnum) +getfpregs_supplies (int regnum) { return ((regnum >= RISCV_FIRST_FP_REGNUM && regnum <= RISCV_LAST_FP_REGNUM) || regnum == RISCV_CSR_FCSR_REGNUM); @@ -63,10 +65,9 @@ riscv_fbsd_nat_target::fetch_registers (struct regcache *regcache, { pid_t pid = get_ptrace_pid (regcache->ptid ()); - struct gdbarch *gdbarch = regcache->arch (); if (regnum == -1 || regnum == RISCV_ZERO_REGNUM) regcache->raw_supply_zeroed (RISCV_ZERO_REGNUM); - if (regnum == -1 || getregs_supplies (gdbarch, regnum)) + if (regnum == -1 || getregs_supplies (regnum)) { struct reg regs; @@ -77,7 +78,7 @@ riscv_fbsd_nat_target::fetch_registers (struct regcache *regcache, sizeof (regs)); } - if (regnum == -1 || getfpregs_supplies (gdbarch, regnum)) + if (regnum == -1 || getfpregs_supplies (regnum)) { struct fpreg fpregs; @@ -98,8 +99,7 @@ riscv_fbsd_nat_target::store_registers (struct regcache *regcache, { pid_t pid = get_ptrace_pid (regcache->ptid ()); - struct gdbarch *gdbarch = regcache->arch (); - if (regnum == -1 || getregs_supplies (gdbarch, regnum)) + if (regnum == -1 || getregs_supplies (regnum)) { struct reg regs; @@ -113,7 +113,7 @@ riscv_fbsd_nat_target::store_registers (struct regcache *regcache, perror_with_name (_("Couldn't write registers")); } - if (regnum == -1 || getfpregs_supplies (gdbarch, regnum)) + if (regnum == -1 || getfpregs_supplies (regnum)) { struct fpreg fpregs;