[gdbserver] Rename supports_conditional_breakpoints to supports_hardware_single_step
authorYao Qi <yao.qi@linaro.org>
Tue, 15 Sep 2015 13:09:18 +0000 (14:09 +0100)
committerYao Qi <yao.qi@linaro.org>
Tue, 15 Sep 2015 13:09:18 +0000 (14:09 +0100)
In my patch https://sourceware.org/ml/gdb-patches/2015-04/msg01110.html
a new target_ops hook supports_conditional_breakpoints was added to
disable conditional breakpoints if target doesn't have hardware single
step.  This patch is to generalize this hook from
supports_conditional_breakpoints to supports_hardware_single_step,
so that the following patch can use it.

gdb/gdbserver:

2015-09-15  Yao Qi  <yao.qi@linaro.org>

* linux-low.c (linux_supports_conditional_breakpoints): Rename
it to ...
(linux_supports_hardware_single_step): ... New function.
(linux_target_ops): Update.
* lynx-low.c (lynx_target_ops): Set field
supports_hardware_single_step to target_can_do_hardware_single_step.
* nto-low.c (nto_target_ops): Likewise.
* spu-low.c (spu_target_ops): Likewise.
* win32-low.c (win32_target_ops): Likewise.
* target.c (target_can_do_hardware_single_step): New function.
* target.h (struct target_ops) <supports_conditional_breakpoints>:
Remove.  <supports_hardware_single_step>: New field.
(target_supports_conditional_breakpoints): Remove.
(target_supports_hardware_single_step): New macro.
(target_can_do_hardware_single_step): Declare.
* server.c (handle_query): Use target_supports_hardware_single_step
instead of target_supports_conditional_breakpoints.

gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-low.c
gdb/gdbserver/lynx-low.c
gdb/gdbserver/nto-low.c
gdb/gdbserver/server.c
gdb/gdbserver/spu-low.c
gdb/gdbserver/target.c
gdb/gdbserver/target.h
gdb/gdbserver/win32-low.c

index 25c01ff98e9db31a5bc0cf9305a5d84828d86db2..7831b858f986deac46d9a6ac647e4ed5e057cc2e 100644 (file)
@@ -1,3 +1,23 @@
+2015-09-15  Yao Qi  <yao.qi@linaro.org>
+
+       * linux-low.c (linux_supports_conditional_breakpoints): Rename
+       it to ...
+       (linux_supports_hardware_single_step): ... New function.
+       (linux_target_ops): Update.
+       * lynx-low.c (lynx_target_ops): Set field
+       supports_hardware_single_step to target_can_do_hardware_single_step.
+       * nto-low.c (nto_target_ops): Likewise.
+       * spu-low.c (spu_target_ops): Likewise.
+       * win32-low.c (win32_target_ops): Likewise.
+       * target.c (target_can_do_hardware_single_step): New function.
+       * target.h (struct target_ops) <supports_conditional_breakpoints>:
+       Remove.  <supports_hardware_single_step>: New field.
+       (target_supports_conditional_breakpoints): Remove.
+       (target_supports_hardware_single_step): New macro.
+       (target_can_do_hardware_single_step): Declare.
+       * server.c (handle_query): Use target_supports_hardware_single_step
+       instead of target_supports_conditional_breakpoints.
+
 2015-09-15  Yao Qi  <yao.qi@linaro.org>
 
        * linux-aarch64-low.c (aarch64_linux_siginfo_fixup): New
index aa4c86884319ed7551926fcf09f4c09204d66536..f5b64ab254aba278fa3a184a14c8647b3d5d3bd3 100644 (file)
@@ -5614,16 +5614,11 @@ linux_supports_stopped_by_hw_breakpoint (void)
   return USE_SIGTRAP_SIGINFO;
 }
 
-/* Implement the supports_conditional_breakpoints target_ops
-   method.  */
+/* Implement the supports_hardware_single_step target_ops method.  */
 
 static int
-linux_supports_conditional_breakpoints (void)
+linux_supports_hardware_single_step (void)
 {
-  /* GDBserver needs to step over the breakpoint if the condition is
-     false.  GDBserver software single step is too simple, so disable
-     conditional breakpoints if the target doesn't have hardware single
-     step.  */
   return can_hardware_single_step ();
 }
 
