[17/31] gdbserver/linux-low: turn watchpoint ops into methods

Message ID cda46f397117dc79afe5e1bc119a3c8939620609.1583529167.git.tankut.baris.aktemur@intel.com
State New, archived
Headers

Commit Message

Aktemur, Tankut Baris March 6, 2020, 9:31 p.m. UTC
  gdbserver/ChangeLog:
2020-03-06  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.
---
 gdbserver/linux-aarch64-low.cc | 23 +++++++-------
 gdbserver/linux-arm-low.cc     | 26 +++++++++-------
 gdbserver/linux-bfin-low.cc    |  2 --
 gdbserver/linux-crisv32-low.cc | 14 +++++----
 gdbserver/linux-low.cc         | 57 +++++++++++++---------------------
 gdbserver/linux-low.h          | 23 ++++++++++++--
 gdbserver/linux-m32r-low.cc    |  2 --
 gdbserver/linux-m68k-low.cc    |  2 --
 gdbserver/linux-mips-low.cc    | 26 +++++++++-------
 gdbserver/linux-ppc-low.cc     |  2 --
 gdbserver/linux-s390-low.cc    |  2 --
 gdbserver/linux-sh-low.cc      |  2 --
 gdbserver/linux-sparc-low.cc   |  1 -
 gdbserver/linux-tic6x-low.cc   |  2 --
 gdbserver/linux-tile-low.cc    |  2 --
 gdbserver/linux-x86-low.cc     | 14 +++++----
 gdbserver/linux-xtensa-low.cc  |  2 --
 17 files changed, 96 insertions(+), 106 deletions(-)
  

Patch

diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc
index 5ebf69048a6..7eef276fb0c 100644
--- a/gdbserver/linux-aarch64-low.cc
+++ b/gdbserver/linux-aarch64-low.cc
@@ -87,6 +87,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.  */
@@ -410,10 +414,10 @@  aarch64_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
   return ret;
 }
 
-/* Implementation of linux_target_ops method "stopped_data_address".  */
+/* Implementation of linux target ops method "low_stopped_data_address".  */
 
-static CORE_ADDR
-aarch64_stopped_data_address (void)
+CORE_ADDR
+aarch64_target::low_stopped_data_address ()
 {
   siginfo_t siginfo;
   int pid, i;
@@ -472,15 +476,12 @@  aarch64_stopped_data_address (void)
   return (CORE_ADDR) 0;
 }
 
-/* Implementation of linux_target_ops method "stopped_by_watchpoint".  */
+/* Implementation of linux target ops method "low_stopped_by_watchpoint".  */
 
-static int
-aarch64_stopped_by_watchpoint (void)
+bool
+aarch64_target::low_stopped_by_watchpoint ()
 {
-  if (aarch64_stopped_data_address () != 0)
-    return 1;
-  else
-    return 0;
+  return (low_stopped_data_address () != 0);
 }
 
 /* Fetch the thread-local storage pointer for libthread_db.  */
@@ -3113,8 +3114,6 @@  aarch64_supports_hardware_single_step (void)
 
 struct linux_target_ops the_low_target =
 {
-  aarch64_stopped_by_watchpoint,
-  aarch64_stopped_data_address,
   NULL, /* collect_ptrace_register */
   NULL, /* supply_ptrace_register */
   aarch64_linux_siginfo_fixup,
diff --git a/gdbserver/linux-arm-low.cc b/gdbserver/linux-arm-low.cc
index 4ba65360578..2e4b6cf3d0c 100644
--- a/gdbserver/linux-arm-low.cc
+++ b/gdbserver/linux-arm-low.cc
@@ -97,6 +97,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.  */
@@ -674,43 +678,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;
@@ -1103,8 +1107,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 */
diff --git a/gdbserver/linux-bfin-low.cc b/gdbserver/linux-bfin-low.cc
index 854c90eff5d..c17799b7d14 100644
--- a/gdbserver/linux-bfin-low.cc
+++ b/gdbserver/linux-bfin-low.cc
@@ -165,8 +165,6 @@  bfin_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* stopped_by_watchpoint */
-  NULL, /* stopped_data_address */
   NULL, /* collect_ptrace_register */
   NULL, /* supply_ptrace_register */
   NULL, /* siginfo_fixup */
diff --git a/gdbserver/linux-crisv32-low.cc b/gdbserver/linux-crisv32-low.cc
index 2bb60e6e431..3498e01b9cc 100644
--- a/gdbserver/linux-crisv32-low.cc
+++ b/gdbserver/linux-crisv32-low.cc
@@ -55,6 +55,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.  */
@@ -357,8 +361,8 @@  crisv32_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
   return 0;
 }
 
