[Lldb-commits] [lldb] 4729a72 - Revert "[lldb/test] Fix TestProgressReporting.py race issue with the event listener"

Michael Forster via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 25 05:08:24 PST 2022


Author: Michael Forster
Date: 2022-02-25T13:07:49Z
New Revision: 4729a72acec31b46e167b16f50efacab9d16da9c

URL: https://github.com/llvm/llvm-project/commit/4729a72acec31b46e167b16f50efacab9d16da9c
DIFF: https://github.com/llvm/llvm-project/commit/4729a72acec31b46e167b16f50efacab9d16da9c.diff

LOG: Revert "[lldb/test] Fix TestProgressReporting.py race issue with the event listener"

This reverts commit 3e3e79a9e4c378b59f5f393f556e6a84edcd8898.

MemorySanitizer: use-of-uninitialized-value

Added: 
    

Modified: 
    lldb/bindings/interface/SBDebugger.i
    lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py

Removed: 
    


################################################################################
diff  --git a/lldb/bindings/interface/SBDebugger.i b/lldb/bindings/interface/SBDebugger.i
index 0ef1766a50c6b..3790857b8ab61 100644
--- a/lldb/bindings/interface/SBDebugger.i
+++ b/lldb/bindings/interface/SBDebugger.i
@@ -123,11 +123,14 @@ public:
     };
 
 
+    %apply uint64_t& INOUT { uint64_t& progress_id };
+    %apply uint64_t& INOUT { uint64_t& completed };
+    %apply uint64_t& INOUT { uint64_t& total };
+    %apply bool& INOUT { bool& is_debugger_specific };
     static const char *GetProgressFromEvent(const lldb::SBEvent &event,
-                                        uint64_t &OUTPUT,
-                                        uint64_t &OUTPUT,
-                                        uint64_t &OUTPUT,
-                                        bool &OUTPUT);
+                                        uint64_t &progress_id,
+                                        uint64_t &completed, uint64_t &total,
+                                        bool &is_debugger_specific);
 
     SBBroadcaster GetBroadcaster();
 

diff  --git a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py
index 79ef4e3f9f861..b9d9953539c11 100644
--- a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py
+++ b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py
@@ -17,42 +17,41 @@ def setUp(self):
         TestBase.setUp(self)
         self.progress_events = []
 
-    def fetch_events(self):
+    def fetch_events(self, test_broadcaster):
+        listener = lldb.SBListener("lldb.progress.listener")
+        listener.StartListeningForEvents(test_broadcaster,
+                                         self.eBroadcastBitStopProgressThread)
+
+        progress_broadcaster = self.dbg.GetBroadcaster()
+        progress_broadcaster.AddListener(listener, lldb.SBDebugger.eBroadcastBitProgress)
+
         event = lldb.SBEvent()
 
         done = False
         while not done:
-            if self.listener.WaitForEvent(1, event):
+            if listener.WaitForEvent(1, event):
                 event_mask = event.GetType();
-                if event.BroadcasterMatchesRef(self.test_broadcaster):
+                if event.BroadcasterMatchesRef(test_broadcaster):
                     if event_mask & self.eBroadcastBitStopProgressThread:
                         done = True;
-                elif event.BroadcasterMatchesRef(self.progress_broadcaster):
-                    ret_args = lldb.SBDebugger().GetProgressFromEvent(event);
-                    self.assertGreater(len(ret_args), 1)
-
-                    message = ret_args[0]
+                elif event.BroadcasterMatchesRef(progress_broadcaster):
+                    message = lldb.SBDebugger().GetProgressFromEvent(event, 0, 0, 0, False);
                     if message:
                         self.progress_events.append((message, event))
 
+    @skipUnlessDarwin
     def test_dwarf_symbol_loading_progress_report(self):
         """Test that we are able to fetch dwarf symbol loading progress events"""
         self.build()
 
-        self.listener = lldb.SBListener("lldb.progress.listener")
-        self.test_broadcaster = lldb.SBBroadcaster('lldb.broadcaster.test')
-        self.listener.StartListeningForEvents(self.test_broadcaster,
-                                              self.eBroadcastBitStopProgressThread)
-
-        self.progress_broadcaster = self.dbg.GetBroadcaster()
-        self.progress_broadcaster.AddListener(self.listener, lldb.SBDebugger.eBroadcastBitProgress)
-
-        listener_thread = threading.Thread(target=self.fetch_events)
+        test_broadcaster = lldb.SBBroadcaster('lldb.broadcaster.test')
+        listener_thread = threading.Thread(target=self.fetch_events,
+                                           args=[test_broadcaster])
         listener_thread.start()
 
         lldbutil.run_to_source_breakpoint(self, 'break here', lldb.SBFileSpec('main.c'))
 
-        self.test_broadcaster.BroadcastEventByType(self.eBroadcastBitStopProgressThread)
+        test_broadcaster.BroadcastEventByType(self.eBroadcastBitStopProgressThread)
         listener_thread.join()
 
-        self.assertGreater(len(self.progress_events), 0)
+        self.assertTrue(len(self.progress_events) > 0)


        


More information about the lldb-commits mailing list