2
2
Test that we are able to broadcast and receive progress events from lldb
3
3
"""
4
4
import lldb
5
+ import threading
5
6
6
7
import lldbsuite .test .lldbutil as lldbutil
7
8
@@ -16,6 +17,36 @@ def setUp(self):
16
17
self .broadcaster , lldb .SBDebugger .eBroadcastBitProgress
17
18
)
18
19
20
+ def test_wait_attach_progress_reporting (self ):
21
+ """Test that progress reports for wait attaching work as intended."""
22
+ self .build ()
23
+ target = self .dbg .CreateTarget (None )
24
+
25
+ # Wait attach to a process, then check to see that a progress report was created
26
+ # and that its message is correct for waiting to attach to a process.
27
+ class AttachThread (threading .Thread ):
28
+ def __init__ (self , target ):
29
+ threading .Thread .__init__ (self )
30
+ self .target = target
31
+
32
+ def run (self ):
33
+ self .target .AttachToProcessWithName (
34
+ lldb .SBListener (), "a.out" , True , lldb .SBError ()
35
+ )
36
+
37
+ thread = AttachThread (target )
38
+ thread .start ()
39
+
40
+ event = lldbutil .fetch_next_event (self , self .listener , self .broadcaster )
41
+ progress_data = lldb .SBDebugger .GetProgressDataFromEvent (event )
42
+ message = progress_data .GetValueForKey ("message" ).GetStringValue (100 )
43
+ self .assertEqual (message , "Waiting to attach to process" )
44
+
45
+ # Interrupt the process attach to keep the test from stalling.
46
+ target .process .SendAsyncInterrupt ()
47
+
48
+ thread .join ()
49
+
19
50
def test_dwarf_symbol_loading_progress_report (self ):
20
51
"""Test that we are able to fetch dwarf symbol loading progress events"""
21
52
self .build ()
0 commit comments