-static int
-cris_stopped_by_watchpoint (void)
+bool
+crisv32_target::low_stopped_by_watchpoint ()
 {
   unsigned long exs;
   struct regcache *regcache = get_thread_regcache (current_thread, 1);
@@ -368,8 +372,8 @@  cris_stopped_by_watchpoint (void)
   return (((exs & 0xff00) >> 8) == 0xc);
 }
 
-static CORE_ADDR
-cris_stopped_data_address (void)
+CORE_ADDR
+crisv32_target::low_stopped_data_address ()
 {
   unsigned long eda;
   struct regcache *regcache = get_thread_regcache (current_thread, 1);
@@ -466,8 +470,6 @@  crisv32_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  cris_stopped_by_watchpoint,
-  cris_stopped_data_address,
   NULL, /* collect_ptrace_register */
   NULL, /* supply_ptrace_register */
   NULL, /* siginfo_fixup */
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index 8112846aaab..d643e8d5d56 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -786,8 +786,6 @@  get_syscall_trapinfo (struct lwp_info *lwp, int *sysno)
   current_thread = saved_thread;
 }
 
-static int check_stopped_by_watchpoint (struct lwp_info *child);
-
 bool
 linux_process_target::save_stop_reason (lwp_info *lwp)
 {
@@ -2245,46 +2243,33 @@  dequeue_one_deferred_signal (struct lwp_info *lwp, int *wstat)
   return 0;
 }
 
-/* Fetch the possibly triggered data watchpoint info and store it in
-   CHILD.
-
-   On some archs, like x86, that use debug registers to set
-   watchpoints, it's possible that the way to know which watched
-   address trapped, is to check the register that is used to select
-   which address to watch.  Problem is, between setting the watchpoint
-   and reading back which data address trapped, the user may change
-   the set of watchpoints, and, as a consequence, GDB changes the
-   debug registers in the inferior.  To avoid reading back a stale
-   stopped-data-address when that happens, we cache in LP the fact
-   that a watchpoint trapped, and the corresponding data address, as
-   soon as we see CHILD stop with a SIGTRAP.  If GDB changes the debug
-   registers meanwhile, we have the cached data we can rely on.  */
-
-static int
-check_stopped_by_watchpoint (struct lwp_info *child)
+bool
+linux_process_target::check_stopped_by_watchpoint (lwp_info *child)
 {
-  if (the_low_target.stopped_by_watchpoint != NULL)
-    {
-      struct thread_info *saved_thread;
+  struct thread_info *saved_thread = current_thread;
+  current_thread = get_lwp_thread (child);
 
-      saved_thread = current_thread;
-      current_thread = get_lwp_thread (child);
+  if (low_stopped_by_watchpoint ())
+    {
+      child->stop_reason = TARGET_STOPPED_BY_WATCHPOINT;
+      child->stopped_data_address = low_stopped_data_address ();
+    }
 
-      if (the_low_target.stopped_by_watchpoint ())
-	{
-	  child->stop_reason = TARGET_STOPPED_BY_WATCHPOINT;
+  current_thread = saved_thread;
 
-	  if (the_low_target.stopped_data_address != NULL)
-	    child->stopped_data_address
-	      = the_low_target.stopped_data_address ();
-	  else
-	    child->stopped_data_address = 0;
-	}
+  return child->stop_reason == TARGET_STOPPED_BY_WATCHPOINT;
+}
 
-      current_thread = saved_thread;
-    }
+bool
+linux_process_target::low_stopped_by_watchpoint ()
+{
+  return false;
+}
 
-  return child->stop_reason == TARGET_STOPPED_BY_WATCHPOINT;
+CORE_ADDR
+linux_process_target::low_stopped_data_address ()
+{
+  return 0;
 }
 
 /* Return the ptrace options that we want to try to enable.  */
diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h
index 3cbd358bdfc..252b549989a 100644
--- a/gdbserver/linux-low.h
+++ b/gdbserver/linux-low.h
@@ -131,9 +131,6 @@  struct lwp_info;
 
 struct linux_target_ops
 {
-  int (*stopped_by_watchpoint) (void);
-  CORE_ADDR (*stopped_data_address) (void);
-
   /* Hooks to reformat register data for PEEKUSR/POKEUSR (in particular
      for registers smaller than an xfer unit).  */
   void (*collect_ptrace_register) (struct regcache *regcache,
@@ -624,6 +621,22 @@  class linux_process_target : public process_stratum_target
   /* Install breakpoints for software single stepping.  */
   void install_software_single_step_breakpoints (lwp_info *lwp);
 
+  /* Fetch the possibly triggered data watchpoint info and store it in
+     CHILD.
+
+     On some archs, like x86, that use debug registers to set
+     watchpoints, it's possible that the way to know which watched
+     address trapped, is to check the register that is used to select
+     which address to watch.  Problem is, between setting the watchpoint
+     and reading back which data address trapped, the user may change
+     the set of watchpoints, and, as a consequence, GDB changes the
+     debug registers in the inferior.  To avoid reading back a stale
+     stopped-data-address when that happens, we cache in LP the fact
+     that a watchpoint trapped, and the corresponding data address, as
+     soon as we see CHILD stop with a SIGTRAP.  If GDB changes the debug
+     registers meanwhile, we have the cached data we can rely on.  */
+  bool check_stopped_by_watchpoint (lwp_info *child);
+
 protected:
   /* The architecture-specific "low" methods are listed below.  */
 
@@ -667,6 +680,10 @@  class linux_process_target : public process_stratum_target
   virtual int low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
 				int size, raw_breakpoint *bp);
 
+  virtual bool low_stopped_by_watchpoint ();
+
+  virtual CORE_ADDR low_stopped_data_address ();
+
   /* How many bytes the PC should be decremented after a break.  */
   int m_decr_pc_after_break;
 };
diff --git a/gdbserver/linux-m32r-low.cc b/gdbserver/linux-m32r-low.cc
index ce82fc9e186..9f3b8743476 100644
--- a/gdbserver/linux-m32r-low.cc
+++ b/gdbserver/linux-m32r-low.cc
@@ -163,8 +163,6 @@  m32r_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* stopped_by_watchpoint */
-  NULL, /* stopped_data_address */
   NULL, /* collect_ptrace_register */
   NULL, /* supply_ptrace_register */
   NULL, /* siginfo_fixup */
diff --git a/gdbserver/linux-m68k-low.cc b/gdbserver/linux-m68k-low.cc
index 43ba1f2559f..64937149ed6 100644
--- a/gdbserver/linux-m68k-low.cc
+++ b/gdbserver/linux-m68k-low.cc
@@ -259,8 +259,6 @@  m68k_supports_hardware_single_step (void)
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* stopped_by_watchpoint */
-  NULL, /* stopped_data_address */
   NULL, /* collect_ptrace_register */
   NULL, /* supply_ptrace_register */
   NULL, /* siginfo_fixup */
diff --git a/gdbserver/linux-mips-low.cc b/gdbserver/linux-mips-low.cc
index 4823f69ea5d..c39b81d0cb7 100644
--- a/gdbserver/linux-mips-low.cc
+++ b/gdbserver/linux-mips-low.cc
@@ -62,6 +62,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.  */
@@ -610,12 +614,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;
@@ -634,16 +638,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;
@@ -978,8 +982,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 */
diff --git a/gdbserver/linux-ppc-low.cc b/gdbserver/linux-ppc-low.cc
index 0fa9de8e72f..f0f10570842 100644
--- a/gdbserver/linux-ppc-low.cc
+++ b/gdbserver/linux-ppc-low.cc
@@ -3418,8 +3418,6 @@  ppc_get_ipa_tdesc_idx (void)
 }
 
 struct linux_target_ops the_low_target = {
-  NULL,
-  NULL,
   ppc_collect_ptrace_register,
   ppc_supply_ptrace_register,
   NULL, /* siginfo_fixup */
diff --git a/gdbserver/linux-s390-low.cc b/gdbserver/linux-s390-low.cc
index 264fbe50475..79a597c1e4a 100644
--- a/gdbserver/linux-s390-low.cc
+++ b/gdbserver/linux-s390-low.cc
@@ -2832,8 +2832,6 @@  s390_emit_ops (void)
 }
 
 struct linux_target_ops the_low_target = {
-  NULL,
-  NULL,
   s390_collect_ptrace_register,
   s390_supply_ptrace_register,
   NULL, /* siginfo_fixup */
diff --git a/gdbserver/linux-sh-low.cc b/gdbserver/linux-sh-low.cc
index 1afd1f61366..6af90b150a1 100644
--- a/gdbserver/linux-sh-low.cc
+++ b/gdbserver/linux-sh-low.cc
@@ -194,8 +194,6 @@  sh_target::low_arch_setup ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* stopped_by_watchpoint */
-  NULL, /* stopped_data_address */
   NULL, /* collect_ptrace_register */
   NULL, /* supply_ptrace_register */
   NULL, /* siginfo_fixup */
diff --git a/gdbserver/linux-sparc-low.cc b/gdbserver/linux-sparc-low.cc
index 810fcf486b2..b0b21b51269 100644
--- a/gdbserver/linux-sparc-low.cc
+++ b/gdbserver/linux-sparc-low.cc
@@ -343,7 +343,6 @@  sparc_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, NULL,
   NULL, NULL
 };
 
