[Lldb-commits] [lldb] [lldb] Don't unregister a listener that's being destroyed (PR #97300)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Jul 1 10:53:26 PDT 2024
jimingham wrote:
This LGTM.
W.R.T. your comment about Primary Listeners...
For the most part, Broadcaster classes don't actually need Listeners to function. The breakpoint system can work just fine if no one is listening to breakpoint changed events on the target. So it never sets a PrimaryListener, and just ends up with a series of Secondary Listeners.
But there is one case where this is not true, which is the Process class. If no one is listening to Process events, then execution control in lldb doesn't work. Since that really doesn't make sense, we require Processes be created with a primary listener, and just so we don't have to reason about what to do if it goes away, the Process keeps it alive.
Of course, just holding the primary listener as a shared pointer only solves half the problem. It doesn't ensure that the Listener is draining the queue. But I don't see how it can be the Process class's job to make sure that happens.
Anyway, having a primary listener should be the uncommon case, and should only occur when the Broadcaster has to have a Listener to cooperate with to do its job.
https://github.com/llvm/llvm-project/pull/97300
More information about the lldb-commits
mailing list