+2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
+
+ Turn the 'fetch_register' linux target op into a method of
+ linux_process_target.
+
+ * linux-low.h (struct linux_target_ops) <fetch_register>: Remove.
+ (class linux_process_target) <low_fetch_register>: Declare.
+ * linux-x86-low.cc (the_low_target)
+ * linux-aarch64-low.cc (the_low_target)
+ * linux-arm-low.cc (the_low_target)
+ * linux-bfin-low.cc (the_low_target)
+ * linux-cris-low.cc (the_low_target)
+ * linux-crisv32-low.cc (the_low_target)
+ * linux-m32r-low.cc (the_low_target)
+ * linux-m68k-low.cc (the_low_target)
+ * linux-nios2-low.cc (the_low_target)
+ * linux-ppc-low.cc (the_low_target)
+ * linux-s390-low.cc (the_low_target)
+ * linux-sh-low.cc (the_low_target)
+ * linux-sparc-low.cc (the_low_target)
+ * linux-tic6x-low.cc (the_low_target)
+ * linux-tile-low.cc (the_low_target)
+ * linux-xtensa-low.cc (the_low_target): Remove the op field.
+ * linux-ia64-low.cc (class ia64_target) <low_fetch_register>:
+ Declare.
+ (ia64_fetch_register): Turn into...
+ (ia64_target::low_fetch_register): ...this.
+ (the_low_target): Remove the op field.
+ * linux-mips-low.cc (class mips_target) <low_fetch_register>:
+ Declare.
+ (mips_fetch_register): Turn into...
+ (mips_target::low_fetch_register): ...this.
+ (the_low_target): Remove the op field.
+ * linux-riscv-low.cc (class riscv_target) <low_fetch_register>:
+ Declare.
+ (riscv_fetch_register): Turn into...
+ (riscv_target::low_fetch_register): ...this.
+ (the_low_target): Remove the op field.
+
+ Update the callers below.
+
+ * linux-low.cc (linux_process_target::fetch_registers)
+ (linux_process_target::low_fetch_register)
+
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'cannot_fetch_register' and 'cannot_store_register'
struct linux_target_ops the_low_target =
{
- NULL, /* fetch_register */
aarch64_get_pc,
aarch64_set_pc,
aarch64_breakpoint_kind_from_pc,
}
struct linux_target_ops the_low_target = {
- NULL, /* fetch_register */
linux_get_pc_32bit,
linux_set_pc_32bit,
arm_breakpoint_kind_from_pc,
}
struct linux_target_ops the_low_target = {
- NULL, /* fetch_register */
linux_get_pc_32bit,
linux_set_pc_32bit,
NULL, /* breakpoint_kind_from_pc */
}
struct linux_target_ops the_low_target = {
- NULL, /* fetch_register */
linux_get_pc_32bit,
linux_set_pc_32bit,
NULL, /* breakpoint_kind_from_pc */
}
struct linux_target_ops the_low_target = {
- NULL, /* fetch_register */
linux_get_pc_32bit,
linux_set_pc_32bit,
NULL, /* breakpoint_kind_from_pc */
bool low_cannot_fetch_register (int regno) override;
bool low_cannot_store_register (int regno) override;
+
+ bool low_fetch_register (regcache *regcache, int regno) override;
};
/* The singleton target ops object. */
#define IA64_FR0_REGNUM 128
#define IA64_FR1_REGNUM 129
-static int
-ia64_fetch_register (struct regcache *regcache, int regnum)
+bool
+ia64_target::low_fetch_register (regcache *regcache, int regnum)
{
/* r0 cannot be fetched but is always zero. */
if (regnum == IA64_GR0_REGNUM)
gdb_assert (sizeof (zero) == register_size (regcache->tdesc, regnum));
supply_register (regcache, regnum, zero);
- return 1;
+ return true;
}
/* fr0 cannot be fetched but is always zero. */
gdb_assert (sizeof (f_zero) == register_size (regcache->tdesc, regnum));
supply_register (regcache, regnum, f_zero);
- return 1;
+ return true;
}
/* fr1 cannot be fetched but is always one (1.0). */
gdb_assert (sizeof (f_one) == register_size (regcache->tdesc, regnum));
supply_register (regcache, regnum, f_one);
- return 1;
+ return true;
}
- return 0;
+ return false;
}
static struct usrregs_info ia64_usrregs_info =
struct linux_target_ops the_low_target = {
- ia64_fetch_register,
};
/* The linux target ops object. */
if (regno == -1)
{
- if (the_low_target.fetch_register != NULL
- && regs_info->usrregs != NULL)
+ if (regs_info->usrregs != NULL)
for (regno = 0; regno < regs_info->usrregs->num_regs; regno++)
- (*the_low_target.fetch_register) (regcache, regno);
+ low_fetch_register (regcache, regno);
all = regsets_fetch_inferior_registers (regs_info->regsets_info, regcache);
if (regs_info->usrregs != NULL)
}
else
{
- if (the_low_target.fetch_register != NULL
- && (*the_low_target.fetch_register) (regcache, regno))
+ if (low_fetch_register (regcache, regno))
return;
use_regsets = linux_register_in_regsets (regs_info, regno);
}
}
+bool
+linux_process_target::low_fetch_register (regcache *regcache, int regno)
+{
+ return false;
+}
/* A wrapper for the read_memory target op. */
struct linux_target_ops
{
- /* Hook to fetch a register in some non-standard way. Used for
- example by backends that have read-only registers with hardcoded
- values (e.g., IA64's gr0/fr0/fr1). Returns true if register
- REGNO was supplied, false if not, and we should fallback to the
- standard ptrace methods. */
- int (*fetch_register) (struct regcache *regcache, int regno);
-
CORE_ADDR (*get_pc) (struct regcache *regcache);
void (*set_pc) (struct regcache *regcache, CORE_ADDR newpc);
virtual bool low_cannot_fetch_register (int regno) = 0;
virtual bool low_cannot_store_register (int regno) = 0;
+
+ /* Hook to fetch a register in some non-standard way. Used for
+ example by backends that have read-only registers with hardcoded
+ values (e.g., IA64's gr0/fr0/fr1). Returns true if register
+ REGNO was supplied, false if not, and we should fallback to the
+ standard ptrace methods. */
+ virtual bool low_fetch_register (regcache *regcache, int regno);
};
extern linux_process_target *the_linux_target;
}
struct linux_target_ops the_low_target = {
- NULL, /* fetch_register */
linux_get_pc_32bit,
linux_set_pc_32bit,
NULL, /* breakpoint_from_pc */
}
struct linux_target_ops the_low_target = {
- NULL, /* fetch_register */
linux_get_pc_32bit,
linux_set_pc_32bit,
NULL, /* breakpoint_kind_from_pc */
bool low_cannot_fetch_register (int regno) override;
bool low_cannot_store_register (int regno) override;
+
+ bool low_fetch_register (regcache *regcache, int regno) override;
};
/* The singleton target ops object. */
return false;
}
-static int
-mips_fetch_register (struct regcache *regcache, int regno)
+bool
+mips_target::low_fetch_register (regcache *regcache, int regno)
{
const struct target_desc *tdesc = current_process ()->tdesc;
if (find_regno (tdesc, "r0") == regno)
{
supply_register_zeroed (regcache, regno);
- return 1;
+ return true;
}
- return 0;
+ return false;
}
static CORE_ADDR
}
struct linux_target_ops the_low_target = {
- mips_fetch_register,
mips_get_pc,
mips_set_pc,
NULL, /* breakpoint_kind_from_pc */
struct linux_target_ops the_low_target =
{
- NULL,
linux_get_pc_32bit,
linux_set_pc_32bit,
NULL, /* breakpoint_kind_from_pc */
}
struct linux_target_ops the_low_target = {
- NULL, /* fetch_register */
ppc_get_pc,
ppc_set_pc,
NULL, /* breakpoint_kind_from_pc */
bool low_cannot_fetch_register (int regno) override;
bool low_cannot_store_register (int regno) override;
+
+ bool low_fetch_register (regcache *regcache, int regno) override;
};
/* The singleton target ops object. */
return &riscv_regs;
}
-/* Implementation of linux_target_ops method "fetch_register". */
+/* Implementation of linux target ops method "low_fetch_register". */
-static int
-riscv_fetch_register (struct regcache *regcache, int regno)
+bool
+riscv_target::low_fetch_register (regcache *regcache, int regno)
{
const struct target_desc *tdesc = regcache->tdesc;
if (regno != find_regno (tdesc, "zero"))
- return 0;
+ return false;
supply_register_zeroed (regcache, regno);
- return 1;
+ return true;
}
/* Implementation of linux_target_ops method "get_pc". */
/* RISC-V/Linux target operations. */
struct linux_target_ops the_low_target =
{
- riscv_fetch_register,
riscv_get_pc,
riscv_set_pc,
riscv_breakpoint_kind_from_pc,
}
struct linux_target_ops the_low_target = {
- NULL, /* fetch_register */
s390_get_pc,
s390_set_pc,
NULL, /* breakpoint_kind_from_pc */
}
struct linux_target_ops the_low_target = {
- NULL, /* fetch_register */
linux_get_pc_32bit,
linux_set_pc_32bit,
NULL, /* breakpoint_kind_from_pc */
}
struct linux_target_ops the_low_target = {
- NULL, /* fetch_register */
linux_get_pc_64bit,
/* No sparc_set_pc is needed. */
NULL,
}
struct linux_target_ops the_low_target = {
- NULL, /* fetch_register */
tic6x_get_pc,
tic6x_set_pc,
NULL, /* breakpoint_kind_from_pc */
struct linux_target_ops the_low_target =
{
- NULL,
linux_get_pc_64bit,
linux_set_pc_64bit,
NULL, /* breakpoint_kind_from_pc */
struct linux_target_ops the_low_target =
{
- NULL, /* fetch_register */
x86_get_pc,
x86_set_pc,
NULL, /* breakpoint_kind_from_pc */
}
struct linux_target_ops the_low_target = {
- NULL, /* fetch_register */
linux_get_pc_32bit,
linux_set_pc_32bit,
NULL, /* breakpoint_kind_from_pc */