aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2022-07-04 16:43:06 +0100
committerPedro Alves <pedro@palves.net>2022-12-05 13:38:07 +0000
commit69ab09e83b1a0d9108c0151dacbc12851ba9cb27 (patch)
tree02ea5429988fc905b8430a2ed5791de281298749
parent9da4b393c57cd129848b1a0fb5bc83b8473662e7 (diff)
downloadgdb-69ab09e83b1a0d9108c0151dacbc12851ba9cb27.zip
gdb-69ab09e83b1a0d9108c0151dacbc12851ba9cb27.tar.gz
gdb-69ab09e83b1a0d9108c0151dacbc12851ba9cb27.tar.bz2
Avoid duplicate QThreadEvents packets
Similarly to QProgramSignals and QPassSignals, avoid sending duplicate QThreadEvents packets. Change-Id: Iaf5babb0b64e1527ba4db31aac8674d82b17e8b4
-rw-r--r--gdb/remote.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gdb/remote.c b/gdb/remote.c
index a7430eb..41348a6 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -314,6 +314,10 @@ public: /* data */
the target know about program signals list changes. */
char *last_program_signals_packet = nullptr;
+ /* Similarly, the last QThreadEvents state we sent to the
+ target. */
+ bool last_thread_events = false;
+
gdb_signal last_sent_signal = GDB_SIGNAL_0;
bool last_sent_step = false;
@@ -14507,6 +14511,9 @@ remote_target::thread_events (int enable)
if (packet_support (PACKET_QThreadEvents) == PACKET_DISABLE)
return;
+ if (rs->last_thread_events == enable)
+ return;
+
xsnprintf (rs->buf.data (), size, "QThreadEvents:%x", enable ? 1 : 0);
putpkt (rs->buf);
getpkt (&rs->buf, 0);
@@ -14517,6 +14524,7 @@ remote_target::thread_events (int enable)
case PACKET_OK:
if (strcmp (rs->buf.data (), "OK") != 0)
error (_("Remote refused setting thread events: %s"), rs->buf.data ());
+ rs->last_thread_events = enable;
break;
case PACKET_ERROR:
warning (_("Remote failure reply: %s"), rs->buf.data ());