gdbserver/linux-low: turn watchpoint ops into methods
[deliverable/binutils-gdb.git] / gdbserver / linux-low.h
index 2202a6582254ec281fa23f835898765706483d0e..ee2fdb8e865b93e4658e6001cdfeccd226a8b000 100644 (file)
@@ -131,20 +131,6 @@ struct lwp_info;
 
 struct linux_target_ops
 {
-  int decr_pc_after_break;
-  int (*breakpoint_at) (CORE_ADDR pc);
-
-  /* Breakpoint and watchpoint related functions.  See target.h for
-     comments.  */
-  int (*supports_z_point_type) (char z_type);
-  int (*insert_point) (enum raw_bkpt_type type, CORE_ADDR addr,
-                      int size, struct raw_breakpoint *bp);
-  int (*remove_point) (enum raw_bkpt_type type, CORE_ADDR addr,
-                      int size, struct raw_breakpoint *bp);
-
-  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,
@@ -282,8 +268,6 @@ public:
   int read_auxv (CORE_ADDR offset, unsigned char *myaddr,
                 unsigned int len) override;
 
-  bool supports_z_point_type (char z_type) override;
-
   int insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
                    int size, raw_breakpoint *bp) override;
 
@@ -635,6 +619,22 @@ private:
   /* 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.  */
 
@@ -666,6 +666,24 @@ protected:
      Targets that override this method should also override
      'supports_software_single_step' to return true.  */
   virtual std::vector<CORE_ADDR> low_get_next_pcs (regcache *regcache);
+
+  /* Return true if there is a breakpoint at PC.  */
+  virtual bool low_breakpoint_at (CORE_ADDR pc) = 0;
+
+  /* Breakpoint and watchpoint related functions.  See target.h for
+     comments.  */
+  virtual int low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
+                               int size, raw_breakpoint *bp);
+
+  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.  */
+  virtual int low_decr_pc_after_break ();
 };
 
 extern linux_process_target *the_linux_target;
This page took 0.041581 seconds and 4 git commands to generate.