aboutsummaryrefslogtreecommitdiff
path: root/gdbserver/linux-mips-low.cc
diff options
context:
space:
mode:
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2020-04-02 15:11:24 +0200
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2020-04-02 15:11:24 +0200
commitdaca57a7de50f97a4e8df917447561617a0298b2 (patch)
treec73e1076e18bd72edf5d8fc252349c7f33ed5121 /gdbserver/linux-mips-low.cc
parentaa8d21c9bb43baaa35f456a3d371942a26cdce4e (diff)
downloadfsf-binutils-gdb-daca57a7de50f97a4e8df917447561617a0298b2.zip
fsf-binutils-gdb-daca57a7de50f97a4e8df917447561617a0298b2.tar.gz
fsf-binutils-gdb-daca57a7de50f97a4e8df917447561617a0298b2.tar.bz2
gdbserver/linux-low: turn 'cannot_{fetch/store}_register' into methods
gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> Turn the 'cannot_fetch_register' and 'cannot_store_register' linux target ops into methods of linux_process_target. * linux-low.h (struct linux_target_ops): Remove the low target ops. (class linux_process_target) <fetch_register> <store_register> <usr_fetch_inferior_registers> <usr_store_inferior_registers> <low_cannot_fetch_register> <low_cannot_fetch_register> Declare. * linux-low.cc (fetch_register): Turn into... (linux_process_target::fetch_register): ...this. (store_register): Turn into ... (linux_process_target::store_register): ...this. (usr_fetch_inferior_registers): Turn into... (linux_process_target::usr_fetch_inferior_registers): ...this. (usr_store_inferior_registers): Turn into... (linux_process_target::usr_store_inferior_registers): ...this. * linux-x86-low.cc (class x86_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (x86_cannot_store_register): Turn into... (x86_target::low_cannot_store_register): ...this. (x86_cannot_fetch_register): Turn into... (x86_target::low_cannot_fetch_register): ...this. (the_low_target): Remove the target op fields. * linux-aarch64-low.cc (class aarch64_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (aarch64_target::low_cannot_fetch_register) (aarch64_target::low_cannot_store_register): Define. (the_low_target): Remove the op fields. * linux-arm-low.cc (class arm_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (arm_cannot_fetch_register): Turn into... (arm_target::low_cannot_fetch_register): ...this. (arm_cannot_store_register): Turn into... (arm_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-bfin-low.cc (class bfin_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (bfin_cannot_fetch_register): Turn into... (bfin_target::low_cannot_fetch_register): ...this. (bfin_cannot_store_register): Turn into... (bfin_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-cris-low.cc (class cris_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (cris_cannot_fetch_register): Turn into... (cris_target::low_cannot_fetch_register): ...this. (cris_cannot_store_register): Turn into... (cris_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-crisv32-low.cc (class crisv32_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (crisv32_target::low_cannot_fetch_register) (crisv32_target::low_cannot_store_register): Define. (the_low_target): Remove the op fields. * linux-ia64-low.cc (class ia64_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (ia64_cannot_fetch_register): Turn into... (ia64_target::low_cannot_fetch_register): ...this. (ia64_cannot_store_register): Turn into... (ia64_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-m32r-low.cc (class m32r_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (m32r_cannot_fetch_register): Turn into... (m32r_target::low_cannot_fetch_register): ...this. (m32r_cannot_store_register): Turn into... (m32r_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-m68k-low.cc (class m68k_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (m68k_cannot_fetch_register): Turn into... (m68k_target::low_cannot_fetch_register): ...this. (m68k_cannot_store_register): Turn into... (m68k_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-mips-low.cc (class mips_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (mips_cannot_fetch_register): Turn into... (mips_target::low_cannot_fetch_register): ...this. (mips_cannot_store_register): Turn into... (mips_target::low_cannot_store_register): ...this. (get_usrregs_info): Inline at the call sites in low_cannot_fetch_register and low_cannot_store_register, and remove. (the_low_target): Remove the op fields. * linux-nios2-low.cc (class nios2_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (nios2_cannot_fetch_register): Turn into... (nios2_target::low_cannot_fetch_register): ...this. (nios2_cannot_store_register): Turn into... (nios2_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-ppc-low.cc (class ppc_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (ppc_cannot_fetch_register): Turn into... (ppc_target::low_cannot_fetch_register): ...this. (ppc_cannot_store_register): Turn into... (ppc_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-riscv-low.cc (class riscv_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (riscv_target::low_cannot_fetch_register) (riscv_target::low_cannot_store_register): Define. (the_low_target): Remove the op fields. * linux-s390-low.cc (class s390_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (s390_cannot_fetch_register): Turn into... (s390_target::low_cannot_fetch_register): ...this. (s390_cannot_store_register): Turn into... (s390_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-sh-low.cc (class sh_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (sh_cannot_fetch_register): Turn into... (sh_target::low_cannot_fetch_register): ...this. (sh_cannot_store_register): Turn into... (sh_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-sparc-low.cc (class sparc_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (sparc_cannot_fetch_register): Turn into... (sparc_target::low_cannot_fetch_register): ...this. (sparc_cannot_store_register): Turn into... (sparc_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-tic6x-low.cc (class tic6x_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (tic6x_cannot_fetch_register): Turn into... (tic6x_target::low_cannot_fetch_register): ...this. (tic6x_cannot_store_register): Turn into... (tic6x_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-tile-low.cc (class tile_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (tile_cannot_fetch_register): Turn into... (tile_target::low_cannot_fetch_register): ...this. (tile_cannot_store_register): Turn into... (tile_target::low_cannot_store_register): ...this. (the_low_target): Remove the op fields. * linux-xtensa-low.cc (class xtensa_target) <low_cannot_fetch_register> <low_cannot_store_register>: Declare. (xtensa_target::low_cannot_fetch_register) (xtensa_target::low_cannot_store_register): Define. (the_low_target): Remove the op fields.
Diffstat (limited to 'gdbserver/linux-mips-low.cc')
-rw-r--r--gdbserver/linux-mips-low.cc48
1 files changed, 21 insertions, 27 deletions
diff --git a/gdbserver/linux-mips-low.cc b/gdbserver/linux-mips-low.cc
index 8231217..0900dc8 100644
--- a/gdbserver/linux-mips-low.cc
+++ b/gdbserver/linux-mips-low.cc
@@ -36,6 +36,10 @@ public:
protected:
void low_arch_setup () override;
+
+ bool low_cannot_fetch_register (int regno) override;
+
+ bool low_cannot_store_register (int regno) override;
};
/* The singleton target ops object. */
@@ -170,14 +174,6 @@ mips_target::low_arch_setup ()
current_process ()->tdesc = mips_read_description ();
}
-static struct usrregs_info *
-get_usrregs_info (void)
-{
- const struct regs_info *regs_info = the_linux_target->get_regs_info ();
-
- return regs_info->usrregs;
-}
-
/* Per-process arch-specific data we want to keep. */
struct arch_process_info
@@ -218,53 +214,53 @@ struct arch_lwp_info
ZERO_REGNUM, it's always 0. We also can not set BADVADDR, CAUSE,
or FCRIR via ptrace(). */
-static int
-mips_cannot_fetch_register (int regno)
+bool
+mips_target::low_cannot_fetch_register (int regno)
{
const struct target_desc *tdesc;
- if (get_usrregs_info ()->regmap[regno] == -1)
- return 1;
+ if (get_regs_info ()->usrregs->regmap[regno] == -1)
+ return true;
tdesc = current_process ()->tdesc;
/* On n32 we can't access 64-bit registers via PTRACE_PEEKUSR. */
if (register_size (tdesc, regno) > sizeof (PTRACE_XFER_TYPE))
- return 1;
+ return true;
if (find_regno (tdesc, "r0") == regno)
- return 1;
+ return true;
- return 0;
+ return false;
}
-static int
-mips_cannot_store_register (int regno)
+bool
+mips_target::low_cannot_store_register (int regno)
{
const struct target_desc *tdesc;
- if (get_usrregs_info ()->regmap[regno] == -1)
- return 1;
+ if (get_regs_info ()->usrregs->regmap[regno] == -1)
+ return true;
tdesc = current_process ()->tdesc;
/* On n32 we can't access 64-bit registers via PTRACE_POKEUSR. */
if (register_size (tdesc, regno) > sizeof (PTRACE_XFER_TYPE))
- return 1;
+ return true;
if (find_regno (tdesc, "r0") == regno)
- return 1;
+ return true;
if (find_regno (tdesc, "cause") == regno)
- return 1;
+ return true;
if (find_regno (tdesc, "badvaddr") == regno)
- return 1;
+ return true;
if (find_regno (tdesc, "fir") == regno)
- return 1;
+ return true;
- return 0;
+ return false;
}
static int
@@ -954,8 +950,6 @@ mips_target::get_regs_info ()
}
struct linux_target_ops the_low_target = {
- mips_cannot_fetch_register,
- mips_cannot_store_register,
mips_fetch_register,
mips_get_pc,
mips_set_pc,