Skip to content

Commit def09f2

Browse files
committed
Reland "[lldb][target] Add progress report for wait-attaching to process" (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
1 parent b5d5708 commit def09f2

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

lldb/source/Target/Target.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3546,6 +3546,7 @@ llvm::Expected<TraceSP> Target::GetTraceOrCreate() {
35463546
}
35473547

35483548
Status Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) {
3549+
Progress attach_progress("Waiting to attach to process");
35493550
m_stats.SetLaunchOrAttachTime();
35503551
auto state = eStateInvalid;
35513552
auto process_sp = GetProcessSP();

lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,28 @@ def setUp(self):
1616
self.broadcaster, lldb.SBDebugger.eBroadcastBitProgress
1717
)
1818

19+
def test_wait_attach_progress_reporting(self):
20+
"""Test that progress reports for wait attaching work as intended."""
21+
target = self.dbg.CreateTarget(None)
22+
23+
# The waiting to attach progress message will get emitted upon
24+
# trying to attach, but it's not going to be the event picked
25+
# up by checking with fetch_next_event, so go through all emitted
26+
# progres events and check that the waiting to attach one was emitted at all.
27+
target.AttachToProcessWithName(
28+
self.listener,
29+
"a.out",
30+
False,
31+
lldb.SBError(),
32+
)
33+
event = lldb.SBEvent()
34+
events = []
35+
while self.listener.GetNextEventForBroadcaster(self.broadcaster, event):
36+
progress_data = lldb.SBDebugger.GetProgressDataFromEvent(event)
37+
message = progress_data.GetValueForKey("message").GetStringValue(100)
38+
events.append(message)
39+
self.assertTrue("Waiting to attach to process" in events)
40+
1941
def test_dwarf_symbol_loading_progress_report(self):
2042
"""Test that we are able to fetch dwarf symbol loading progress events"""
2143
self.build()

0 commit comments

Comments
 (0)