[Lldb-commits] [lldb] 261d003 - [lldb] [llgs] Fix premature server exit if multiprocess+nonstop
Michał Górny via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 28 12:49:27 PDT 2022
Author: Michał Górny
Date: 2022-06-28T21:49:17+02:00
New Revision: 261d0033500eaa281b74c9d54ae240257a0ea00c
URL: https://github.com/llvm/llvm-project/commit/261d0033500eaa281b74c9d54ae240257a0ea00c
DIFF: https://github.com/llvm/llvm-project/commit/261d0033500eaa281b74c9d54ae240257a0ea00c.diff
LOG: [lldb] [llgs] Fix premature server exit if multiprocess+nonstop
Fix lldb-server in the non-stop + multiprocess mode to exit on vStopped
only if all processes have exited, rather than when the first one exits.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128639
Added:
Modified:
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
Removed:
################################################################################
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 49125f91d743a..63174ef552196 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -3860,9 +3860,9 @@ GDBRemoteCommunicationServerLLGS::Handle_vStopped(
m_stop_notification_queue.pop_front();
if (!m_stop_notification_queue.empty())
return SendPacketNoLock(m_stop_notification_queue.front());
- // If this was the last notification and the process exited, terminate
- // the server.
- if (m_inferior_prev_state == eStateExited) {
+ // If this was the last notification and all the processes exited,
+ // terminate the server.
+ if (m_debugged_processes.empty()) {
m_exit_now = true;
m_mainloop.RequestTermination();
}
diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
index 8b8e30c9b7379..c58f0fc381ebb 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
@@ -392,17 +392,17 @@ def test_vkill_both(self):
def test_vkill_both_nonstop(self):
self.vkill_test(kill_parent=True, kill_child=True, nonstop=True)
- def resume_one_test(self, run_order, use_vCont=False):
+ def resume_one_test(self, run_order, use_vCont=False, nonstop=False):
parent_pid, parent_tid, child_pid, child_tid = (
- self.start_fork_test(["fork", "trap"]))
+ self.start_fork_test(["fork", "trap"], nonstop=nonstop))
parent_expect = [
- "[$]T05thread:p{}.{};.*".format(parent_pid, parent_tid),
- "[$]W00;process:{}#.*".format(parent_pid),
+ "T05thread:p{}.{};.*".format(parent_pid, parent_tid),
+ "W00;process:{}#.*".format(parent_pid),
]
child_expect = [
- "[$]T05thread:p{}.{};.*".format(child_pid, child_tid),
- "[$]W00;process:{}#.*".format(child_pid),
+ "T05thread:p{}.{};.*".format(child_pid, child_tid),
+ "W00;process:{}#.*".format(child_pid),
]
for x in run_order:
@@ -427,9 +427,17 @@ def resume_one_test(self, run_order, use_vCont=False):
"send packet: $OK#00",
"read packet: $c#00",
], True)
- self.test_sequence.add_log_lines([
- {"direction": "send", "regex": expect},
- ], True)
+ if nonstop:
+ self.test_sequence.add_log_lines([
+ "send packet: $OK#00",
+ {"direction": "send", "regex": "%Stop:" + expect},
+ "read packet: $vStopped#00",
+ "send packet: $OK#00",
+ ], True)
+ else:
+ self.test_sequence.add_log_lines([
+ {"direction": "send", "regex": "[$]" + expect},
+ ], True)
# if at least one process remained, check both PIDs
if parent_expect or child_expect:
self.test_sequence.add_log_lines([
@@ -475,6 +483,14 @@ def test_c_child_then_parent(self):
def test_c_interspersed(self):
self.resume_one_test(run_order=["parent", "child", "parent", "child"])
+ @expectedFailureAll(archs=["arm"]) # TODO
+ @expectedFailureAll(archs=["aarch64"],
+ bugnumber="https://github.com/llvm/llvm-project/issues/56268")
+ @add_test_categories(["fork"])
+ def test_c_interspersed_nonstop(self):
+ self.resume_one_test(run_order=["parent", "child", "parent", "child"],
+ nonstop=True)
+
@expectedFailureAll(archs=["arm"]) # TODO
@expectedFailureAll(archs=["aarch64"],
bugnumber="https://github.com/llvm/llvm-project/issues/56268")
@@ -513,6 +529,14 @@ def test_vCont_interspersed(self):
self.resume_one_test(run_order=["parent", "child", "parent", "child"],
use_vCont=True)
+ @expectedFailureAll(archs=["arm"]) # TODO
+ @expectedFailureAll(archs=["aarch64"],
+ bugnumber="https://github.com/llvm/llvm-project/issues/56268")
+ @add_test_categories(["fork"])
+ def test_vCont_interspersed_nonstop(self):
+ self.resume_one_test(run_order=["parent", "child", "parent", "child"],
+ use_vCont=True, nonstop=True)
+
@add_test_categories(["fork"])
def test_vCont_two_processes(self):
parent_pid, parent_tid, child_pid, child_tid = (
More information about the lldb-commits
mailing list