[Lldb-commits] [PATCH] D121977: [lldb/test] Add events listener helper class to lldbtest

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 21 00:41:45 PDT 2022


labath added a comment.

I've reverted this patch because it introduces races in the event processing. See inline comment for details.



================
Comment at: lldb/packages/Python/lldbsuite/test/eventlistener.py:38-41
+        # Broadcast a eBroadcastBitStopListenerThread` event so the background
+        # thread stops listening to events, then join the background thread.
+        self.broadcaster.BroadcastEventByType(self.eBroadcastBitStopListenerThread)
+        self.listener_thread.join()
----------------
This cannot be done in the tearDown method (without extra synchronisation) as this is what guarantees that the events have been processed and can be read from the event array. This is what caused [[ https://lab.llvm.org/buildbot/#/builders/68/builds/29171 | TestDiagnosticReporting.py ]] to flake. If you want to do the shutdown in the tearDown method, then you'll need to introduce some other means of synchronising and ensuring that the event array can be accessed safely and contains all the things it is supposed to contain (e.g. through a new kind of a message).


================
Comment at: lldb/test/API/functionalities/diagnostic_reporting/TestDiagnosticReporting.py:15
+    event_mask = lldb.SBDebugger.eBroadcastBitWarning | lldb.SBDebugger.eBroadcastBitError
+    event_data_extractor = lldb.SBDebugger.GetDiagnosticFromEvent
 
----------------
Why not just queue the events themselves and let the user do whatever it wants with them later?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121977/new/

https://reviews.llvm.org/D121977



More information about the lldb-commits mailing list