+2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
+
+ Turn the 'regs_info' linux target op into a method of
+ linux_process_target.
+
+ * linux-low.h (struct linux_target_ops) <regs_info>: Remove.
+ (class linux_process_target) <get_regs_info>: Define.
+
+ Update the callers below.
+
+ * linux-low.cc (linux_process_target::fetch_registers)
+ (linux_process_target::store_registers)
+ * proc-service.cc (gregset_info)
+
+ * linux-x86-low.cc (class x86_target) <get_regs_info>: Declare.
+ (x86_linux_regs_info): Turn into ...
+ (x86_target::get_regs_info): ...this.
+ (the_low_target): Remove the op field.
+ * linux-aarch64-low.cc (class aarch64_target) <get_regs_info>:
+ Declare.
+ (aarch64_regs_info): Turn into ...
+ (aarch64_target::get_regs_info): ...this.
+ (the_low_target): Remove the op field.
+ * linux-arm-low.cc (class arm_target) <get_regs_info>: Declare.
+ (arm_regs_info): Turn into ...
+ (arm_target::get_regs_info): ...this.
+ (the_low_target): Remove the op field.
+ * linux-bfin-low.cc (class bfin_target) <get_regs_info>: Declare.
+ (bfin_regs_info): Turn into ...
+ (bfin_target::get_regs_info): ...this.
+ (the_low_target): Remove the op field.
+ * linux-cris-low.cc (class cris_target) <get_regs_info>: Declare.
+ (cris_regs_info): Turn into ...
+ (cris_target::get_regs_info): ...this.
+ (the_low_target): Remove the op field.
+ * linux-crisv32-low.cc (class crisv32_target) <get_regs_info>:
+ Declare.
+ (crisv32_regs_info): Turn into ...
+ (crisv32_target::get_regs_info): ...this.
+ (the_low_target): Remove the op field.
+ * linux-ia64-low.cc (class ia64_target) <get_regs_info>: Declare.
+ (ia64_regs_info): Turn into ...
+ (ia64_target::get_regs_info): ...this.
+ (the_low_target): Remove the op field.
+ * linux-m32r-low.cc (class m32r_target) <get_regs_info>: Declare.
+ (m32r_regs_info): Turn into ...
+ (m32r_target::get_regs_info): ...this.
+ (the_low_target): Remove the op field.
+ * linux-m68k-low.cc (class m68k_target) <get_regs_info>: Declare.
+ (m68k_regs_info): Turn into ...
+ (m68k_target::get_regs_info): ...this.
+ (the_low_target): Remove the op field.
+ * linux-mips-low.cc (class mips_target) <get_regs_info>: Declare.
+ (mips_regs_info): Turn into ...
+ (mips_target::get_regs_info): ...this.
+ (the_low_target): Remove the op field.
+ (get_usrregs_info): Update the call to the op.
+ * linux-nios2-low.cc (class nios2_target) <get_regs_info>: Declare.
+ (nios2_regs_info): Turn into ...
+ (nios2_target::get_regs_info): ...this.
+ (the_low_target): Remove the op field.
+ * linux-ppc-low.cc (class ppc_target) <get_regs_info>: Declare.
+ (ppc_regs_info): Turn into ...
+ (ppc_target::get_regs_info): ...this.
+ (the_low_target): Remove the op field.
+ * linux-riscv-low.cc (class riscv_target) <get_regs_info>: Declare.
+ (riscv_regs_info): Turn into ...
+ (riscv_target::get_regs_info): ...this.
+ (the_low_target): Remove the op field.
+ * linux-s390-low.cc (class s390_target) <get_regs_info>: Declare.
+ (s390_regs_info): Turn into ...
+ (s390_target::get_regs_info): ...this.
+ (the_low_target): Remove the op field.
+ (s390_collect_ptrace_register)
+ (s390_supply_ptrace_register)
+ (s390_fill_gregset): Update the call to the op.
+ * linux-sh-low.cc (class sh_target) <get_regs_info>: Declare.
+ (sh_regs_info): Turn into ...
+ (sh_target::get_regs_info): ...this.
+ (the_low_target): Remove the op field.
+ * linux-sparc-low.cc (class sparc_target) <get_regs_info>: Declare.
+ (sparc_regs_info): Turn into ...
+ (sparc_target::get_regs_info): ...this.
+ (the_low_target): Remove the op field.
+ * linux-tic6x-low.cc (class tic6x_target) <get_regs_info>: Declare.
+ (tic6x_regs_info): Turn into ...
+ (tic6x_target::get_regs_info): ...this.
+ (the_low_target): Remove the op field.
+ * linux-tile-low.cc (class tile_target) <get_regs_info>: Declare.
+ (tile_regs_info): Turn into ...
+ (tile_target::get_regs_info): ...this.
+ (the_low_target): Remove the op field.
+ * linux-xtensa-low.cc (class xtensa_target) <get_regs_info>:
+ Declare.
+ (xtensa_regs_info): Turn into ...
+ (xtensa_target::get_regs_info): ...this.
+ (the_low_target): Remove the op field.
+
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'arch_setup' linux target op into a method of
{
public:
+ const regs_info *get_regs_info () override;
+
protected:
void low_arch_setup () override;
&aarch64_sve_regsets_info,
};
-/* Implementation of linux_target_ops method "regs_info". */
+/* Implementation of linux target ops method "get_regs_info". */
-static const struct regs_info *
-aarch64_regs_info (void)
+const regs_info *
+aarch64_target::get_regs_info ()
{
if (!is_64bit_tdesc ())
return ®s_info_aarch32;
struct linux_target_ops the_low_target =
{
- aarch64_regs_info,
NULL, /* cannot_fetch_register */
NULL, /* cannot_store_register */
NULL, /* fetch_register */
{
public:
+ const regs_info *get_regs_info () override;
+
protected:
void low_arch_setup () override;
&arm_regsets_info
};
-static const struct regs_info *
-arm_regs_info (void)
+const regs_info *
+arm_target::get_regs_info ()
{
const struct target_desc *tdesc = current_process ()->tdesc;
}
struct linux_target_ops the_low_target = {
- arm_regs_info,
arm_cannot_fetch_register,
arm_cannot_store_register,
NULL, /* fetch_register */
{
public:
+ const regs_info *get_regs_info () override;
+
protected:
void low_arch_setup () override;
bfin_regmap,
};
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
{
NULL, /* regset_bitmap */
&bfin_usrregs_info,
};
-static const struct regs_info *
-bfin_regs_info (void)
+const regs_info *
+bfin_target::get_regs_info ()
{
- return ®s_info;
+ return &myregs_info;
}
struct linux_target_ops the_low_target = {
- bfin_regs_info,
bfin_cannot_fetch_register,
bfin_cannot_store_register,
NULL, /* fetch_register */
{
public:
+ const regs_info *get_regs_info () override;
+
protected:
void low_arch_setup () override;
cris_regmap,
};
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
{
NULL, /* regset_bitmap */
&cris_usrregs_info,
};
-static const struct regs_info *
-cris_regs_info (void)
+const regs_info *
+cris_target::get_regs_info ()
{
- return ®s_info;
+ return &myregs_info;
}
struct linux_target_ops the_low_target = {
- cris_regs_info,
cris_cannot_fetch_register,
cris_cannot_store_register,
NULL, /* fetch_register */
{
public:
+ const regs_info *get_regs_info () override;
+
protected:
void low_arch_setup () override;
cris_regmap,
};
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
{
NULL, /* regset_bitmap */
&cris_usrregs_info,
&cris_regsets_info
};
-static const struct regs_info *
-cris_regs_info (void)
+const regs_info *
+crisv32_target::get_regs_info ()
{
- return ®s_info;
+ return &myregs_info;
}
struct linux_target_ops the_low_target = {
- cris_regs_info,
NULL,
NULL,
NULL, /* fetch_register */
{
public:
+ const regs_info *get_regs_info () override;
+
protected:
void low_arch_setup () override;
ia64_regmap,
};
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
{
NULL, /* regset_bitmap */
&ia64_usrregs_info
};
-static const struct regs_info *
-ia64_regs_info (void)
+const regs_info *
+ia64_target::get_regs_info ()
{
- return ®s_info;
+ return &myregs_info;
}
void
struct linux_target_ops the_low_target = {
- ia64_regs_info,
ia64_cannot_fetch_register,
ia64_cannot_store_register,
ia64_fetch_register,
{
int use_regsets;
int all = 0;
- const struct regs_info *regs_info = (*the_low_target.regs_info) ();
+ const regs_info *regs_info = get_regs_info ();
if (regno == -1)
{
{
int use_regsets;
int all = 0;
- const struct regs_info *regs_info = (*the_low_target.regs_info) ();
+ const regs_info *regs_info = get_regs_info ();
if (regno == -1)
{
struct linux_target_ops
{
- const struct regs_info *(*regs_info) (void);
-
/* Return 0 if we can fetch/store the register, 1 if we cannot
fetch/store the register. */
int (*cannot_fetch_register) (int);
int get_ipa_tdesc_idx () override;
+ /* Return the information to access registers. This has public
+ visibility because proc-service uses it. */
+ virtual const regs_info *get_regs_info () = 0;
+
private:
/* Handle a GNU/Linux extended wait response. If we see a clone,
{
public:
+ const regs_info *get_regs_info () override;
+
protected:
void low_arch_setup () override;
m32r_regmap,
};
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
{
NULL, /* regset_bitmap */
&m32r_usrregs_info,
};
-static const struct regs_info *
-m32r_regs_info (void)
+const regs_info *
+m32r_target::get_regs_info ()
{
- return ®s_info;
+ return &myregs_info;
}
struct linux_target_ops the_low_target = {
- m32r_regs_info,
m32r_cannot_fetch_register,
m32r_cannot_store_register,
NULL, /* fetch_register */
{
public:
+ const regs_info *get_regs_info () override;
+
protected:
void low_arch_setup () override;
m68k_regmap,
};
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
{
NULL, /* regset_bitmap */
&m68k_usrregs_info,
&m68k_regsets_info
};
-static const struct regs_info *
-m68k_regs_info (void)
+const regs_info *
+m68k_target::get_regs_info ()
{
- return ®s_info;
+ return &myregs_info;
}
void
}
struct linux_target_ops the_low_target = {
- m68k_regs_info,
m68k_cannot_fetch_register,
m68k_cannot_store_register,
NULL, /* fetch_register */
{
public:
+ const regs_info *get_regs_info () override;
+
protected:
void low_arch_setup () override;
static struct usrregs_info *
get_usrregs_info (void)
{
- const struct regs_info *regs_info = the_low_target.regs_info ();
+ const struct regs_info *regs_info = the_linux_target->get_regs_info ();
return regs_info->usrregs;
}
&mips_regsets_info
};
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
{
NULL, /* regset_bitmap */
&mips_usrregs_info,
&mips_regsets_info
};
-static const struct regs_info *
-mips_regs_info (void)
+const regs_info *
+mips_target::get_regs_info ()
{
if (have_dsp)
return &dsp_regs_info;
else
- return ®s_info;
+ return &myregs_info;
}
struct linux_target_ops the_low_target = {
- mips_regs_info,
mips_cannot_fetch_register,
mips_cannot_store_register,
mips_fetch_register,
{
public:
+ const regs_info *get_regs_info () override;
+
protected:
void low_arch_setup () override;
nios2_regmap,
};
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
{
NULL, /* regset_bitmap */
&nios2_usrregs_info,
&nios2_regsets_info
};
-static const struct regs_info *
-nios2_regs_info (void)
+const regs_info *
+nios2_target::get_regs_info ()
{
- return ®s_info;
+ return &myregs_info;
}
struct linux_target_ops the_low_target =
{
- nios2_regs_info,
nios2_cannot_fetch_register,
nios2_cannot_store_register,
NULL,
{
public:
+ const regs_info *get_regs_info () override;
+
protected:
void low_arch_setup () override;
NULL, /* disabled_regsets */
};
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
{
NULL, /* regset_bitmap */
&ppc_usrregs_info,
&ppc_regsets_info
};
-static const struct regs_info *
-ppc_regs_info (void)
+const regs_info *
+ppc_target::get_regs_info ()
{
- return ®s_info;
+ return &myregs_info;
}
void
}
struct linux_target_ops the_low_target = {
- ppc_regs_info,
ppc_cannot_fetch_register,
ppc_cannot_store_register,
NULL, /* fetch_register */
{
public:
+ const regs_info *get_regs_info () override;
+
protected:
void low_arch_setup () override;
&riscv_regsets_info,
};
-/* Implementation of linux_target_ops method "regs_info". */
+/* Implementation of linux target ops method "get_regs_info". */
-static const struct regs_info *
-riscv_regs_info ()
+const regs_info *
+riscv_target::get_regs_info ()
{
return &riscv_regs;
}
/* RISC-V/Linux target operations. */
struct linux_target_ops the_low_target =
{
- riscv_regs_info,
NULL, /* cannot_fetch_register */
NULL, /* cannot_store_register */
riscv_fetch_register,
{
public:
+ const regs_info *get_regs_info () override;
+
protected:
void low_arch_setup () override;
s390_collect_ptrace_register (struct regcache *regcache, int regno, char *buf)
{
int size = register_size (regcache->tdesc, regno);
- const struct regs_info *regs_info = (*the_low_target.regs_info) ();
+ const struct regs_info *regs_info = the_linux_target->get_regs_info ();
struct usrregs_info *usr = regs_info->usrregs;
int regaddr = usr->regmap[regno];
int regno, const char *buf)
{
int size = register_size (regcache->tdesc, regno);
- const struct regs_info *regs_info = (*the_low_target.regs_info) ();
+ const struct regs_info *regs_info = the_linux_target->get_regs_info ();
struct usrregs_info *usr = regs_info->usrregs;
int regaddr = usr->regmap[regno];
s390_fill_gregset (struct regcache *regcache, void *buf)
{
int i;
- const struct regs_info *regs_info = (*the_low_target.regs_info) ();
+ const struct regs_info *regs_info = the_linux_target->get_regs_info ();
struct usrregs_info *usr = regs_info->usrregs;
for (i = 0; i < usr->num_regs; i++)
NULL, /* disabled_regsets */
};
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
{
NULL, /* regset_bitmap */
&s390_usrregs_info,
&s390_regsets_info_3264
};
-static const struct regs_info *
-s390_regs_info (void)
+const regs_info *
+s390_target::get_regs_info ()
{
if (have_hwcap_s390_high_gprs)
{
return ®s_info_3264;
#endif
}
- return ®s_info;
+ return &myregs_info;
}
/* The "supports_tracepoints" linux_target_ops method. */
}
struct linux_target_ops the_low_target = {
- s390_regs_info,
s390_cannot_fetch_register,
s390_cannot_store_register,
NULL, /* fetch_register */
{
public:
+ const regs_info *get_regs_info () override;
+
protected:
void low_arch_setup () override;
sh_regmap,
};
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
{
NULL, /* regset_bitmap */
&sh_usrregs_info,
&sh_regsets_info
};
-static const struct regs_info *
-sh_regs_info (void)
+const regs_info *
+sh_target::get_regs_info ()
{
- return ®s_info;
+ return &myregs_info;
}
void
}
struct linux_target_ops the_low_target = {
- sh_regs_info,
sh_cannot_fetch_register,
sh_cannot_store_register,
NULL, /* fetch_register */
{
public:
+ const regs_info *get_regs_info () override;
+
protected:
void low_arch_setup () override;
NULL
};
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
{
NULL, /* regset_bitmap */
&sparc_usrregs_info,
&sparc_regsets_info
};
-static const struct regs_info *
-sparc_regs_info (void)
+const regs_info *
+sparc_target::get_regs_info ()
{
- return ®s_info;
+ return &myregs_info;
}
struct linux_target_ops the_low_target = {
- sparc_regs_info,
sparc_cannot_fetch_register,
sparc_cannot_store_register,
NULL, /* fetch_register */
{
public:
+ const regs_info *get_regs_info () override;
+
protected:
void low_arch_setup () override;
NULL, /* disabled_regsets */
};
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
{
NULL, /* regset_bitmap */
&tic6x_usrregs_info,
&tic6x_regsets_info
};
-static const struct regs_info *
-tic6x_regs_info (void)
+const regs_info *
+tic6x_target::get_regs_info ()
{
- return ®s_info;
+ return &myregs_info;
}
struct linux_target_ops the_low_target = {
- tic6x_regs_info,
tic6x_cannot_fetch_register,
tic6x_cannot_store_register,
NULL, /* fetch_register */
{
public:
+ const regs_info *get_regs_info () override;
+
protected:
void low_arch_setup () override;
tile_regmap,
};
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
{
NULL, /* regset_bitmap */
&tile_usrregs_info,
&tile_regsets_info,
};
-static const struct regs_info *
-tile_regs_info (void)
+const regs_info *
+tile_target::get_regs_info ()
{
- return ®s_info;
+ return &myregs_info;
}
void
struct linux_target_ops the_low_target =
{
- tile_regs_info,
tile_cannot_fetch_register,
tile_cannot_store_register,
NULL,
connected, and it may or not support xml target descriptions. */
void update_xmltarget ();
+ const regs_info *get_regs_info () override;
+
protected:
void low_arch_setup () override;
&x86_regsets_info
};
-static const struct regs_info *
-x86_linux_regs_info (void)
+const regs_info *
+x86_target::get_regs_info ()
{
#ifdef __x86_64__
if (is_64bit_tdesc ())
struct linux_target_ops the_low_target =
{
- x86_linux_regs_info,
x86_cannot_fetch_register,
x86_cannot_store_register,
NULL, /* fetch_register */
{
public:
+ const regs_info *get_regs_info () override;
+
protected:
void low_arch_setup () override;
NULL, /* disabled_regsets */
};
-static struct regs_info regs_info =
+static struct regs_info myregs_info =
{
NULL, /* regset_bitmap */
NULL, /* usrregs */
return 1;
}
-static const struct regs_info *
-xtensa_regs_info (void)
+const regs_info *
+xtensa_target::get_regs_info ()
{
- return ®s_info;
+ return &myregs_info;
}
struct linux_target_ops the_low_target = {
- xtensa_regs_info,
0,
0,
NULL, /* fetch_register */
gregset_info (void)
{
int i = 0;
- const struct regs_info *regs_info = (*the_low_target.regs_info) ();
+ const regs_info *regs_info = the_linux_target->get_regs_info ();
struct regsets_info *regsets_info = regs_info->regsets_info;
while (regsets_info->regsets[i].size != -1)