Listening for thread events

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.

John Lindal

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


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.


What event_mask should be used for the thread event class? I did not find any. (Sorry for hijacking the thread)

Never mind, found the thread event_mask in threads.h. They are just not in the python API reference page.