gdbserver: turn breakpoint kind-related target ops into methods

gdbserver/ChangeLog:
2020-02-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	Turn process_stratum_target's breakpoint_kind_from_pc,
	sw_breakpoint_from_kind, and breakpoint_kind_from_current_state
	ops into methods of process_target.

	* target.h (struct process_stratum_target): Remove the target op.
	(class process_target): Add the target op.
	(target_breakpoint_kind_from_pc): Update the macro.
	(target_breakpoint_kind_from_current_state): Update the macro.
	(default_breakpoint_kind_from_pc): Remove declaration.
	* target.cc (default_breakpoint_kind_from_pc): Turn into ...
	(process_target::breakpoint_kind_from_pc): ... this.
	(process_target::breakpoint_kind_from_current_state): Define.

	Update the derived classes and callers below.

	* mem-break.cc (bp_size): Update.
	(bp_opcode): Update.
	* linux-low.cc (linux_target_ops): Update.
	(linux_wait_1): Update.
	(linux_breakpoint_kind_from_pc): Turn into ...
	(linux_process_target::breakpoint_kind_from_pc): ... this.
	(linux_sw_breakpoint_from_kind): Turn into ...
	(linux_process_target::sw_breakpoint_from_kind): ... this.
	(linux_breakpoint_kind_from_current_state): Turn into ...
	(linux_process_target::breakpoint_kind_from_current_state): ... this.
	* linux-low.h (class linux_process_target): Update.
	* lynx-low.cc (lynx_target_ops): Update.
	(lynx_process_target::sw_breakpoint_from_kind): Define.
	* lynx-low.h (class lynx_process_target): Update.
	* nto-low.cc (nto_target_ops): Update.
	(nto_sw_breakpoint_from_kind): Turn into ...
	(nto_process_target::sw_breakpoint_from_kind): ... this.
	* nto-low.h (class nto_process_target): Update.
	* win32-low.cc (win32_target_ops): Update.
	(win32_sw_breakpoint_from_kind): Turn into ...
	(win32_process_target::sw_breakpoint_from_kind): ... this.
	* win32-low.h (class win32_process_target): Update.
This commit is contained in:
Tankut Baris Aktemur
2020-02-17 16:12:02 +01:00
parent c9b7b80460
commit d367006fb7
12 changed files with 108 additions and 68 deletions

View File

@ -3226,8 +3226,8 @@ linux_wait_1 (ptid_t ptid,
CORE_ADDR stop_pc = event_child->stop_pc;
breakpoint_kind =
the_target->breakpoint_kind_from_current_state (&stop_pc);
the_target->sw_breakpoint_from_kind (breakpoint_kind, &increment_pc);
the_target->pt->breakpoint_kind_from_current_state (&stop_pc);
the_target->pt->sw_breakpoint_from_kind (breakpoint_kind, &increment_pc);
if (debug_threads)
{
@ -7366,19 +7366,19 @@ current_lwp_ptid (void)
/* Implementation of the target_ops method "breakpoint_kind_from_pc". */
static int
linux_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
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 default_breakpoint_kind_from_pc (pcptr);
return process_target::breakpoint_kind_from_pc (pcptr);
}
/* Implementation of the target_ops method "sw_breakpoint_from_kind". */
static const gdb_byte *
linux_sw_breakpoint_from_kind (int kind, int *size)
const gdb_byte *
linux_process_target::sw_breakpoint_from_kind (int kind, int *size)
{
gdb_assert (the_low_target.sw_breakpoint_from_kind != NULL);
@ -7388,13 +7388,13 @@ linux_sw_breakpoint_from_kind (int kind, int *size)
/* Implementation of the target_ops method
"breakpoint_kind_from_current_state". */
static int
linux_breakpoint_kind_from_current_state (CORE_ADDR *pcptr)
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 linux_breakpoint_kind_from_pc (pcptr);
return breakpoint_kind_from_pc (pcptr);
}
/* Default implementation of linux_target_ops method "set_pc" for
@ -7509,10 +7509,7 @@ linux_get_hwcap2 (int wordsize)
static linux_process_target the_linux_target;
static process_stratum_target linux_target_ops = {
linux_breakpoint_kind_from_pc,
linux_sw_breakpoint_from_kind,
linux_proc_tid_get_name,
linux_breakpoint_kind_from_current_state,
linux_supports_software_single_step,
linux_supports_catch_syscall,
linux_get_ipa_tdesc_idx,