[Lldb-commits] [lldb] 300b2a5 - [lldb][gdb-remote] Mark thread as stopped in RefreshStateAfterStop (#201605)

via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 8 04:46:32 PDT 2026


Author: Charles Zablit
Date: 2026-06-08T12:46:27+01:00
New Revision: 300b2a53feb97fb0d52e8ff91d20347d195aea73

URL: https://github.com/llvm/llvm-project/commit/300b2a53feb97fb0d52e8ff91d20347d195aea73
DIFF: https://github.com/llvm/llvm-project/commit/300b2a53feb97fb0d52e8ff91d20347d195aea73.diff

LOG: [lldb][gdb-remote] Mark thread as stopped in RefreshStateAfterStop (#201605)

Added: 
    

Modified: 
    lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp
    lldb/source/Target/ThreadList.cpp
    lldb/test/API/functionalities/thread/break_after_join/TestBreakAfterJoin.py
    lldb/test/API/functionalities/thread/multi_break/TestMultipleBreakpoints.py
    lldb/test/API/functionalities/thread/state/TestThreadStates.py

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp
index b2131a5ee7b13..b65c26cb19709 100644
--- a/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp
@@ -39,7 +39,6 @@ TargetThreadWindows::~TargetThreadWindows() { DestroyThread(); }
 
 void TargetThreadWindows::RefreshStateAfterStop() {
   ::SuspendThread(m_host_thread.GetNativeThread().GetSystemHandle());
-  SetState(eStateStopped);
   GetRegisterContext()->InvalidateIfNeeded(false);
 }
 

diff  --git a/lldb/source/Target/ThreadList.cpp b/lldb/source/Target/ThreadList.cpp
index 6f7c9e2e3bea3..7d2feffeca11d 100644
--- a/lldb/source/Target/ThreadList.cpp
+++ b/lldb/source/Target/ThreadList.cpp
@@ -482,8 +482,10 @@ void ThreadList::RefreshStateAfterStop() {
       "a thread.");
 
   collection::iterator pos, end = m_threads.end();
-  for (pos = m_threads.begin(); pos != end; ++pos)
+  for (pos = m_threads.begin(); pos != end; ++pos) {
+    (*pos)->SetState(eStateStopped);
     (*pos)->RefreshStateAfterStop();
+  }
 }
 
 void ThreadList::DiscardThreadPlans() {

diff  --git a/lldb/test/API/functionalities/thread/break_after_join/TestBreakAfterJoin.py b/lldb/test/API/functionalities/thread/break_after_join/TestBreakAfterJoin.py
index 0e80d8b7a11fb..c246808f1bb30 100644
--- a/lldb/test/API/functionalities/thread/break_after_join/TestBreakAfterJoin.py
+++ b/lldb/test/API/functionalities/thread/break_after_join/TestBreakAfterJoin.py
@@ -17,19 +17,6 @@ def setUp(self):
         # Find the line number for our breakpoint.
         self.breakpoint = line_number("main.cpp", "// Set breakpoint here")
 
-    @expectedFailureAll(
-        oslist=["linux"],
-        bugnumber="llvm.org/pr15824 thread states not properly maintained",
-    )
-    @expectedFailureAll(
-        oslist=lldbplatformutil.getDarwinOSTriples(),
-        bugnumber="llvm.org/pr15824 thread states not properly maintained and <rdar://problem/28557237>",
-    )
-    @expectedFailureAll(
-        oslist=["freebsd"],
-        bugnumber="llvm.org/pr18190 thread states not properly maintained",
-    )
-    @expectedFailureNetBSD
     def test(self):
         """Test breakpoint handling after a thread join."""
         self.build()

diff  --git a/lldb/test/API/functionalities/thread/multi_break/TestMultipleBreakpoints.py b/lldb/test/API/functionalities/thread/multi_break/TestMultipleBreakpoints.py
index 9c9f7f7acdb04..fe30138f78157 100644
--- a/lldb/test/API/functionalities/thread/multi_break/TestMultipleBreakpoints.py
+++ b/lldb/test/API/functionalities/thread/multi_break/TestMultipleBreakpoints.py
@@ -17,20 +17,7 @@ def setUp(self):
         # Find the line number for our breakpoint.
         self.breakpoint = line_number("main.cpp", "// Set breakpoint here")
 
-    @expectedFailureAll(
-        oslist=["linux"],
-        bugnumber="llvm.org/pr15824 thread states not properly maintained",
-    )
-    @expectedFailureAll(
-        oslist=lldbplatformutil.getDarwinOSTriples(),
-        bugnumber="llvm.org/pr15824 thread states not properly maintained and <rdar://problem/28557237>",
-    )
-    @expectedFailureAll(
-        oslist=["freebsd"],
-        bugnumber="llvm.org/pr18190 thread states not properly maintained",
-    )
     @skipIfWindows  # This is flakey on Windows: llvm.org/pr24668, llvm.org/pr38373
-    @expectedFailureNetBSD
     def test(self):
         """Test simultaneous breakpoints in multiple threads."""
         self.build()

diff  --git a/lldb/test/API/functionalities/thread/state/TestThreadStates.py b/lldb/test/API/functionalities/thread/state/TestThreadStates.py
index 6eeff07955733..6198e0baf1c29 100644
--- a/lldb/test/API/functionalities/thread/state/TestThreadStates.py
+++ b/lldb/test/API/functionalities/thread/state/TestThreadStates.py
@@ -11,16 +11,6 @@
 
 
 class ThreadStateTestCase(TestBase):
-    @expectedFailureAll(
-        oslist=["linux"],
-        bugnumber="llvm.org/pr15824 thread states not properly maintained",
-    )
-    @skipIfDarwin  # llvm.org/pr15824 thread states not properly maintained and <rdar://problem/28557237>
-    @expectedFailureAll(
-        oslist=["freebsd"],
-        bugnumber="llvm.org/pr18190 thread states not properly maintained",
-    )
-    @expectedFailureNetBSD
     def test_state_after_breakpoint(self):
         """Test thread state after breakpoint."""
         self.build()
@@ -37,24 +27,20 @@ def test_state_after_continue(self):
 
     @skipIfDarwin  # 'llvm.org/pr23669', cause Python crash randomly
     @expectedFailureDarwin("llvm.org/pr23669")
-    @expectedFailureNetBSD
     # This actually passes on Windows on Arm but it's hard to describe that
     # and xfail it everywhere else.
     @skipIfWindows
-    # thread states not properly maintained
-    @unittest.expectedFailure  # llvm.org/pr16712
     def test_state_after_expression(self):
         """Test thread state after expression."""
         self.build()
         self.thread_state_after_expression_test()
 
-    # thread states not properly maintained
-    @unittest.expectedFailure  # llvm.org/pr15824 and <rdar://problem/28557237>
+    @skipIfDarwin  # rdar://28557237
+    @skipIfLinux  # llvm.org/pr15824 process interrupt stop reason is trace instead of signal sometimes
     @expectedFailureAll(
         oslist=["windows"],
         bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly",
     )
-    @skipIfDarwin  # llvm.org/pr15824 thread states not properly maintained and <rdar://problem/28557237>
     @expectedFailureNetBSD
     def test_process_state(self):
         """Test thread states (comprehensive)."""
@@ -190,7 +176,6 @@ def thread_state_after_expression_test(self):
         oslist=["windows"],
         bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly",
     )
-    @skipIfDarwin  # llvm.org/pr15824 thread states not properly maintained and <rdar://problem/28557237>
     @no_debug_info_test
     def test_process_interrupt(self):
         """Test process interrupt and continue."""
@@ -288,7 +273,7 @@ def thread_states_test(self):
         # Stop the process
         self.runCmd("process interrupt")
 
-        self.assertStopReason(thread.GetState(), lldb.eStopReasonSignal)
+        self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonSignal)
 
         # Check the thread state
         self.assertTrue(
@@ -311,12 +296,12 @@ def thread_states_test(self):
             "Thread state is 'suspended' after expression evaluation.",
         )
 
-        self.assertStopReason(thread.GetState(), lldb.eStopReasonSignal)
+        self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonSignal)
 
         # Run to breakpoint 2
         self.runCmd("continue")
 
-        self.assertStopReason(thread.GetState(), lldb.eStopReasonBreakpoint)
+        self.assertStopReason(thread.GetStopReason(), lldb.eStopReasonBreakpoint)
 
         # Make sure both threads are stopped
         self.assertTrue(


        


More information about the lldb-commits mailing list