From ac1bbaca10666fc85572a6deeaa6f1debcd4c129 Mon Sep 17 00:00:00 2001 From: Tankut Baris Aktemur Date: Thu, 2 Apr 2020 15:11:27 +0200 Subject: gdbserver/linux-low: turn watchpoint ops into methods gdbserver/ChangeLog: 2020-04-02 Tankut Baris Aktemur Turn the 'stopped_by_watchpoint' and 'stopped_data_address' linux target ops into methods of linux_process_target. * linux-low.h (struct linux_target_ops): Remove the ops. (class linux_process_target) : Declare. * linux-low.cc (check_stopped_by_watchpoint): Turn into... (linux_process_target::check_stopped_by_watchpoint): ...this. (linux_process_target::low_stopped_by_watchpoint): Define. (linux_process_target::low_stopped_data_address): Define. * linux-x86-low.cc (class x86_target) : Declare. (x86_stopped_by_watchpoint): Turn into... (x86_target::low_stopped_by_watchpoint): ...this. (x86_stopped_data_address): Turn into... (x86_target::low_stopped_data_address): ...this. (the_low_target): Remove the op fields. * linux-aarch64-low.cc (class aarch64_target) : Declare. (aarch64_stopped_by_watchpoint): Turn into... (aarch64_target::low_stopped_by_watchpoint): ...this. (aarch64_stopped_data_address): Turn into... (aarch64_target::low_stopped_data_address): ...this. (the_low_target): Remove the op fields. * linux-arm-low.cc (class arm_target) : Declare. (arm_stopped_by_watchpoint): Turn into... (arm_target::low_stopped_by_watchpoint): ...this. (arm_stopped_data_address): Turn into... (arm_target::low_stopped_data_address): ...this. (the_low_target): Remove the op fields. * linux-crisv32-low.cc (class crisv32_target) : Declare. (cris_stopped_by_watchpoint): Turn into... (crisv32_target::low_stopped_by_watchpoint): ...this. (cris_stopped_data_address): Turn into... (crisv32_target::low_stopped_data_address): ...this. (the_low_target): Remove the op fields. * linux-mips-low.cc (class mips_target) : Declare. (mips_stopped_by_watchpoint): Turn into... (mips_target::low_stopped_by_watchpoint): ...this. (mips_stopped_data_address): Turn into... (mips_target::low_stopped_data_address): ...this. (the_low_target): Remove the op fields. * linux-bfin-low.cc (the_low_target): Remove the op fields. * linux-m32r-low.cc (the_low_target): Ditto. * linux-m68k-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. --- gdbserver/linux-mips-low.cc | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'gdbserver/linux-mips-low.cc') diff --git a/gdbserver/linux-mips-low.cc b/gdbserver/linux-mips-low.cc index 5696af6..3c2231b 100644 --- a/gdbserver/linux-mips-low.cc +++ b/gdbserver/linux-mips-low.cc @@ -60,6 +60,10 @@ protected: int low_remove_point (raw_bkpt_type type, CORE_ADDR addr, int size, raw_breakpoint *bp) override; + + bool low_stopped_by_watchpoint () override; + + CORE_ADDR low_stopped_data_address () override; }; /* The singleton target ops object. */ @@ -608,12 +612,12 @@ mips_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr, return 0; } -/* This is the implementation of linux_target_ops method - stopped_by_watchpoint. The watchhi R and W bits indicate +/* This is the implementation of linux target ops method + low_stopped_by_watchpoint. The watchhi R and W bits indicate the watch register triggered. */ -static int -mips_stopped_by_watchpoint (void) +bool +mips_target::low_stopped_by_watchpoint () { struct process_info *proc = current_process (); struct arch_process_info *priv = proc->priv->arch_private; @@ -632,16 +636,16 @@ mips_stopped_by_watchpoint (void) for (n = 0; n < MAX_DEBUG_REGISTER && n < num_valid; n++) if (mips_linux_watch_get_watchhi (&priv->watch_readback, n) & (R_MASK | W_MASK)) - return 1; + return true; - return 0; + return false; } -/* This is the implementation of linux_target_ops method - stopped_data_address. */ +/* This is the implementation of linux target ops method + low_stopped_data_address. */ -static CORE_ADDR -mips_stopped_data_address (void) +CORE_ADDR +mips_target::low_stopped_data_address () { struct process_info *proc = current_process (); struct arch_process_info *priv = proc->priv->arch_private; @@ -976,8 +980,6 @@ mips_target::get_regs_info () } struct linux_target_ops the_low_target = { - mips_stopped_by_watchpoint, - mips_stopped_data_address, mips_collect_ptrace_register, mips_supply_ptrace_register, NULL, /* siginfo_fixup */ -- cgit v1.1