aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
diff options
context:
space:
mode:
authorMichał Górny <mgorny@moritz.systems>2022-06-30 07:58:12 +0200
committerMichał Górny <mgorny@moritz.systems>2022-07-15 18:33:58 +0200
commitab9f1e88fd8a73a32914c18a52868d3a4b9e509e (patch)
tree64e846e234fa5c267f74426a5f0ebb5f81da6c78 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
parent81e993f08d6cd8d1658e3843594449b6fa622a4f (diff)
downloadllvm-ab9f1e88fd8a73a32914c18a52868d3a4b9e509e.zip
llvm-ab9f1e88fd8a73a32914c18a52868d3a4b9e509e.tar.gz
llvm-ab9f1e88fd8a73a32914c18a52868d3a4b9e509e.tar.bz2
[lldb] [llgs] Fix `?` packet response for running threads
Fix the response to `?` packet for threads that are running at the time (in non-stop mode). The previous code would wrongly send or queue an empty response for them. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.llvm.org/D128879
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 49f37ba..1bc9465 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -1025,9 +1025,11 @@ void GDBRemoteCommunicationServerLLGS::EnqueueStopReplyPackets(
return;
for (NativeThreadProtocol &listed_thread : m_current_process->Threads()) {
- if (listed_thread.GetID() != thread_to_skip)
- m_stop_notification_queue.push_back(
- PrepareStopReplyPacketForThread(listed_thread).GetString().str());
+ if (listed_thread.GetID() != thread_to_skip) {
+ StreamString stop_reply = PrepareStopReplyPacketForThread(listed_thread);
+ if (!stop_reply.Empty())
+ m_stop_notification_queue.push_back(stop_reply.GetString().str());
+ }
}
}
@@ -1885,9 +1887,11 @@ GDBRemoteCommunicationServerLLGS::Handle_stop_reason(
// the current thread (for clients that don't actually support multiple
// stop reasons).
NativeThreadProtocol *thread = m_current_process->GetCurrentThread();
- if (thread)
- m_stop_notification_queue.push_back(
- PrepareStopReplyPacketForThread(*thread).GetString().str());
+ if (thread) {
+ StreamString stop_reply = PrepareStopReplyPacketForThread(*thread);
+ if (!stop_reply.Empty())
+ m_stop_notification_queue.push_back(stop_reply.GetString().str());
+ }
EnqueueStopReplyPackets(thread ? thread->GetID()
: LLDB_INVALID_THREAD_ID);
}