@@ -6964,7 +6959,7 @@ static struct target_ops linux_target_ops = {
   linux_supports_stopped_by_sw_breakpoint,
   linux_stopped_by_hw_breakpoint,
   linux_supports_stopped_by_hw_breakpoint,
-  linux_supports_conditional_breakpoints,
+  linux_supports_hardware_single_step,
   linux_stopped_by_watchpoint,
   linux_stopped_data_address,
 #if defined(__UCLIBC__) && defined(HAS_NOMMU)        \
index b722930bfc4d950475a5e637f7489761db010035..0582399bdc2225380e600a700928adc65a74e924 100644 (file)
@@ -747,10 +747,7 @@ static struct target_ops lynx_target_ops = {
   NULL,  /* supports_stopped_by_sw_breakpoint */
   NULL,  /* stopped_by_hw_breakpoint */
   NULL,  /* supports_stopped_by_hw_breakpoint */
-  /* Although lynx has hardware single step, still disable this
-     feature for lynx, because it is implemented in linux-low.c instead
-     of in generic code.  */
-  NULL,  /* supports_conditional_breakpoints */
+  target_can_do_hardware_single_step,
   NULL,  /* stopped_by_watchpoint */
   NULL,  /* stopped_data_address */
   NULL,  /* read_offsets */
index 19f492ff7701e92bf0991611a7f99ff37413b3a1..fa216a995b0678fa4182cd9517e50f073bfb6b95 100644 (file)
@@ -950,10 +950,7 @@ static struct target_ops nto_target_ops = {
   NULL, /* supports_stopped_by_sw_breakpoint */
   NULL, /* stopped_by_hw_breakpoint */
   NULL, /* supports_stopped_by_hw_breakpoint */
-  /* Although nto has hardware single step, still disable this
-     feature for not, because it is implemented in linux-low.c instead
-     of in generic code.  */
-  NULL, /* supports_conditional_breakpoints */
+  target_can_do_hardware_single_step,
   nto_stopped_by_watchpoint,
   nto_stopped_data_address,
   NULL, /* nto_read_offsets */
index 9aa8a3f799a0c6b5ad0b3584d8e6cbb68f2cef8e..1481c47dc417e2256835971efe67eb8cb7248430 100644 (file)
@@ -2202,9 +2202,15 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
          strcat (own_buf, ";tracenz+");
        }
 
-      /* Support target-side breakpoint conditions and commands.  */
-      if (target_supports_conditional_breakpoints ())
-       strcat (own_buf, ";ConditionalBreakpoints+");
+      if (target_supports_hardware_single_step ())
+       {
+         /* Support target-side breakpoint conditions and commands.
+            GDBserver needs to step over the breakpoint if the condition
+            is false.  GDBserver software single step is too simple, so
+            disable conditional breakpoints if the target doesn't have
+            hardware single step.  */
+         strcat (own_buf, ";ConditionalBreakpoints+");
+       }
       strcat (own_buf, ";BreakpointCommands+");
 
       if (target_supports_agent ())
index 878ed82cf0e34ec5a688f75bb7518f5b74804ce6..074417aa58bafb6ded719546cdbe91b98d1ed4de 100644 (file)
@@ -666,7 +666,7 @@ static struct target_ops spu_target_ops = {
   NULL, /* supports_stopped_by_sw_breakpoint */
   NULL, /* stopped_by_hw_breakpoint */
   NULL, /* supports_stopped_by_hw_breakpoint */
-  NULL, /* supports_conditional_breakpoints */
+  NULL, /* supports_hardware_single_step */
   NULL,
   NULL,
   NULL,
index 7540f2f5c9ca21deb52a8af35fefacc4a0abeecf..17ff7a67cae3c07b80f3620ff9e635af72540034 100644 (file)
@@ -216,3 +216,11 @@ kill_inferior (int pid)
 
   return (*the_target->kill) (pid);
 }
+
+/* Target can do hardware single step.  */
+
+int
+target_can_do_hardware_single_step (void)
+{
+  return 1;
+}
index aea3d1549977233a9ae3d103e4ba45ff1cf2568a..a2842b41cc41dea5d5684a7766b9a799f3e15f18 100644 (file)
@@ -225,9 +225,8 @@ struct target_ops
      HW breakpoint triggering.  */
   int (*supports_stopped_by_hw_breakpoint) (void);
 
-  /* Returns true if the target can evaluate conditions of
-     breakpoints.  */
-  int (*supports_conditional_breakpoints) (void);
+  /* Returns true if the target can do hardware single step.  */
+  int (*supports_hardware_single_step) (void);
 
   /* Returns 1 if target was stopped due to a watchpoint hit, 0 otherwise.  */
 
@@ -616,9 +615,9 @@ int kill_inferior (int);
   (the_target->supports_stopped_by_hw_breakpoint ? \
    (*the_target->supports_stopped_by_hw_breakpoint) () : 0)
 
-#define target_supports_conditional_breakpoints() \
-  (the_target->supports_conditional_breakpoints ? \
-   (*the_target->supports_conditional_breakpoints) () : 0)
+#define target_supports_hardware_single_step() \
+  (the_target->supports_hardware_single_step ? \
+   (*the_target->supports_hardware_single_step) () : 0)
 
 #define target_stopped_by_hw_breakpoint() \
   (the_target->stopped_by_hw_breakpoint ? \
@@ -656,4 +655,6 @@ int set_desired_thread (int id);
 
 const char *target_pid_to_str (ptid_t);
 
+int target_can_do_hardware_single_step (void);
+
 #endif /* TARGET_H */
index 85cc040584058a8c15d3f732c481b50c3aa2b098..550a8e91aedb5d7acfc7f646d01fbe90b2df932e 100644 (file)
@@ -1810,10 +1810,7 @@ static struct target_ops win32_target_ops = {
   NULL, /* supports_stopped_by_sw_breakpoint */
   NULL, /* stopped_by_hw_breakpoint */
   NULL, /* supports_stopped_by_hw_breakpoint */
-  /* Although win32-i386 has hardware single step, still disable this
-     feature for win32, because it is implemented in linux-low.c instead
-     of in generic code.  */
-  NULL, /* supports_conditional_breakpoints */
+  target_can_do_hardware_single_step,
   win32_stopped_by_watchpoint,
   win32_stopped_data_address,
   NULL, /* read_offsets */