diff options
author | Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> | 2020-04-02 15:11:27 +0200 |
---|---|---|
committer | Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> | 2020-04-02 15:11:27 +0200 |
commit | ac1bbaca10666fc85572a6deeaa6f1debcd4c129 (patch) | |
tree | 1e69bc95276e49e8fe0cbe442d97287e3fd603ef /gdbserver/linux-arm-low.cc | |
parent | 9db9aa232ac37e4dca92733678748adc1bfc7ef0 (diff) | |
download | fsf-binutils-gdb-ac1bbaca10666fc85572a6deeaa6f1debcd4c129.zip fsf-binutils-gdb-ac1bbaca10666fc85572a6deeaa6f1debcd4c129.tar.gz fsf-binutils-gdb-ac1bbaca10666fc85572a6deeaa6f1debcd4c129.tar.bz2 |
gdbserver/linux-low: turn watchpoint ops into methods
gdbserver/ChangeLog:
2020-04-02 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
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) <check_stopped_by_watchpoint>
<low_stopped_by_watchpoint>
<low_stopped_data_address>: 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) <low_stopped_by_watchpoint>
<low_stopped_data_address>: 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)
<low_stopped_by_watchpoint>
<low_stopped_data_address>: 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) <low_stopped_by_watchpoint>
<low_stopped_data_address>: 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)
<low_stopped_by_watchpoint>
<low_stopped_data_address>: 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) <low_stopped_by_watchpoint>
<low_stopped_data_address>: 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.
Diffstat (limited to 'gdbserver/linux-arm-low.cc')
-rw-r--r-- | gdbserver/linux-arm-low.cc | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/gdbserver/linux-arm-low.cc b/gdbserver/linux-arm-low.cc index edb8cd0..2593dfa 100644 --- a/gdbserver/linux-arm-low.cc +++ b/gdbserver/linux-arm-low.cc @@ -95,6 +95,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. */ @@ -672,43 +676,43 @@ arm_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr, } /* Return whether current thread is stopped due to a watchpoint. */ -static int -arm_stopped_by_watchpoint (void) +bool +arm_target::low_stopped_by_watchpoint () { struct lwp_info *lwp = get_thread_lwp (current_thread); siginfo_t siginfo; /* We must be able to set hardware watchpoints. */ if (arm_linux_get_hw_watchpoint_count () == 0) - return 0; + return false; /* Retrieve siginfo. */ errno = 0; ptrace (PTRACE_GETSIGINFO, lwpid_of (current_thread), 0, &siginfo); if (errno != 0) - return 0; + return false; /* This must be a hardware breakpoint. */ if (siginfo.si_signo != SIGTRAP || (siginfo.si_code & 0xffff) != 0x0004 /* TRAP_HWBKPT */) - return 0; + return false; /* If we are in a positive slot then we're looking at a breakpoint and not a watchpoint. */ if (siginfo.si_errno >= 0) - return 0; + return false; /* Cache stopped data address for use by arm_stopped_data_address. */ lwp->arch_private->stopped_data_address = (CORE_ADDR) (uintptr_t) siginfo.si_addr; - return 1; + return true; } /* Return data address that triggered watchpoint. Called only if - arm_stopped_by_watchpoint returned true. */ -static CORE_ADDR -arm_stopped_data_address (void) + low_stopped_by_watchpoint returned true. */ +CORE_ADDR +arm_target::low_stopped_data_address () { struct lwp_info *lwp = get_thread_lwp (current_thread); return lwp->arch_private->stopped_data_address; @@ -1101,8 +1105,6 @@ arm_target::get_regs_info () } struct linux_target_ops the_low_target = { - arm_stopped_by_watchpoint, - arm_stopped_data_address, NULL, /* collect_ptrace_register */ NULL, /* supply_ptrace_register */ NULL, /* siginfo_fixup */ |