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

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to