================
@@ -0,0 +1,206 @@
+"""
+Test lldb-dap sends only a single stopped event when multiple threads
+stop simultaneously. This prevents VS Code race conditions where it
+cancels stack trace requests for the focus thread.
+
+Test cases:
+1. Multiple threads hit breakpoint simultaneously - only ONE stopped event.
+2. Focus thread exits - new valid focus thread selected.
+3. All threads visible via allThreadsStopped=true.
+"""
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+import lldbdap_testcase
+
+
+class TestDAP_stopEventSingle(lldbdap_testcase.DAPTestCaseBase):
+ @skipIfWindows
+ def test_single_stopped_event_multiple_threads(self):
+ """
+ Tests that when multiple threads hit a breakpoint simultaneously,
+ only a single stopped event is sent to VS Code.
+ """
+ program = self.getBuildArtifact("a.out")
+ self.build_and_launch(program)
+ source = "main.cpp"
+
+ # Set breakpoint where all threads will stop.
+ bp_line = line_number(source, "// break here")
+ breakpoint_ids = self.set_source_breakpoints(source, [bp_line])
+ self.assertEqual(len(breakpoint_ids), 1, "expect one breakpoint")
+
+ # Continue - all threads should hit breakpoint.
+ self.continue_to_breakpoints(breakpoint_ids)
+
+ # Should have 5 threads: main + 4 workers.
+ threads = self.dap_server.get_threads()
----------------
clayborg wrote:
Do we verify that we have at least two threads that are stopped with a reason
anywhere? That will be important here to ensure this test is doing the right
thing. This kind of test can also be a bit flaky when it is run on a machine
that is running many tests concurrently, so I worry about how solid this test
will be.
https://github.com/llvm/llvm-project/pull/176230
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits