forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
@@ -5418,10 +5418,10 @@ register_addr (const struct usrregs_info *usrregs, int regnum)
|
||||
return addr;
|
||||
}
|
||||
|
||||
/* Fetch one register. */
|
||||
static void
|
||||
fetch_register (const struct usrregs_info *usrregs,
|
||||
struct regcache *regcache, int regno)
|
||||
|
||||
void
|
||||
linux_process_target::fetch_register (const usrregs_info *usrregs,
|
||||
regcache *regcache, int regno)
|
||||
{
|
||||
CORE_ADDR regaddr;
|
||||
int i, size;
|
||||
@@ -5430,7 +5430,7 @@ fetch_register (const struct usrregs_info *usrregs,
|
||||
|
||||
if (regno >= usrregs->num_regs)
|
||||
return;
|
||||
if ((*the_low_target.cannot_fetch_register) (regno))
|
||||
if (low_cannot_fetch_register (regno))
|
||||
return;
|
||||
|
||||
regaddr = register_addr (usrregs, regno);
|
||||
@@ -5466,10 +5466,9 @@ fetch_register (const struct usrregs_info *usrregs,
|
||||
supply_register (regcache, regno, buf);
|
||||
}
|
||||
|
||||
/* Store one register. */
|
||||
static void
|
||||
store_register (const struct usrregs_info *usrregs,
|
||||
struct regcache *regcache, int regno)
|
||||
void
|
||||
linux_process_target::store_register (const usrregs_info *usrregs,
|
||||
regcache *regcache, int regno)
|
||||
{
|
||||
CORE_ADDR regaddr;
|
||||
int i, size;
|
||||
@@ -5478,7 +5477,7 @@ store_register (const struct usrregs_info *usrregs,
|
||||
|
||||
if (regno >= usrregs->num_regs)
|
||||
return;
|
||||
if ((*the_low_target.cannot_store_register) (regno))
|
||||
if (low_cannot_store_register (regno))
|
||||
return;
|
||||
|
||||
regaddr = register_addr (usrregs, regno);
|
||||
@@ -5514,22 +5513,21 @@ store_register (const struct usrregs_info *usrregs,
|
||||
if (errno == ESRCH)
|
||||
return;
|
||||
|
||||
if ((*the_low_target.cannot_store_register) (regno) == 0)
|
||||
|
||||
if (!low_cannot_store_register (regno))
|
||||
error ("writing register %d: %s", regno, safe_strerror (errno));
|
||||
}
|
||||
regaddr += sizeof (PTRACE_XFER_TYPE);
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_LINUX_USRREGS */
|
||||
|
||||
/* Fetch all registers, or just one, from the child process.
|
||||
If REGNO is -1, do this for all registers, skipping any that are
|
||||
assumed to have been retrieved by regsets_fetch_inferior_registers,
|
||||
unless ALL is non-zero.
|
||||
Otherwise, REGNO specifies which register (so we can save time). */
|
||||
static void
|
||||
usr_fetch_inferior_registers (const struct regs_info *regs_info,
|
||||
struct regcache *regcache, int regno, int all)
|
||||
void
|
||||
linux_process_target::usr_fetch_inferior_registers (const regs_info *regs_info,
|
||||
regcache *regcache,
|
||||
int regno, int all)
|
||||
{
|
||||
#ifdef HAVE_LINUX_USRREGS
|
||||
struct usrregs_info *usr = regs_info->usrregs;
|
||||
|
||||
if (regno == -1)
|
||||
@@ -5540,17 +5538,15 @@ usr_fetch_inferior_registers (const struct regs_info *regs_info,
|
||||
}
|
||||
else
|
||||
fetch_register (usr, regcache, regno);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Store our register values back into the inferior.
|
||||
If REGNO is -1, do this for all registers, skipping any that are
|
||||
assumed to have been saved by regsets_store_inferior_registers,
|
||||
unless ALL is non-zero.
|
||||
Otherwise, REGNO specifies which register (so we can save time). */
|
||||
static void
|
||||
usr_store_inferior_registers (const struct regs_info *regs_info,
|
||||
struct regcache *regcache, int regno, int all)
|
||||
void
|
||||
linux_process_target::usr_store_inferior_registers (const regs_info *regs_info,
|
||||
regcache *regcache,
|
||||
int regno, int all)
|
||||
{
|
||||
#ifdef HAVE_LINUX_USRREGS
|
||||
struct usrregs_info *usr = regs_info->usrregs;
|
||||
|
||||
if (regno == -1)
|
||||
@@ -5561,15 +5557,8 @@ usr_store_inferior_registers (const struct regs_info *regs_info,
|
||||
}
|
||||
else
|
||||
store_register (usr, regcache, regno);
|
||||
}
|
||||
|
||||
#else /* !HAVE_LINUX_USRREGS */
|
||||
|
||||
#define usr_fetch_inferior_registers(regs_info, regcache, regno, all) do {} while (0)
|
||||
#define usr_store_inferior_registers(regs_info, regcache, regno, all) do {} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
linux_process_target::fetch_registers (regcache *regcache, int regno)
|
||||
|
||||
Reference in New Issue
Block a user