[Lldb-commits] [PATCH] D97739: Add a progress class that can track and report long running operations that happen in LLDB.
Greg Clayton via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Mar 5 16:29:46 PST 2021
clayborg added a comment.
In D97739#2608066 <https://reviews.llvm.org/D97739#2608066>, @jingham wrote:
> In D97739#2607993 <https://reviews.llvm.org/D97739#2607993>, @clayborg wrote:
>
>> I agree that we should avoid SBEvent after thinking about it.
>
> First off, doing long running operations on a thread that is the one handling the major lldb events is obviously a bad idea. The driver doesn't do it this way. Commands get run on the main thread, and events get processed on the event-handler thread.
True, but the diver isn't a great example of using the API like an IDE would. And anything can kick off expensive events in the debugger. Xcode, as you know, as a thread that listens for events and does process control. This process control thread is responsible for many things including fetching the frame variables when needed. So just the act of having a dynamic type that needs to lookup a class by name could cause this expensive event to trigger. And with many other APIs, you never know what might trigger some expensive lookup to happen. Just the act of consuming a process stopped event on the process control thread is enough to trigger a python script or other LLDB commands in the event handler itself that could cause the expensive event to trigger and cause long delays. So there are plenty of reasons that this could cause delays.
> Secondly, there's no reason that the listener for progress events has to call "WaitForEvents" along with all the process events it's waiting for on the debugger. You could just set up a listener thread for all these events (they would have their own event bit) if you wanted somebody just monitoring progress events.
That is true. But spinning up a thread just to listen for progress events seems like a bit of overkill, but it can easily be done.
> It also has the advantage that callbacks can't stall the progress of lldb, since the event just gets fired off, and then you go on your way...
Using events does also has the advantage being able to receive all progress events on the same thread. Though since most GUI programs can only draw to the window server on the main thread, they will still need to setup things to forward these events to the main thread. Same goes for the callback methods though.
I am happy to try the SBEvent approach if anyone else chimes in
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97739/new/
https://reviews.llvm.org/D97739
More information about the lldb-commits
mailing list