[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
This commit is contained in:
parent
81e993f08d
commit
ab9f1e88fd
|
@ -1025,9 +1025,11 @@ void GDBRemoteCommunicationServerLLGS::EnqueueStopReplyPackets(
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (NativeThreadProtocol &listed_thread : m_current_process->Threads()) {
|
for (NativeThreadProtocol &listed_thread : m_current_process->Threads()) {
|
||||||
if (listed_thread.GetID() != thread_to_skip)
|
if (listed_thread.GetID() != thread_to_skip) {
|
||||||
m_stop_notification_queue.push_back(
|
StreamString stop_reply = PrepareStopReplyPacketForThread(listed_thread);
|
||||||
PrepareStopReplyPacketForThread(listed_thread).GetString().str());
|
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
|
// the current thread (for clients that don't actually support multiple
|
||||||
// stop reasons).
|
// stop reasons).
|
||||||
NativeThreadProtocol *thread = m_current_process->GetCurrentThread();
|
NativeThreadProtocol *thread = m_current_process->GetCurrentThread();
|
||||||
if (thread)
|
if (thread) {
|
||||||
m_stop_notification_queue.push_back(
|
StreamString stop_reply = PrepareStopReplyPacketForThread(*thread);
|
||||||
PrepareStopReplyPacketForThread(*thread).GetString().str());
|
if (!stop_reply.Empty())
|
||||||
|
m_stop_notification_queue.push_back(stop_reply.GetString().str());
|
||||||
|
}
|
||||||
EnqueueStopReplyPackets(thread ? thread->GetID()
|
EnqueueStopReplyPackets(thread ? thread->GetID()
|
||||||
: LLDB_INVALID_THREAD_ID);
|
: LLDB_INVALID_THREAD_ID);
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,3 +341,23 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase):
|
||||||
"send packet: $OK#00",
|
"send packet: $OK#00",
|
||||||
], True)
|
], True)
|
||||||
self.expect_gdbremote_sequence()
|
self.expect_gdbremote_sequence()
|
||||||
|
|
||||||
|
@add_test_categories(["llgs"])
|
||||||
|
def test_stop_reason_while_running(self):
|
||||||
|
self.build()
|
||||||
|
self.set_inferior_startup_launch()
|
||||||
|
procs = self.prep_debug_monitor_and_inferior(
|
||||||
|
inferior_args=["thread:new", "thread:new", "stop", "sleep:15"])
|
||||||
|
self.test_sequence.add_log_lines(
|
||||||
|
["read packet: $QNonStop:1#00",
|
||||||
|
"send packet: $OK#00",
|
||||||
|
# stop is used to synchronize starting threads
|
||||||
|
"read packet: $c#63",
|
||||||
|
"send packet: $OK#00",
|
||||||
|
{"direction": "send", "regex": "%Stop:T.*"},
|
||||||
|
"read packet: $c#63",
|
||||||
|
"send packet: $OK#00",
|
||||||
|
"read packet: $?#00",
|
||||||
|
"send packet: $OK#00",
|
||||||
|
], True)
|
||||||
|
self.expect_gdbremote_sequence()
|
||||||
|
|
Loading…
Reference in a new issue