+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.
+
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'regs_info' linux target op into a method of
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. */
static aarch64_target the_aarch64_target;
+bool
+aarch64_target::low_cannot_fetch_register (int regno)
+{
+ gdb_assert_not_reached ("linux target op low_cannot_fetch_register "
+ "is not implemented by the target");
+}
+
+bool
+aarch64_target::low_cannot_store_register (int regno)
+{
+ gdb_assert_not_reached ("linux target op low_cannot_store_register "
+ "is not implemented by the target");
+}
+
/* Per-process arch-specific data we want to keep. */
struct arch_process_info
struct linux_target_ops the_low_target =
{
- NULL, /* cannot_fetch_register */
- NULL, /* cannot_store_register */
NULL, /* fetch_register */
aarch64_get_pc,
aarch64_set_pc,
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. */
arm_linux_get_next_pcs_fixup,
};
-static int
-arm_cannot_store_register (int regno)
+bool
+arm_target::low_cannot_store_register (int regno)
{
return (regno >= arm_num_regs);
}
-static int
-arm_cannot_fetch_register (int regno)
+bool
+arm_target::low_cannot_fetch_register (int regno)
{
return (regno >= arm_num_regs);
}
}
struct linux_target_ops the_low_target = {
- arm_cannot_fetch_register,
- arm_cannot_store_register,
NULL, /* fetch_register */
linux_get_pc_32bit,
linux_set_pc_32bit,
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. */
#define bfin_num_regs ARRAY_SIZE (bfin_regmap)
-static int
-bfin_cannot_store_register (int regno)
+bool
+bfin_target::low_cannot_store_register (int regno)
{
return (regno >= bfin_num_regs);
}
-static int
-bfin_cannot_fetch_register (int regno)
+bool
+bfin_target::low_cannot_fetch_register (int regno)
{
return (regno >= bfin_num_regs);
}
}
struct linux_target_ops the_low_target = {
- bfin_cannot_fetch_register,
- bfin_cannot_store_register,
NULL, /* fetch_register */
linux_get_pc_32bit,
linux_set_pc_32bit,
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. */
};
-static int
-cris_cannot_store_register (int regno)
+bool
+cris_target::low_cannot_store_register (int regno)
{
if (cris_regmap[regno] == -1)
- return 1;
+ return true;
return (regno >= cris_num_regs);
}
-static int
-cris_cannot_fetch_register (int regno)
+bool
+cris_target::low_cannot_fetch_register (int regno)
{
if (cris_regmap[regno] == -1)
- return 1;
+ return true;
return (regno >= cris_num_regs);
}
}
struct linux_target_ops the_low_target = {
- cris_cannot_fetch_register,
- cris_cannot_store_register,
NULL, /* fetch_register */
linux_get_pc_32bit,
linux_set_pc_32bit,
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. */
static crisv32_target the_crisv32_target;
+bool
+crisv32_target::low_cannot_fetch_register (int regno)
+{
+ gdb_assert_not_reached ("linux target op low_cannot_fetch_register "
+ "is not implemented by the target");
+}
+
+bool
+crisv32_target::low_cannot_store_register (int regno)
+{
+ gdb_assert_not_reached ("linux target op low_cannot_store_register "
+ "is not implemented by the target");
+}
+
/* Defined in auto-generated file reg-crisv32.c. */
void init_registers_crisv32 (void);
extern const struct target_desc *tdesc_crisv32;
}
struct linux_target_ops the_low_target = {
- NULL,
- NULL,
NULL, /* fetch_register */
linux_get_pc_32bit,
linux_set_pc_32bit,
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. */
-1,
};
-static int
-ia64_cannot_store_register (int regno)
+bool
+ia64_target::low_cannot_store_register (int regno)
{
- return 0;
+ return false;
}
-static int
-ia64_cannot_fetch_register (int regno)
+bool
+ia64_target::low_cannot_fetch_register (int regno)
{
- return 0;
+ return false;
}
/* GDB register numbers. */
struct linux_target_ops the_low_target = {
- ia64_cannot_fetch_register,
- ia64_cannot_store_register,
ia64_fetch_register,
};
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;
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);
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;
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);
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)
}
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)
}
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)
struct linux_target_ops
{
- /* Return 0 if we can fetch/store the register, 1 if we cannot
- fetch/store the register. */
- int (*cannot_fetch_register) (int);
- int (*cannot_store_register) (int);
-
/* 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
/* Call low_arch_setup on THREAD. */
void arch_setup_thread (thread_info *thread);
+#ifdef HAVE_LINUX_USRREGS
+ /* Fetch one register. */
+ void fetch_register (const usrregs_info *usrregs, regcache *regcache,
+ int regno);
+
+ /* Store one register. */
+ void store_register (const usrregs_info *usrregs, regcache *regcache,
+ int regno);
+#endif
+
+ /* 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). */
+ void usr_fetch_inferior_registers (const regs_info *regs_info,
+ regcache *regcache, int regno, int all);
+
+ /* 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). */
+ void usr_store_inferior_registers (const regs_info *regs_info,
+ regcache *regcache, int regno, int all);
+
protected:
/* The architecture-specific "low" methods are listed below. */
/* Architecture-specific setup for the current thread. */
virtual void low_arch_setup () = 0;
+
+ /* Return false if we can fetch/store the register, true if we cannot
+ fetch/store the register. */
+ virtual bool low_cannot_fetch_register (int regno) = 0;
+
+ virtual bool low_cannot_store_register (int regno) = 0;
};
extern linux_process_target *the_linux_target;
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. */
#endif
};
-static int
-m32r_cannot_store_register (int regno)
+bool
+m32r_target::low_cannot_store_register (int regno)
{
return (regno >= m32r_num_regs);
}
-static int
-m32r_cannot_fetch_register (int regno)
+bool
+m32r_target::low_cannot_fetch_register (int regno)
{
return (regno >= m32r_num_regs);
}
}
struct linux_target_ops the_low_target = {
- m32r_cannot_fetch_register,
- m32r_cannot_store_register,
NULL, /* fetch_register */
linux_get_pc_32bit,
linux_set_pc_32bit,
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. */
#endif
};
-static int
-m68k_cannot_store_register (int regno)
+bool
+m68k_target::low_cannot_store_register (int regno)
{
return (regno >= m68k_num_regs);
}
-static int
-m68k_cannot_fetch_register (int regno)
+bool
+m68k_target::low_cannot_fetch_register (int regno)
{
return (regno >= m68k_num_regs);
}
}
struct linux_target_ops the_low_target = {
- m68k_cannot_fetch_register,
- m68k_cannot_store_register,
NULL, /* fetch_register */
linux_get_pc_32bit,
linux_set_pc_32bit,
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. */
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
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
}
struct linux_target_ops the_low_target = {
- mips_cannot_fetch_register,
- mips_cannot_store_register,
mips_fetch_register,
mips_get_pc,
mips_set_pc,
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. */
current_process ()->tdesc = tdesc_nios2_linux;
}
-/* Implement the cannot_fetch_register linux_target_ops method. */
+/* Implement the low_cannot_fetch_register linux target ops method. */
-static int
-nios2_cannot_fetch_register (int regno)
+bool
+nios2_target::low_cannot_fetch_register (int regno)
{
- if (nios2_regmap[regno] == -1)
- return 1;
-
- return 0;
+ return (nios2_regmap[regno] == -1);
}
-/* Implement the cannot_store_register linux_target_ops method. */
+/* Implement the low_cannot_store_register linux target ops method. */
-static int
-nios2_cannot_store_register (int regno)
+bool
+nios2_target::low_cannot_store_register (int regno)
{
- if (nios2_regmap[regno] == -1)
- return 1;
-
- return 0;
+ return (nios2_regmap[regno] == -1);
}
/* Breakpoint support. Also see comments on nios2_breakpoint_from_pc
struct linux_target_ops the_low_target =
{
- nios2_cannot_fetch_register,
- nios2_cannot_store_register,
NULL,
linux_get_pc_32bit,
linux_set_pc_32bit,
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. */
return 0;
}
-static int
-ppc_cannot_store_register (int regno)
+bool
+ppc_target::low_cannot_store_register (int regno)
{
const struct target_desc *tdesc = current_process ()->tdesc;
/* Some kernels do not allow us to store fpscr. */
if (!(ppc_hwcap & PPC_FEATURE_HAS_SPE)
&& regno == find_regno (tdesc, "fpscr"))
- return 1;
+ return true;
#endif
/* Some kernels do not allow us to store orig_r3 or trap. */
if (regno == find_regno (tdesc, "orig_r3")
|| regno == find_regno (tdesc, "trap"))
- return 1;
+ return true;
- return 0;
+ return false;
}
-static int
-ppc_cannot_fetch_register (int regno)
+bool
+ppc_target::low_cannot_fetch_register (int regno)
{
- return 0;
+ return false;
}
static void
}
struct linux_target_ops the_low_target = {
- ppc_cannot_fetch_register,
- ppc_cannot_store_register,
NULL, /* fetch_register */
ppc_get_pc,
ppc_set_pc,
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. */
static riscv_target the_riscv_target;
+bool
+riscv_target::low_cannot_fetch_register (int regno)
+{
+ gdb_assert_not_reached ("linux target op low_cannot_fetch_register "
+ "is not implemented by the target");
+}
+
+bool
+riscv_target::low_cannot_store_register (int regno)
+{
+ gdb_assert_not_reached ("linux target op low_cannot_store_register "
+ "is not implemented by the target");
+}
+
/* Implementation of linux target ops method "low_arch_setup". */
void
/* RISC-V/Linux target operations. */
struct linux_target_ops the_low_target =
{
- NULL, /* cannot_fetch_register */
- NULL, /* cannot_store_register */
riscv_fetch_register,
riscv_get_pc,
riscv_set_pc,
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. */
#endif
-static int
-s390_cannot_fetch_register (int regno)
+bool
+s390_target::low_cannot_fetch_register (int regno)
{
- return 0;
+ return false;
}
-static int
-s390_cannot_store_register (int regno)
+bool
+s390_target::low_cannot_store_register (int regno)
{
- return 0;
+ return false;
}
static void
}
struct linux_target_ops the_low_target = {
- s390_cannot_fetch_register,
- s390_cannot_store_register,
NULL, /* fetch_register */
s390_get_pc,
s390_set_pc,
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. */
REG_FPREG0*4+48, REG_FPREG0*4+52, REG_FPREG0*4+56, REG_FPREG0*4+60,
};
-static int
-sh_cannot_store_register (int regno)
+bool
+sh_target::low_cannot_store_register (int regno)
{
- return 0;
+ return false;
}
-static int
-sh_cannot_fetch_register (int regno)
+bool
+sh_target::low_cannot_fetch_register (int regno)
{
- return 0;
+ return false;
}
/* Correct in either endianness, obviously. */
}
struct linux_target_ops the_low_target = {
- sh_cannot_fetch_register,
- sh_cannot_store_register,
NULL, /* fetch_register */
linux_get_pc_32bit,
linux_set_pc_32bit,
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. */
void init_registers_sparc64 (void);
extern const struct target_desc *tdesc_sparc64;
-static int
-sparc_cannot_store_register (int regno)
+bool
+sparc_target::low_cannot_store_register (int regno)
{
return (regno >= sparc_num_regs || sparc_regmap[regno] == -1);
}
-static int
-sparc_cannot_fetch_register (int regno)
+bool
+sparc_target::low_cannot_fetch_register (int regno)
{
return (regno >= sparc_num_regs || sparc_regmap[regno] == -1);
}
}
struct linux_target_ops the_low_target = {
- sparc_cannot_fetch_register,
- sparc_cannot_store_register,
NULL, /* fetch_register */
linux_get_pc_64bit,
/* No sparc_set_pc is needed. */
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. */
return *tdesc;
}
-static int
-tic6x_cannot_fetch_register (int regno)
+bool
+tic6x_target::low_cannot_fetch_register (int regno)
{
return (tic6x_regmap[regno] == -1);
}
-static int
-tic6x_cannot_store_register (int regno)
+bool
+tic6x_target::low_cannot_store_register (int regno)
{
return (tic6x_regmap[regno] == -1);
}
}
struct linux_target_ops the_low_target = {
- tic6x_cannot_fetch_register,
- tic6x_cannot_store_register,
NULL, /* fetch_register */
tic6x_get_pc,
tic6x_set_pc,
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. */
56
};
-static int
-tile_cannot_fetch_register (int regno)
+bool
+tile_target::low_cannot_fetch_register (int regno)
{
if (regno >= 0 && regno < 56)
- return 0;
+ return false;
else if (regno == 64)
- return 0;
+ return false;
else
- return 1;
+ return true;
}
-static int
-tile_cannot_store_register (int regno)
+bool
+tile_target::low_cannot_store_register (int regno)
{
if (regno >= 0 && regno < 56)
- return 0;
+ return false;
else if (regno == 64)
- return 0;
+ return false;
else
- return 1;
+ return true;
}
static uint64_t tile_breakpoint = 0x400b3cae70166000ULL;
struct linux_target_ops the_low_target =
{
- tile_cannot_fetch_register,
- tile_cannot_store_register,
NULL,
linux_get_pc_64bit,
linux_set_pc_64bit,
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. */
\f
-static int
-x86_cannot_store_register (int regno)
+bool
+x86_target::low_cannot_store_register (int regno)
{
#ifdef __x86_64__
if (is_64bit_tdesc ())
- return 0;
+ return false;
#endif
return regno >= I386_NUM_REGS;
}
-static int
-x86_cannot_fetch_register (int regno)
+bool
+x86_target::low_cannot_fetch_register (int regno)
{
#ifdef __x86_64__
if (is_64bit_tdesc ())
- return 0;
+ return false;
#endif
return regno >= I386_NUM_REGS;
struct linux_target_ops the_low_target =
{
- x86_cannot_fetch_register,
- x86_cannot_store_register,
NULL, /* fetch_register */
x86_get_pc,
x86_set_pc,
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. */
static xtensa_target the_xtensa_target;
+bool
+xtensa_target::low_cannot_fetch_register (int regno)
+{
+ gdb_assert_not_reached ("linux target op low_cannot_fetch_register "
+ "is not implemented by the target");
+}
+
+bool
+xtensa_target::low_cannot_store_register (int regno)
+{
+ gdb_assert_not_reached ("linux target op low_cannot_store_register "
+ "is not implemented by the target");
+}
+
/* Defined in auto-generated file reg-xtensa.c. */
void init_registers_xtensa (void);
extern const struct target_desc *tdesc_xtensa;
}
struct linux_target_ops the_low_target = {
- 0,
- 0,
NULL, /* fetch_register */
linux_get_pc_32bit,
linux_set_pc_32bit,