[10/11] Reply s and S vCont actions if target supports hardware single step

Message ID 1435759111-22856-11-git-send-email-yao.qi@linaro.org
State New, archived
Headers

Commit Message

Yao Qi July 1, 2015, 1:58 p.m. UTC
  Nowadays, GDBserver reports vCont s and S actions are supported
unconditionally in vCont? reply, which isn't accurate.

This patch is to teach GDBserver to tell GDB that whether GDBserver can
do hardware single step by reporting s and S in the vCont? reply, if
GDBserver knows it supports hardware single step.

gdb/gdbserver:

2015-06-30  Yao Qi  <yao.qi@linaro.org>

	* server.c (handle_v_requests): Append ";s;S" to own_buf if
	target_supports_hardware_single_step returns true.
---
 gdb/gdbserver/server.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
  

Patch

diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 858fbe5..e5a8f06 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -2766,7 +2766,14 @@  handle_v_requests (char *own_buf, int packet_len, int *new_packet_len)
 
       if (startswith (own_buf, "vCont?"))
 	{
-	  strcpy (own_buf, "vCont;c;C;s;S;t");
+	  strcpy (own_buf, "vCont;c;C;t");
+	  if (target_supports_hardware_single_step ())
+	    {
+	      /* Only return s;S if target supports hardware single
+		 step.  */
+	      own_buf = own_buf + strlen (own_buf);
+	      strcpy (own_buf, ";s;S");
+	    }
 	  if (target_supports_range_stepping ())
 	    {
 	      own_buf = own_buf + strlen (own_buf);