diff --git a/gdbserver/linux-tic6x-low.cc b/gdbserver/linux-tic6x-low.cc
index e6b66d57656..3abbb27a548 100644
--- a/gdbserver/linux-tic6x-low.cc
+++ b/gdbserver/linux-tic6x-low.cc
@@ -425,8 +425,6 @@  tic6x_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* stopped_by_watchpoint */
-  NULL, /* stopped_data_address */
   NULL, /* collect_ptrace_register */
   NULL, /* supply_ptrace_register */
   NULL, /* siginfo_fixup */
diff --git a/gdbserver/linux-tile-low.cc b/gdbserver/linux-tile-low.cc
index 534cbf13e9b..bcb7a495f70 100644
--- a/gdbserver/linux-tile-low.cc
+++ b/gdbserver/linux-tile-low.cc
@@ -226,8 +226,6 @@  tile_supports_hardware_single_step (void)
 
 struct linux_target_ops the_low_target =
 {
-  NULL, /* stopped_by_watchpoint */
-  NULL, /* stopped_data_address */
   NULL, /* collect_ptrace_register */
   NULL, /* supply_ptrace_register */
   NULL, /* siginfo_fixup */
diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc
index f3541d923b9..207d906a6fd 100644
--- a/gdbserver/linux-x86-low.cc
+++ b/gdbserver/linux-x86-low.cc
@@ -133,6 +133,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.  */
@@ -654,15 +658,15 @@  x86_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
     }
 }
 
-static int
-x86_stopped_by_watchpoint (void)
+bool
+x86_target::low_stopped_by_watchpoint ()
 {
   struct process_info *proc = current_process ();
   return x86_dr_stopped_by_watchpoint (&proc->priv->arch_private->debug_reg_state);
 }
 
-static CORE_ADDR
-x86_stopped_data_address (void)
+CORE_ADDR
+x86_target::low_stopped_data_address ()
 {
   struct process_info *proc = current_process ();
   CORE_ADDR addr;
@@ -2911,8 +2915,6 @@  x86_get_ipa_tdesc_idx (void)
 
 struct linux_target_ops the_low_target =
 {
-  x86_stopped_by_watchpoint,
-  x86_stopped_data_address,
   /* collect_ptrace_register/supply_ptrace_register are not needed in the
      native i386 case (no registers smaller than an xfer unit), and are not
      used in the biarch case (HAVE_LINUX_USRREGS is not defined).  */
diff --git a/gdbserver/linux-xtensa-low.cc b/gdbserver/linux-xtensa-low.cc
index 7755f42e7d2..42a1912881d 100644
--- a/gdbserver/linux-xtensa-low.cc
+++ b/gdbserver/linux-xtensa-low.cc
@@ -331,8 +331,6 @@  xtensa_target::get_regs_info ()
 }
 
 struct linux_target_ops the_low_target = {
-  NULL, /* stopped_by_watchpoint */
-  NULL, /* stopped_data_address */
   NULL, /* collect_ptrace_register */
   NULL, /* supply_ptrace_register */
   NULL, /* siginfo_fixup */