https://github.com/jasonmolenda updated https://github.com/llvm/llvm-project/pull/200978
>From db19f0cc283d17f45a5c5cfe25d7b858304e80a2 Mon Sep 17 00:00:00 2001 From: Jason Molenda <[email protected]> Date: Mon, 1 Jun 2026 17:39:39 -0700 Subject: [PATCH 1/2] [lldb] Have TestRunLocker run both styles of launch While debugging flakey behavior with TestRunLocker, I noticed that is intends to run its test once with a stop at the entry function (and then Continues) and once where we launch to the main() loop. But we were never exercising the stop-at-entry codepath. This doesn't fix the flakey behavior, although that only happens with the launch-directly-into-main() codepath; I don't get failures when I stop at the entry point and then continue. --- .../python_api/run_locker/TestRunLocker.py | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/lldb/test/API/python_api/run_locker/TestRunLocker.py b/lldb/test/API/python_api/run_locker/TestRunLocker.py index f84d038b5ed34..16b7623367a05 100644 --- a/lldb/test/API/python_api/run_locker/TestRunLocker.py +++ b/lldb/test/API/python_api/run_locker/TestRunLocker.py @@ -28,7 +28,7 @@ def test_run_locker(self): def test_run_locker_stop_at_entry(self): """Test that the run locker is set correctly when we launch""" self.build() - self.runlocker_test(False) + self.runlocker_test(True) def setUp(self): # Call super's setUp(). @@ -43,8 +43,8 @@ def runlocker_test(self, stop_at_entry): launch_info = target.GetLaunchInfo() if stop_at_entry: - flags = launch_info.GetFlags() - launch_info.SetFlags(flags | lldb.eLaunchFlagStopAtEntry) + flags = launch_info.GetLaunchFlags() + launch_info.SetLaunchFlags(flags | lldb.eLaunchFlagStopAtEntry) error = lldb.SBError() # We are trying to do things when the process is running, so @@ -69,16 +69,24 @@ def runlocker_test(self, stop_at_entry): ) state_type = lldb.SBProcess.GetStateFromEvent(event) - self.assertState(state_type, lldb.eStateRunning, "Didn't get a running event") + # A stop_at_entry launch may have already stopped, it may + # not be eStateRunning. + if stop_at_entry and state_type != lldb.eStateStopped: + self.assertState( + state_type, lldb.eStateRunning, "Didn't get a running event" + ) # We aren't checking the entry state, but just making sure # the running state is set properly if we continue in this state. if stop_at_entry: - event_result = listener.WaitForEvent(10, event) - self.assertTrue(event_result, "Timed out waiting for stop at entry stop") - state_type = lldb.SBProcess.GetStateFromEvent(event) - self.assertState(state_type, eStateStopped, "Stop at entry stopped") + if state_type != lldb.eStateStopped: + event_result = listener.WaitForEvent(10, event) + self.assertTrue( + event_result, "Timed out waiting for stop at entry stop" + ) + state_type = lldb.SBProcess.GetStateFromEvent(event) + self.assertState(state_type, eStateStopped, "Stop at entry stopped") process.Continue() # Okay, now the process is running, make sure we can't do things @@ -90,7 +98,7 @@ def runlocker_test(self, stop_at_entry): self.assertIn( "can't evaluate expressions when the process is running", repr(val), - "repr works" + "repr works", ) error = val.GetError() self.assertTrue(error.Fail(), "Failed to run expression") >From e9e65e6cbe58228a6aa1c47fe60300b2511319c4 Mon Sep 17 00:00:00 2001 From: Jason Molenda <[email protected]> Date: Mon, 1 Jun 2026 21:03:38 -0700 Subject: [PATCH 2/2] the stop_at_entry case needs to wait after process.Continue() to see an eStateRunning. --- lldb/test/API/python_api/run_locker/TestRunLocker.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lldb/test/API/python_api/run_locker/TestRunLocker.py b/lldb/test/API/python_api/run_locker/TestRunLocker.py index 16b7623367a05..a4831c82ff16d 100644 --- a/lldb/test/API/python_api/run_locker/TestRunLocker.py +++ b/lldb/test/API/python_api/run_locker/TestRunLocker.py @@ -88,6 +88,12 @@ def runlocker_test(self, stop_at_entry): state_type = lldb.SBProcess.GetStateFromEvent(event) self.assertState(state_type, eStateStopped, "Stop at entry stopped") process.Continue() + event_result = listener.WaitForEvent(10, event) + self.assertTrue(event_result, "timed out waiting for launch") + state_type = lldb.SBProcess.GetStateFromEvent(event) + self.assertState( + state_type, lldb.eStateRunning, "Didn't get a running event" + ) # Okay, now the process is running, make sure we can't do things # you aren't supposed to do while running, and that we get some _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
