-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Reland "[lldb][target] Add progress report for wait-attaching to proc… #145111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Reland "[lldb][target] Add progress report for wait-attaching to proc… #145111
Conversation
…ess" (llvm#144810) This relands commit e0933ab. 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: llvm#144768
@llvm/pr-subscribers-lldb Author: Chelsea Cassanova (chelcassanova) Changes…ess" (#144810) This relands commit e0933ab. 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: #144768 Full diff: https://github.com/llvm/llvm-project/pull/145111.diff 2 Files Affected:
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..7da920723f951 100644
--- a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py
+++ b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py
@@ -2,6 +2,7 @@
Test that we are able to broadcast and receive progress events from lldb
"""
import lldb
+import threading
import lldbsuite.test.lldbutil as lldbutil
@@ -16,6 +17,39 @@ 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(),
+ "wait-attach-progress-report",
+ 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.assertEqual(message, "Waiting to attach to process")
+
+ # Interrupt the process attach to keep the test from stalling.
+ target.process.SendAsyncInterrupt()
+
+ thread.join()
+
def test_dwarf_symbol_loading_progress_report(self):
"""Test that we are able to fetch dwarf symbol loading progress events"""
self.build()
|
lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py
Outdated
Show resolved
Hide resolved
…eporting.py Remove build step from wait-attach progress report test. Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
…ess" (#144810)
This relands commit e0933ab. 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: #144768