[lldb-dev] Listening for thread events

Jim Ingham via lldb-dev lldb-dev at lists.llvm.org
Fri Jan 29 16:02:11 PST 2016


It’s unclear to me why it would be a problem to listen to every thread object?  They aren’t terribly chatty or anything, and you can listen to all of them with one listener.

Note, you don’t have to sign up individually for every thread object’s broadcaster.  That would be really annoying.  In lldb, you can listen to individual broadcasters or “broadcaster event classes”.  You want to do the latter.

You get the event class name with the GetBroadcasterClassName method on the class you are interested in (SBThread in this case) and then on your listener call 

SBListener::StartListeningForEventClass

If you do that, the debugger will sign your listener up for the objects of that broadcaster class as they come and go.  That makes listening to events on all the threads in your process quite straightforward.

Hope this helps.

Jim


> On Jan 29, 2016, at 2:32 PM, John Lindal via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> 
> I'm building an X11 UI on top of LLDB, and I'm stuck trying to listen for thread events.
> 
> lldb_private::Thread is a Broadcaster, but lldb::SBThread doesn't expose a GetBroadcaster() event the way SBProcess does.
> 
> I wouldn't really want to have to listen to every SBThread object, but when the program stops, I could listen to the selected thread.  (Getting the events from SBProcess would also work, if Process relayed them.)
> 
> Is this a feature that has not yet been implemented?  I couldn't find any related tickets in Bugzilla.
> 
> Thanks,
> John Lindal
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20160129/61315a0f/attachment.html>


More information about the lldb-dev mailing list