[PATCH 2/2] Disabling hardware single step in gdbserver

Tom Tromey tromey@adacore.com
Mon Jun 12 19:21:37 GMT 2023


This patch gives gdbserver the ability to omit the 's' reply to
'vCont?'.  This tells gdb that hardware single-step is definitely not
supported, causing it to fall back to using software single-step.
This is useful for testing the earlier change to
maybe_software_singlestep.
---
 gdbserver/server.cc | 12 ++++++++----
 gdbserver/server.h  |  1 +
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/gdbserver/server.cc b/gdbserver/server.cc
index c57270175b4..afc18a87770 100644
--- a/gdbserver/server.cc
+++ b/gdbserver/server.cc
@@ -135,6 +135,7 @@ unsigned long signal_pid;
    in gdbserver, for the sake of testing GDB against stubs that don't
    support them.  */
 bool disable_packet_vCont;
+bool disable_packet_vCont_step;
 bool disable_packet_Tthread;
 bool disable_packet_qC;
 bool disable_packet_qfThreadInfo;
@@ -3125,9 +3126,10 @@ handle_v_requests (char *own_buf, int packet_len, int *new_packet_len)
 	{
 	  strcpy (own_buf, "vCont;c;C;t");
 
-	  if (target_supports_hardware_single_step ()
-	      || target_supports_software_single_step ()
-	      || !cs.vCont_supported)
+	  if (!disable_packet_vCont_step
+	      && (target_supports_hardware_single_step ()
+		  || target_supports_software_single_step ()
+		  || !cs.vCont_supported))
 	    {
 	      /* If target supports single step either by hardware or by
 		 software, add actions s and S to the list of supported
@@ -3456,7 +3458,7 @@ gdbserver_usage (FILE *stream)
 	   "  --disable-packet=OPT1[,OPT2,...]\n"
 	   "                        Disable support for RSP packets or features.\n"
 	   "                          Options:\n"
-	   "                            vCont, T, Tthread, qC, qfThreadInfo and \n"
+	   "                            vCont, vConts, T, Tthread, qC, qfThreadInfo and\n"
 	   "                            threads (disable all threading packets).\n"
 	   "\n"
 	   "For more information, consult the GDB manual (available as on-line \n"
@@ -3766,6 +3768,8 @@ captured_main (int argc, char *argv[])
 	    {
 	      if (strcmp ("vCont", tok) == 0)
 		disable_packet_vCont = true;
+	      else if (strcmp ("vConts", tok) == 0)
+		disable_packet_vCont_step = true;
 	      else if (strcmp ("Tthread", tok) == 0)
 		disable_packet_Tthread = true;
 	      else if (strcmp ("qC", tok) == 0)
diff --git a/gdbserver/server.h b/gdbserver/server.h
index fde7dfe7060..70fd8ff8b55 100644
--- a/gdbserver/server.h
+++ b/gdbserver/server.h
@@ -68,6 +68,7 @@ void initialize_low ();
 extern bool server_waiting;
 
 extern bool disable_packet_vCont;
+extern bool disable_packet_vCont_step;
 extern bool disable_packet_Tthread;
 extern bool disable_packet_qC;
 extern bool disable_packet_qfThreadInfo;

-- 
2.40.1



More information about the Gdb-patches mailing list