[Lldb-commits] [PATCH] D148397: [lldb/Utility] Add opt-in passthrough mode to event listeners

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 20 14:49:12 PDT 2023


mib marked 2 inline comments as done.
mib added a comment.

In D148397#4275792 <https://reviews.llvm.org/D148397#4275792>, @JDevlieghere wrote:

> I find "passthrough" somewhat confusing in this context. When using a listener in this new mode, where does the event go after it has pass trough this event listener? Maybe my understanding of how the event listeners is incomplete, but I was under the impression that normally there's a single listener for a certain kind of event. IIUC, in this new mode, you can have multiple listeners, where you can set one (or as Alex pointed out, possibly more) listeners that can observe events but not necessary deal with them. If that's an accurate description of the interactions, then it seems like there's more of a one-to-many relationship between events and listeners rather than what passthrough implies. I think a better name would be something like "passive listener" or "non-handling" listener or something.

@JDevlieghere You could also have multiple listeners for a certain type of event, but events would be considered "handled" only when they're popped from the listener passed during the process creation (or the debugger listener if no listener is provided in the {launch,attach}info). The idea behind passthrough listener was to have a side channel where all the events would be funneled to, that would never interfere with the default listener and therefore not change the process execution behavior. If you really feel strongly about the "passthrough" name, I can rename it to whatever you like but I feel like it's pretty self explanatory.



================
Comment at: lldb/include/lldb/Utility/Broadcaster.h:520-522
+    /// A optional listener that all private events get also broadcasted to,
+    /// on top the hijacked / default listeners.
+    lldb::ListenerSP m_passthrough_listener = nullptr;
----------------
bulbazord wrote:
> It looks like Broadcaster can have multiple listeners. Do we want multiple passthrough listeners as well? If not, why only one?
That's a very good point. When I implemented this, I was thinking that the passthrough listener would act as a funnel for all the events. But having multiple passthrough listener could potentially allow the user to do some filtering on the event. @jingham what do you think ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148397



More information about the lldb-commits mailing list