[Lldb-commits] [lldb] [lldb-dap] Fix TestDap_attach.py flakiness (PR #137278)

David Peixotto via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 25 09:08:31 PDT 2025


================
@@ -374,6 +374,12 @@ def wait_for_event(self, filter=None, timeout=None):
             )
         return None
 
+    def wait_for_process_and_initialized(self, timeout=None):
----------------
dmpots wrote:

You are taking `timeout` as a parameter here, but not passing it down to `wait_for_event`.

I wonder if it would be useful to have a more general function to wait for any set of events. Something like
```
# Wait for the set of events in `events`. 
# Return the events not hit for before the timeout expired
def wait_for_events(self, events, timeout=None):
    events = events[:] # Should we make a copy to not modify the input?
    while events:
        event = self.wait_for_event(filter=events, timeout=timeout)
        events.remove(event["event"])
    return events
```

Then we can call it like
```
   self.wait_for_events(["process", "initialized"])
```

What do you think?

https://github.com/llvm/llvm-project/pull/137278


More information about the lldb-commits mailing list