+2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
+
+ Remove the 'breakpoint_kind_from_pc' and
+ 'breakpoint_kind_from_current_state' linux target ops, and let the
+ concrete linux target define them by overriding the ops of
+ process_stratum_target.
+
+ * linux-low.cc (linux_process_target::breakpoint_kind_from_pc):
+ Remove.
+ (linux_process_target::breakpoint_kind_from_current_state): Remove.
+ * linux-low.h (struct linux_target_ops): Remove ops.
+ (class linux_process_target) <breakpoint_kind_from_pc>: Remove.
+ <breakpoint_kind_from_current_state>: Remove.
+ * linux-x86-low.cc (the_low_target): Remove the op fields.
+ * linux-bfin-low.cc (the_low_target): Ditto.
+ * linux-cris-low.cc (the_low_target): Ditto.
+ * linux-crisv32-low.cc (the_low_target): Ditto.
+ * linux-m32r-low.cc (the_low_target): Ditto.
+ * linux-m68k-low.cc (the_low_target): Ditto.
+ * linux-mips-low.cc (the_low_target): Ditto.
+ * linux-nios2-low.cc (the_low_target): Ditto.
+ * linux-ppc-low.cc (the_low_target): Ditto.
+ * linux-s390-low.cc (the_low_target): Ditto.
+ * linux-sh-low.cc (the_low_target): Ditto.
+ * linux-sparc-low.cc (the_low_target): Ditto.
+ * linux-tic6x-low.cc (the_low_target): Ditto.
+ * linux-tile-low.cc (the_low_target): Ditto.
+ * linux-xtensa-low.cc (the_low_target): Ditto.
+ * linux-aarch64-low.cc (class aarch64_target)
+ <breakpoint_kind_from_pc>
+ <breakpoint_kind_from_current_state>: Declare.
+ (aarch64_breakpoint_kind_from_pc): Turn into...
+ (aarch64_target::breakpoint_kind_from_pc): ...this.
+ (aarch64_breakpoint_kind_from_current_state): Turn into...
+ (aarch64_target::breakpoint_kind_from_current_state): ...this.
+ (the_low_target): Remove the op fields.
+ * linux-arm-low.cc (class arm_target):
+ <breakpoint_kind_from_pc>
+ <breakpoint_kind_from_current_state>: Declare.
+ (arm_target::breakpoint_kind_from_pc): Define.
+ (arm_target::breakpoint_kind_from_current_state): Define.
+ (the_low_target): Remove the op fields.
+ * linux-riscv-low.cc (class riscv_target):
+ <breakpoint_kind_from_pc>: Declare.
+ (riscv_breakpoint_kind_from_pc): Turn into...
+ (riscv_target::breakpoint_kind_from_pc): ...this.
+ (the_low_target): Remove the op fields.
+
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Turn the 'get_pc' and 'set_pc' linux target ops into methods
const regs_info *get_regs_info () override;
+ int breakpoint_kind_from_pc (CORE_ADDR *pcptr) override;
+
+ int breakpoint_kind_from_current_state (CORE_ADDR *pcptr) override;
+
protected:
void low_arch_setup () override;
return arm_sw_breakpoint_from_kind (kind, size);
}
-/* Implementation of linux_target_ops method "breakpoint_kind_from_pc". */
+/* Implementation of target ops method "breakpoint_kind_from_pc". */
-static int
-aarch64_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
+int
+aarch64_target::breakpoint_kind_from_pc (CORE_ADDR *pcptr)
{
if (is_64bit_tdesc ())
return aarch64_breakpoint_len;
return arm_breakpoint_kind_from_pc (pcptr);
}
-/* Implementation of the linux_target_ops method
+/* Implementation of the target ops method
"breakpoint_kind_from_current_state". */
-static int
-aarch64_breakpoint_kind_from_current_state (CORE_ADDR *pcptr)
+int
+aarch64_target::breakpoint_kind_from_current_state (CORE_ADDR *pcptr)
{
if (is_64bit_tdesc ())
return aarch64_breakpoint_len;
struct linux_target_ops the_low_target =
{
- aarch64_breakpoint_kind_from_pc,
aarch64_sw_breakpoint_from_kind,
NULL, /* get_next_pcs */
0, /* decr_pc_after_break */
aarch64_emit_ops,
aarch64_get_min_fast_tracepoint_insn_len,
aarch64_supports_range_stepping,
- aarch64_breakpoint_kind_from_current_state,
aarch64_supports_hardware_single_step,
aarch64_get_syscall_trapinfo,
};
const regs_info *get_regs_info () override;
+ int breakpoint_kind_from_pc (CORE_ADDR *pcptr) override;
+
+ int breakpoint_kind_from_current_state (CORE_ADDR *pcptr) override;
+
protected:
void low_arch_setup () override;
linux_set_pc_32bit (regcache, pc);
}
+int
+arm_target::breakpoint_kind_from_pc (CORE_ADDR *pcptr)
+{
+ return arm_breakpoint_kind_from_pc (pcptr);
+}
+
+int
+arm_target::breakpoint_kind_from_current_state (CORE_ADDR *pcptr)
+{
+ return arm_breakpoint_kind_from_current_state (pcptr);
+}
+
/* Information describing the hardware breakpoint capabilities. */
static struct
{
}
struct linux_target_ops the_low_target = {
- arm_breakpoint_kind_from_pc,
arm_sw_breakpoint_from_kind,
arm_gdbserver_get_next_pcs,
0,
NULL, /* emit_ops */
NULL, /* get_min_fast_tracepoint_insn_len */
NULL, /* supports_range_stepping */
- arm_breakpoint_kind_from_current_state,
arm_supports_hardware_single_step,
arm_get_syscall_trapinfo,
};
}
struct linux_target_ops the_low_target = {
- NULL, /* breakpoint_kind_from_pc */
bfin_sw_breakpoint_from_kind,
NULL, /* get_next_pcs */
2,
NULL, /* emit_ops */
NULL, /* get_min_fast_tracepoint_insn_len */
NULL, /* supports_range_stepping */
- NULL, /* breakpoint_kind_from_current_state */
bfin_supports_hardware_single_step,
};
}
struct linux_target_ops the_low_target = {
- NULL, /* breakpoint_kind_from_pc */
cris_sw_breakpoint_from_kind,
NULL, /* get_next_pcs */
0,
}
struct linux_target_ops the_low_target = {
- NULL, /* breakpoint_kind_from_pc */
cris_sw_breakpoint_from_kind,
NULL, /* get_next_pcs */
0,
NULL, /* emit_ops */
NULL, /* get_min_fast_tracepoint_insn_len */
NULL, /* supports_range_stepping */
- NULL, /* breakpoint_kind_from_current_state */
cris_supports_hardware_single_step,
};
return ptid_of (current_thread);
}
-/* Implementation of the target_ops method "breakpoint_kind_from_pc". */
-
-int
-linux_process_target::breakpoint_kind_from_pc (CORE_ADDR *pcptr)
-{
- if (the_low_target.breakpoint_kind_from_pc != NULL)
- return (*the_low_target.breakpoint_kind_from_pc) (pcptr);
- else
- return process_stratum_target::breakpoint_kind_from_pc (pcptr);
-}
-
/* Implementation of the target_ops method "sw_breakpoint_from_kind". */
const gdb_byte *
return (*the_low_target.sw_breakpoint_from_kind) (kind, size);
}
-/* Implementation of the target_ops method
- "breakpoint_kind_from_current_state". */
-
-int
-linux_process_target::breakpoint_kind_from_current_state (CORE_ADDR *pcptr)
-{
- if (the_low_target.breakpoint_kind_from_current_state != NULL)
- return (*the_low_target.breakpoint_kind_from_current_state) (pcptr);
- else
- return breakpoint_kind_from_pc (pcptr);
-}
-
const char *
linux_process_target::thread_name (ptid_t thread)
{
struct linux_target_ops
{
- /* See target.h for details. */
- int (*breakpoint_kind_from_pc) (CORE_ADDR *pcptr);
-
/* See target.h for details. */
const gdb_byte *(*sw_breakpoint_from_kind) (int kind, int *size);
/* Returns true if the low target supports range stepping. */
int (*supports_range_stepping) (void);
- /* See target.h. */
- int (*breakpoint_kind_from_current_state) (CORE_ADDR *pcptr);
-
/* See target.h. */
int (*supports_hardware_single_step) (void);
ssize_t multifs_readlink (int pid, const char *filename, char *buf,
size_t bufsiz) override;
- int breakpoint_kind_from_pc (CORE_ADDR *pcptr) override;
-
const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
- int breakpoint_kind_from_current_state (CORE_ADDR *pcptr) override;
-
const char *thread_name (ptid_t thread) override;
#if USE_THREAD_DB
}
struct linux_target_ops the_low_target = {
- NULL, /* breakpoint_from_pc */
m32r_sw_breakpoint_from_kind,
NULL,
0,
NULL, /* emit_ops */
NULL, /* get_min_fast_tracepoint_insn_len */
NULL, /* supports_range_stepping */
- NULL, /* breakpoint_kind_from_current_state */
m32r_supports_hardware_single_step,
};
}
struct linux_target_ops the_low_target = {
- NULL, /* breakpoint_kind_from_pc */
m68k_sw_breakpoint_from_kind,
NULL,
2,
NULL, /* emit_ops */
NULL, /* get_min_fast_tracepoint_insn_len */
NULL, /* supports_range_stepping */
- NULL, /* breakpoint_kind_from_current_state */
m68k_supports_hardware_single_step,
};
}
struct linux_target_ops the_low_target = {
- NULL, /* breakpoint_kind_from_pc */
mips_sw_breakpoint_from_kind,
NULL, /* get_next_pcs */
0,
struct linux_target_ops the_low_target =
{
- NULL, /* breakpoint_kind_from_pc */
nios2_sw_breakpoint_from_kind,
NULL, /* get_next_pcs */
0,
}
struct linux_target_ops the_low_target = {
- NULL, /* breakpoint_kind_from_pc */
ppc_sw_breakpoint_from_kind,
NULL,
0,
ppc_emit_ops,
ppc_get_min_fast_tracepoint_insn_len,
NULL, /* supports_range_stepping */
- NULL, /* breakpoint_kind_from_current_state */
ppc_supports_hardware_single_step,
NULL, /* get_syscall_trapinfo */
ppc_get_ipa_tdesc_idx,
const regs_info *get_regs_info () override;
+ int breakpoint_kind_from_pc (CORE_ADDR *pcptr) override;
+
protected:
void low_arch_setup () override;
static const uint16_t riscv_ibreakpoint[] = { 0x0073, 0x0010 };
static const uint16_t riscv_cbreakpoint = 0x9002;
-/* Implementation of linux_target_ops method "breakpoint_kind_from_pc". */
+/* Implementation of target ops method "breakpoint_kind_from_pc". */
-static int
-riscv_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
+int
+riscv_target::breakpoint_kind_from_pc (CORE_ADDR *pcptr)
{
union
{
/* RISC-V/Linux target operations. */
struct linux_target_ops the_low_target =
{
- riscv_breakpoint_kind_from_pc,
riscv_sw_breakpoint_from_kind,
NULL, /* get_next_pcs */
0, /* decr_pc_after_break */
}
struct linux_target_ops the_low_target = {
- NULL, /* breakpoint_kind_from_pc */
s390_sw_breakpoint_from_kind,
NULL,
s390_breakpoint_len,
s390_emit_ops,
s390_get_min_fast_tracepoint_insn_len,
NULL, /* supports_range_stepping */
- NULL, /* breakpoint_kind_from_current_state */
s390_supports_hardware_single_step,
NULL, /* get_syscall_trapinfo */
s390_get_ipa_tdesc_idx,
}
struct linux_target_ops the_low_target = {
- NULL, /* breakpoint_kind_from_pc */
sh_sw_breakpoint_from_kind,
NULL,
0,
NULL, /* emit_ops */
NULL, /* get_min_fast_tracepoint_insn_len */
NULL, /* supports_range_stepping */
- NULL, /* breakpoint_kind_from_current_state */
sh_supports_hardware_single_step,
};
}
struct linux_target_ops the_low_target = {
- NULL, /* breakpoint_kind_from_pc */
sparc_sw_breakpoint_from_kind,
NULL, /* get_next_pcs */
0,
}
struct linux_target_ops the_low_target = {
- NULL, /* breakpoint_kind_from_pc */
tic6x_sw_breakpoint_from_kind,
NULL,
0,
NULL, /* emit_ops */
NULL, /* get_min_fast_tracepoint_insn_len */
NULL, /* supports_range_stepping */
- NULL, /* breakpoint_kind_from_current_state */
tic6x_supports_hardware_single_step,
};
struct linux_target_ops the_low_target =
{
- NULL, /* breakpoint_kind_from_pc */
tile_sw_breakpoint_from_kind,
NULL,
0,
NULL, /* emit_ops */
NULL, /* get_min_fast_tracepoint_insn_len */
NULL, /* supports_range_stepping */
- NULL, /* breakpoint_kind_from_current_state */
tile_supports_hardware_single_step,
};
struct linux_target_ops the_low_target =
{
- NULL, /* breakpoint_kind_from_pc */
x86_sw_breakpoint_from_kind,
NULL,
1,
x86_emit_ops,
x86_get_min_fast_tracepoint_insn_len,
x86_supports_range_stepping,
- NULL, /* breakpoint_kind_from_current_state */
x86_supports_hardware_single_step,
x86_get_syscall_trapinfo,
x86_get_ipa_tdesc_idx,
}
struct linux_target_ops the_low_target = {
- NULL, /* breakpoint_kind_from_pc */
xtensa_sw_breakpoint_from_kind,
NULL,
0,
NULL, /* emit_ops */
NULL, /* get_min_fast_tracepoint_insn_len */
NULL, /* supports_range_stepping */
- NULL, /* breakpoint_kind_from_current_state */
xtensa_supports_hardware_single_step,
};