From 1b34c1e50db8536d54c039d8251359571a753d63 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 7 Jun 2023 09:32:46 -0600 Subject: [PATCH] Disabling hardware single step in gdbserver 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. Approved-By: Andrew Burgess --- 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 4037b1cd314..673b784e42b 100644 --- a/gdbserver/server.cc +++ b/gdbserver/server.cc @@ -143,6 +143,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; @@ -3538,9 +3539,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 @@ -3873,7 +3875,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" @@ -4293,6 +4295,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 5609584f716..b9dacb823bc 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.47.2