[Lldb-commits] [lldb] [lldb][target] Add progress report for wait-attaching to process (PR #144768)

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 18 11:07:52 PDT 2025


================
@@ -16,6 +17,37 @@ def setUp(self):
             self.broadcaster, lldb.SBDebugger.eBroadcastBitProgress
         )
 
+    def test_wait_attach_progress_reporting(self):
+        """Test that progress reports for wait attaching work as intended."""
+        self.build()
+        target = self.dbg.CreateTarget(None)
+
+        # Wait attach to a process, then check to see that a progress report was created
+        # and that its message is correct for waiting to attach to a process.
+        class AttachThread(threading.Thread):
+            def __init__(self, target):
+                threading.Thread.__init__(self)
+                self.target = target
+
+            def run(self):
+                self.target.AttachToProcessWithName(
+                    lldb.SBListener(), "a.out", True, lldb.SBError()
+                )
+
+        thread = AttachThread(target)
+        thread.start()
+
+        event = lldbutil.fetch_next_event(self, self.listener, self.broadcaster)
+        progress_data = lldb.SBDebugger.GetProgressDataFromEvent(event)
+        message = progress_data.GetValueForKey("message").GetStringValue(100)
+        self.assertGreater(len(message), 0)
----------------
bulbazord wrote:

nit: Checking for `len(message) > 0` is redundant with the `assertEqual` below.

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


More information about the lldb-commits mailing list