https://github.com/chelcassanova updated 
https://github.com/llvm/llvm-project/pull/145111

>From def09f294e36e2fe703d66eeae37253ac8fbb7b1 Mon Sep 17 00:00:00 2001
From: Chelsea Cassanova <chelsea_cassan...@apple.com>
Date: Fri, 20 Jun 2025 13:47:32 -0700
Subject: [PATCH] Reland "[lldb][target] Add progress report for wait-attaching
 to process" (#144810)

This relands commit e0933ab5ae4856c4aa188a5ea16716b3a8d0840b. The
original commit was causing the test TestCreateAfterAttach.py to fail on
ARM Ubuntu bots. It's possible that this could've been happening because
the test for wait-attach progress reporting is waiting on a process
named "a.out" which could be too generic as multiple other tests (when
run in parallel on the bots) could also be using processes named
"a.out". This commit changes the wait-attach progress report test to
wait on a unique process name.

Original PR description:

This commit adds a progress report when wait-attaching to a process as
well as a test for this.

Original PR link: https://github.com/llvm/llvm-project/pull/144768
---
 lldb/source/Target/Target.cpp                 |  1 +
 .../TestProgressReporting.py                  | 22 +++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 45a9e1196a049..8f8d2ef21cc5f 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -3546,6 +3546,7 @@ llvm::Expected<TraceSP> Target::GetTraceOrCreate() {
 }
 
 Status Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) {
+  Progress attach_progress("Waiting to attach to process");
   m_stats.SetLaunchOrAttachTime();
   auto state = eStateInvalid;
   auto process_sp = GetProcessSP();
diff --git 
a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py 
b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py
index 9af53845ca1b7..a7f2e6b70dfc7 100644
--- a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py
+++ b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py
@@ -16,6 +16,28 @@ 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."""
+        target = self.dbg.CreateTarget(None)
+
+        # The waiting to attach progress message will get emitted upon
+        # trying to attach, but it's not going to be the event picked
+        # up by checking with fetch_next_event, so go through all emitted
+        # progres events and check that the waiting to attach one was emitted 
at all.
+        target.AttachToProcessWithName(
+            self.listener,
+            "a.out",
+            False,
+            lldb.SBError(),
+        )
+        event = lldb.SBEvent()
+        events = []
+        while self.listener.GetNextEventForBroadcaster(self.broadcaster, 
event):
+            progress_data = lldb.SBDebugger.GetProgressDataFromEvent(event)
+            message = 
progress_data.GetValueForKey("message").GetStringValue(100)
+            events.append(message)
+        self.assertTrue("Waiting to attach to process" in events)
+
     def test_dwarf_symbol_loading_progress_report(self):
         """Test that we are able to fetch dwarf symbol loading progress 
events"""
         self.build()

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to