+2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
+
+ Remove the 'sw_breakpoint_from_kind' linux target op, and let
+ the concrete linux target define it by overriding the op
+ in process_stratum_target.
+
+ * linux-low.cc (linux_process_target::sw_breakpoint_from_kind):
+ Remove.
+ * linux-low.h (struct linux_target_ops): Remove the op.
+ (class linux_process_target) <sw_breakpoint_from_kind>: Remove.
+ * linux-x86-low.cc (class x86_target) <sw_breakpoint_from_kind>:
+ Declare.
+ (x86_sw_breakpoint_from_kind): Turn into...
+ (x86_target::sw_breakpoint_from_kind): ...this.
+ (the_low_target): Remove the op field.
+ * linux-aarch64-low.cc (class aarch64_target)
+ <sw_breakpoint_from_kind>: Declare.
+ (aarch64_sw_breakpoint_from_kind): Turn into...
+ (aarch64_target::sw_breakpoint_from_kind): ...this.
+ (the_low_target): Remove the op field.
+ * linux-arm-low.cc (class arm_target) <sw_breakpoint_from_kind>:
+ Declare.
+ (arm_target::sw_breakpoint_from_kind): Define.
+ (the_low_target): Remove the op field.
+ * linux-bfin-low.cc (class bfin_target) <sw_breakpoint_from_kind>:
+ Declare.
+ (bfin_sw_breakpoint_from_kind): Turn into...
+ (bfin_target::sw_breakpoint_from_kind): ...this.
+ (the_low_target): Remove the op field.
+ * linux-cris-low.cc (class cris_target) <sw_breakpoint_from_kind>:
+ Declare.
+ (cris_sw_breakpoint_from_kind): Turn into...
+ (cris_target::sw_breakpoint_from_kind): ...this.
+ (the_low_target): Remove the op field.
+ * linux-crisv32-low.cc (class crisv32_target)
+ <sw_breakpoint_from_kind>: Declare.
+ (cris_sw_breakpoint_from_kind): Turn into...
+ (crisv32_target::sw_breakpoint_from_kind): ...this.
+ (the_low_target): Remove the op field.
+ * linux-ia64-low.cc (class ia64_target) <sw_breakpoint_from_kind>:
+ Declare.
+ (ia64_target::sw_breakpoint_from_kind): Define.
+ * linux-m32r-low.cc (class m32r_target) <sw_breakpoint_from_kind>:
+ Declare.
+ (m32r_sw_breakpoint_from_kind): Turn into...
+ (m32r_target::sw_breakpoint_from_kind): ...this.
+ (the_low_target): Remove the op field.
+ * linux-m68k-low.cc (class m68k_target) <sw_breakpoint_from_kind>:
+ Declare.
+ (m68k_sw_breakpoint_from_kind): Turn into...
+ (m68k_target::sw_breakpoint_from_kind): ...this.
+ (the_low_target): Remove the op field.
+ * linux-mips-low.cc (class mips_target) <sw_breakpoint_from_kind>:
+ Declare.
+ (mips_sw_breakpoint_from_kind): Turn into...
+ (mips_target::sw_breakpoint_from_kind): ...this.
+ (the_low_target): Remove the op field.
+ * linux-nios2-low.cc (class nios2_target) <sw_breakpoint_from_kind>:
+ Declare.
+ (nios2_sw_breakpoint_from_kind): Turn into...
+ (nios2_target::sw_breakpoint_from_kind): ...this.
+ (the_low_target): Remove the op field.
+ * linux-ppc-low.cc (class ppc_target) <sw_breakpoint_from_kind>:
+ Declare.
+ (ppc_sw_breakpoint_from_kind): Turn into...
+ (ppc_target::sw_breakpoint_from_kind): ...this.
+ (the_low_target): Remove the op field.
+ * linux-riscv-low.cc (class riscv_target) <sw_breakpoint_from_kind>:
+ Declare.
+ (riscv_sw_breakpoint_from_kind): Turn into...
+ (riscv_target::sw_breakpoint_from_kind): ...this.
+ (the_low_target): Remove the op field.
+ * linux-s390-low.cc (class s390_target) <sw_breakpoint_from_kind>:
+ Declare.
+ (s390_sw_breakpoint_from_kind): Turn into...
+ (s390_target::sw_breakpoint_from_kind): ...this.
+ (the_low_target): Remove the op field.
+ * linux-sh-low.cc (class sh_target) <sw_breakpoint_from_kind>:
+ Declare.
+ (sh_sw_breakpoint_from_kind): Turn into...
+ (sh_target::sw_breakpoint_from_kind): ...this.
+ (the_low_target): Remove the op field.
+ * linux-sparc-low.cc (class sparc_target) <sw_breakpoint_from_kind>:
+ Declare.
+ (sparc_sw_breakpoint_from_kind): Turn into...
+ (sparc_target::sw_breakpoint_from_kind): ...this.
+ (the_low_target): Remove the op field.
+ * linux-tic6x-low.cc (class tic6x_target) <sw_breakpoint_from_kind>:
+ Declare.
+ (tic6x_sw_breakpoint_from_kind): Turn into...
+ (tic6x_target::sw_breakpoint_from_kind): ...this.
+ (the_low_target): Remove the op field.
+ * linux-tile-low.cc (class tile_target) <sw_breakpoint_from_kind>:
+ Declare.
+ (tile_sw_breakpoint_from_kind): Turn into...
+ (tile_target::sw_breakpoint_from_kind): ...this.
+ (the_low_target): Remove the op field.
+ * linux-xtensa-low.cc (class xtensa_target)
+ <sw_breakpoint_from_kind>: Declare.
+ (xtensa_sw_breakpoint_from_kind): Turn into...
+ (xtensa_target::sw_breakpoint_from_kind): ...this.
+ (the_low_target): Remove the op field.
+
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Remove the 'breakpoint_kind_from_pc' and
int breakpoint_kind_from_current_state (CORE_ADDR *pcptr) override;
+ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+
protected:
void low_arch_setup () override;
return 1;
}
-/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
+/* Implementation of target ops method "sw_breakpoint_from_kind". */
-static const gdb_byte *
-aarch64_sw_breakpoint_from_kind (int kind, int *size)
+const gdb_byte *
+aarch64_target::sw_breakpoint_from_kind (int kind, int *size)
{
if (is_64bit_tdesc ())
{
struct linux_target_ops the_low_target =
{
- aarch64_sw_breakpoint_from_kind,
NULL, /* get_next_pcs */
0, /* decr_pc_after_break */
aarch64_breakpoint_at,
int breakpoint_kind_from_current_state (CORE_ADDR *pcptr) override;
+ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+
protected:
void low_arch_setup () override;
return arm_breakpoint_kind_from_current_state (pcptr);
}
+const gdb_byte *
+arm_target::sw_breakpoint_from_kind (int kind, int *size)
+{
+ return arm_sw_breakpoint_from_kind (kind, size);
+}
+
/* Information describing the hardware breakpoint capabilities. */
static struct
{
}
struct linux_target_ops the_low_target = {
- arm_sw_breakpoint_from_kind,
arm_gdbserver_get_next_pcs,
0,
arm_breakpoint_at,
const regs_info *get_regs_info () override;
+ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+
protected:
void low_arch_setup () override;
#define bfin_breakpoint_len 2
static const gdb_byte bfin_breakpoint[bfin_breakpoint_len] = {0xa1, 0x00};
-/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
+/* Implementation of target ops method "sw_breakpoint_from_kind". */
-static const gdb_byte *
-bfin_sw_breakpoint_from_kind (int kind, int *size)
+const gdb_byte *
+bfin_target::sw_breakpoint_from_kind (int kind, int *size)
{
*size = bfin_breakpoint_len;
return bfin_breakpoint;
}
struct linux_target_ops the_low_target = {
- bfin_sw_breakpoint_from_kind,
NULL, /* get_next_pcs */
2,
bfin_breakpoint_at,
const regs_info *get_regs_info () override;
+ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+
protected:
void low_arch_setup () override;
static const unsigned short cris_breakpoint = 0xe938;
#define cris_breakpoint_len 2
-/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
+/* Implementation of target ops method "sw_breakpoint_from_kind". */
-static const gdb_byte *
-cris_sw_breakpoint_from_kind (int kind, int *size)
+const gdb_byte *
+cris_target::sw_breakpoint_from_kind (int kind, int *size)
{
*size = cris_breakpoint_len;
return (const gdb_byte *) &cris_breakpoint;
}
struct linux_target_ops the_low_target = {
- cris_sw_breakpoint_from_kind,
NULL, /* get_next_pcs */
0,
cris_breakpoint_at,
const regs_info *get_regs_info () override;
+ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+
protected:
void low_arch_setup () override;
static const unsigned short cris_breakpoint = 0xe938;
#define cris_breakpoint_len 2
-/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
+/* Implementation of target ops method "sw_breakpoint_from_kind". */
-static const gdb_byte *
-cris_sw_breakpoint_from_kind (int kind, int *size)
+const gdb_byte *
+crisv32_target::sw_breakpoint_from_kind (int kind, int *size)
{
*size = cris_breakpoint_len;
return (const gdb_byte *) &cris_breakpoint;
}
struct linux_target_ops the_low_target = {
- cris_sw_breakpoint_from_kind,
NULL, /* get_next_pcs */
0,
cris_breakpoint_at,
const regs_info *get_regs_info () override;
+ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+
protected:
void low_arch_setup () override;
static ia64_target the_ia64_target;
+const gdb_byte *
+ia64_target::sw_breakpoint_from_kind (int kind, int *size)
+{
+ gdb_assert_no_reached ("target op sw_breakpoint_from_kind is not "
+ "implemented by this target");
+}
+
/* Defined in auto-generated file reg-ia64.c. */
void init_registers_ia64 (void);
extern const struct target_desc *tdesc_ia64;
return ptid_of (current_thread);
}
-/* Implementation of the target_ops method "sw_breakpoint_from_kind". */
-
-const gdb_byte *
-linux_process_target::sw_breakpoint_from_kind (int kind, int *size)
-{
- gdb_assert (the_low_target.sw_breakpoint_from_kind != NULL);
-
- return (*the_low_target.sw_breakpoint_from_kind) (kind, size);
-}
-
const char *
linux_process_target::thread_name (ptid_t thread)
{
struct linux_target_ops
{
- /* See target.h for details. */
- const gdb_byte *(*sw_breakpoint_from_kind) (int kind, int *size);
-
/* Find the next possible PCs after the current instruction executes. */
std::vector<CORE_ADDR> (*get_next_pcs) (struct regcache *regcache);
ssize_t multifs_readlink (int pid, const char *filename, char *buf,
size_t bufsiz) override;
- const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
-
const char *thread_name (ptid_t thread) override;
#if USE_THREAD_DB
const regs_info *get_regs_info () override;
+ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+
protected:
void low_arch_setup () override;
static const unsigned short m32r_breakpoint = 0x10f1;
#define m32r_breakpoint_len 2
-/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
+/* Implementation of target ops method "sw_breakpoint_from_kind". */
-static const gdb_byte *
-m32r_sw_breakpoint_from_kind (int kind, int *size)
+const gdb_byte *
+m32r_target::sw_breakpoint_from_kind (int kind, int *size)
{
*size = m32r_breakpoint_len;
return (const gdb_byte *) &m32r_breakpoint;
}
struct linux_target_ops the_low_target = {
- m32r_sw_breakpoint_from_kind,
NULL,
0,
m32r_breakpoint_at,
const regs_info *get_regs_info () override;
+ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+
protected:
void low_arch_setup () override;
static const gdb_byte m68k_breakpoint[] = { 0x4E, 0x4F };
#define m68k_breakpoint_len 2
-/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
+/* Implementation of target ops method "sw_breakpoint_from_kind". */
-static const gdb_byte *
-m68k_sw_breakpoint_from_kind (int kind, int *size)
+const gdb_byte *
+m68k_target::sw_breakpoint_from_kind (int kind, int *size)
{
*size = m68k_breakpoint_len;
return m68k_breakpoint;
}
struct linux_target_ops the_low_target = {
- m68k_sw_breakpoint_from_kind,
NULL,
2,
m68k_breakpoint_at,
const regs_info *get_regs_info () override;
+ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+
protected:
void low_arch_setup () override;
static const unsigned int mips_breakpoint = 0x0005000d;
#define mips_breakpoint_len 4
-/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
+/* Implementation of target ops method "sw_breakpoint_from_kind". */
-static const gdb_byte *
-mips_sw_breakpoint_from_kind (int kind, int *size)
+const gdb_byte *
+mips_target::sw_breakpoint_from_kind (int kind, int *size)
{
*size = mips_breakpoint_len;
return (const gdb_byte *) &mips_breakpoint;
}
struct linux_target_ops the_low_target = {
- mips_sw_breakpoint_from_kind,
NULL, /* get_next_pcs */
0,
mips_breakpoint_at,
const regs_info *get_regs_info () override;
+ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+
protected:
void low_arch_setup () override;
static const unsigned int nios2_breakpoint = NIOS2_BREAKPOINT;
#define nios2_breakpoint_len 4
-/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
+/* Implementation of target ops method "sw_breakpoint_from_kind". */
-static const gdb_byte *
-nios2_sw_breakpoint_from_kind (int kind, int *size)
+const gdb_byte *
+nios2_target::sw_breakpoint_from_kind (int kind, int *size)
{
*size = nios2_breakpoint_len;
return (const gdb_byte *) &nios2_breakpoint;
struct linux_target_ops the_low_target =
{
- nios2_sw_breakpoint_from_kind,
NULL, /* get_next_pcs */
0,
nios2_breakpoint_at,
const regs_info *get_regs_info () override;
+ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+
protected:
void low_arch_setup () override;
static const unsigned int ppc_breakpoint = 0x7d821008;
#define ppc_breakpoint_len 4
-/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
+/* Implementation of target ops method "sw_breakpoint_from_kind". */
-static const gdb_byte *
-ppc_sw_breakpoint_from_kind (int kind, int *size)
+const gdb_byte *
+ppc_target::sw_breakpoint_from_kind (int kind, int *size)
{
*size = ppc_breakpoint_len;
return (const gdb_byte *) &ppc_breakpoint;
}
struct linux_target_ops the_low_target = {
- ppc_sw_breakpoint_from_kind,
NULL,
0,
ppc_breakpoint_at,
int breakpoint_kind_from_pc (CORE_ADDR *pcptr) override;
+ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+
protected:
void low_arch_setup () override;
return sizeof (riscv_cbreakpoint);
}
-/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
+/* Implementation of target ops method "sw_breakpoint_from_kind". */
-static const gdb_byte *
-riscv_sw_breakpoint_from_kind (int kind, int *size)
+const gdb_byte *
+riscv_target::sw_breakpoint_from_kind (int kind, int *size)
{
*size = kind;
switch (kind)
/* RISC-V/Linux target operations. */
struct linux_target_ops the_low_target =
{
- riscv_sw_breakpoint_from_kind,
NULL, /* get_next_pcs */
0, /* decr_pc_after_break */
riscv_breakpoint_at,
const regs_info *get_regs_info () override;
+ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+
protected:
void low_arch_setup () override;
static const gdb_byte s390_breakpoint[] = { 0, 1 };
#define s390_breakpoint_len 2
-/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
+/* Implementation of target ops method "sw_breakpoint_from_kind". */
-static const gdb_byte *
-s390_sw_breakpoint_from_kind (int kind, int *size)
+const gdb_byte *
+s390_target::sw_breakpoint_from_kind (int kind, int *size)
{
*size = s390_breakpoint_len;
return s390_breakpoint;
}
struct linux_target_ops the_low_target = {
- s390_sw_breakpoint_from_kind,
NULL,
s390_breakpoint_len,
s390_breakpoint_at,
const regs_info *get_regs_info () override;
+ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+
protected:
void low_arch_setup () override;
static const unsigned short sh_breakpoint = 0xc3c3;
#define sh_breakpoint_len 2
-/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
+/* Implementation of target ops method "sw_breakpoint_from_kind". */
-static const gdb_byte *
-sh_sw_breakpoint_from_kind (int kind, int *size)
+const gdb_byte *
+sh_target::sw_breakpoint_from_kind (int kind, int *size)
{
*size = sh_breakpoint_len;
return (const gdb_byte *) &sh_breakpoint;
}
struct linux_target_ops the_low_target = {
- sh_sw_breakpoint_from_kind,
NULL,
0,
sh_breakpoint_at,
const regs_info *get_regs_info () override;
+ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+
protected:
void low_arch_setup () override;
};
#define sparc_breakpoint_len INSN_SIZE
-/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
+/* Implementation of target ops method "sw_breakpoint_from_kind". */
-static const unsigned char *
-sparc_sw_breakpoint_from_kind (int kind, int *size)
+const gdb_byte *
+sparc_target::sw_breakpoint_from_kind (int kind, int *size)
{
*size = sparc_breakpoint_len;
return sparc_breakpoint;
}
struct linux_target_ops the_low_target = {
- sparc_sw_breakpoint_from_kind,
NULL, /* get_next_pcs */
0,
sparc_breakpoint_at,
const regs_info *get_regs_info () override;
+ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+
protected:
void low_arch_setup () override;
static unsigned int tic6x_breakpoint;
#define tic6x_breakpoint_len 4
-/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
+/* Implementation of target ops method "sw_breakpoint_from_kind". */
-static const gdb_byte *
-tic6x_sw_breakpoint_from_kind (int kind, int *size)
+const gdb_byte *
+tic6x_target::sw_breakpoint_from_kind (int kind, int *size)
{
*size = tic6x_breakpoint_len;
return (const gdb_byte *) &tic6x_breakpoint;
}
struct linux_target_ops the_low_target = {
- tic6x_sw_breakpoint_from_kind,
NULL,
0,
tic6x_breakpoint_at,
const regs_info *get_regs_info () override;
+ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+
protected:
void low_arch_setup () override;
static uint64_t tile_breakpoint = 0x400b3cae70166000ULL;
#define tile_breakpoint_len 8
-/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
+/* Implementation of target ops method "sw_breakpoint_from_kind". */
-static const gdb_byte *
-tile_sw_breakpoint_from_kind (int kind, int *size)
+const gdb_byte *
+tile_target::sw_breakpoint_from_kind (int kind, int *size)
{
*size = tile_breakpoint_len;
return (const gdb_byte *) &tile_breakpoint;
struct linux_target_ops the_low_target =
{
- tile_sw_breakpoint_from_kind,
NULL,
0,
tile_breakpoint_at,
const regs_info *get_regs_info () override;
+ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+
protected:
void low_arch_setup () override;
return &i386_emit_ops;
}
-/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
+/* Implementation of target ops method "sw_breakpoint_from_kind". */
-static const gdb_byte *
-x86_sw_breakpoint_from_kind (int kind, int *size)
+const gdb_byte *
+x86_target::sw_breakpoint_from_kind (int kind, int *size)
{
*size = x86_breakpoint_len;
return x86_breakpoint;
struct linux_target_ops the_low_target =
{
- x86_sw_breakpoint_from_kind,
NULL,
1,
x86_breakpoint_at,
const regs_info *get_regs_info () override;
+ const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
+
protected:
void low_arch_setup () override;
static const gdb_byte xtensa_breakpoint[] = XTENSA_BREAKPOINT;
#define xtensa_breakpoint_len 2
-/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
+/* Implementation of target ops method "sw_breakpoint_from_kind". */
-static const gdb_byte *
-xtensa_sw_breakpoint_from_kind (int kind, int *size)
+const gdb_byte *
+xtensa_target::sw_breakpoint_from_kind (int kind, int *size)
{
*size = xtensa_breakpoint_len;
return xtensa_breakpoint;
}
struct linux_target_ops the_low_target = {
- xtensa_sw_breakpoint_from_kind,
NULL,
0,
xtensa_breakpoint_at,