[Lldb-commits] [lldb] [lldb] Have TestRunLocker run both styles of launch (PR #200978)

via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 1 17:46:36 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Jason Molenda (jasonmolenda)

<details>
<summary>Changes</summary>

While debugging flakey behavior with TestRunLocker, I noticed that is intended 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.

---
Full diff: https://github.com/llvm/llvm-project/pull/200978.diff


1 Files Affected:

- (modified) lldb/test/API/python_api/run_locker/TestRunLocker.py (+17-9) 


``````````diff
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")

``````````

</details>


https://github.com/llvm/llvm-project/pull/200978


More information about the lldb-commits mailing list