LLDB mainline
|
An event broadcasting class. More...
#include "lldb/Utility/Broadcaster.h"
Classes | |
class | BroadcasterImpl |
BroadcasterImpl contains the actual Broadcaster implementation. More... | |
Public Member Functions | |
Broadcaster (lldb::BroadcasterManagerSP manager_sp, const char *name) | |
Construct with a broadcaster with a name. | |
virtual | ~Broadcaster () |
Destructor. | |
void | CheckInWithManager () |
void | BroadcastEvent (lldb::EventSP &event_sp) |
Broadcast an event which has no associated data. | |
void | BroadcastEventIfUnique (lldb::EventSP &event_sp) |
void | BroadcastEvent (uint32_t event_type, const lldb::EventDataSP &event_data_sp) |
void | BroadcastEvent (uint32_t event_type, EventData *event_data=nullptr) |
void | BroadcastEventIfUnique (uint32_t event_type, EventData *event_data=nullptr) |
void | Clear () |
virtual void | AddInitialEventsToListener (const lldb::ListenerSP &listener_sp, uint32_t requested_events) |
uint32_t | AddListener (const lldb::ListenerSP &listener_sp, uint32_t event_mask) |
Listen for any events specified by event_mask. | |
ConstString | GetBroadcasterName () |
Get the NULL terminated C string name of this Broadcaster object. | |
bool | GetEventNames (Stream &s, const uint32_t event_mask, bool prefix_with_broadcaster_name) const |
Get the event name(s) for one or more event bits. | |
void | SetEventName (uint32_t event_mask, const char *name) |
Set the name for an event bit. | |
const char * | GetEventName (uint32_t event_mask) const |
bool | EventTypeHasListeners (uint32_t event_type) |
bool | RemoveListener (const lldb::ListenerSP &listener_sp, uint32_t event_mask=UINT32_MAX) |
Removes a Listener from this broadcasters list and frees the event bits specified by event_mask that were previously acquired by listener (assuming listener was listening to this object) for other listener objects to use. | |
bool | HijackBroadcaster (const lldb::ListenerSP &listener_sp, uint32_t event_mask=UINT32_MAX) |
Provides a simple mechanism to temporarily redirect events from broadcaster. | |
bool | IsHijackedForEvent (uint32_t event_mask) |
void | RestoreBroadcaster () |
Restore the state of the Broadcaster from a previous hijack attempt. | |
virtual ConstString & | GetBroadcasterClass () const |
This needs to be filled in if you are going to register the broadcaster with the broadcaster manager and do broadcaster class matching. | |
lldb::BroadcasterManagerSP | GetManager () |
virtual void | SetShadowListener (lldb::ListenerSP listener_sp) |
Protected Types | |
typedef std::shared_ptr< BroadcasterImpl > | BroadcasterImplSP |
typedef std::weak_ptr< BroadcasterImpl > | BroadcasterImplWP |
Protected Member Functions | |
BroadcasterImplSP | GetBroadcasterImpl () |
const char * | GetHijackingListenerName () |
Private Member Functions | |
Broadcaster (const Broadcaster &)=delete | |
const Broadcaster & | operator= (const Broadcaster &)=delete |
Private Attributes | |
BroadcasterImplSP | m_broadcaster_sp |
lldb::BroadcasterManagerSP | m_manager_sp |
const ConstString | m_broadcaster_name |
The name of this broadcaster object. | |
Friends | |
class | Listener |
class | Event |
An event broadcasting class.
The Broadcaster class is designed to be subclassed by objects that wish to vend events in a multi-threaded environment. Broadcaster objects can each vend 32 events. Each event is represented by a bit in a 32 bit value and these bits can be set:
Subclasses should provide broadcast bit definitions for any events they vend, typically using an enumeration:
Definition at line 145 of file Broadcaster.h.
|
protected |
Definition at line 432 of file Broadcaster.h.
|
protected |
Definition at line 433 of file Broadcaster.h.
lldb_private::Broadcaster::Broadcaster | ( | lldb::BroadcasterManagerSP | manager_sp, |
const char * | name | ||
) |
Construct with a broadcaster with a name.
[in] | name | A NULL terminated C string that contains the name of the broadcaster object. |
|
virtual |
Destructor.
The destructor is virtual since this class gets subclassed.
Definition at line 38 of file Broadcaster.cpp.
References Clear(), GetBroadcasterName(), lldb_private::GetLog(), LLDB_LOG, and lldb_private::Object.
|
privatedelete |
|
virtual |
Definition at line 110 of file Broadcaster.cpp.
Referenced by lldb::SBBroadcaster::AddInitialEventsToListener().
|
inline |
Listen for any events specified by event_mask.
Only one listener can listen to each event bit in a given Broadcaster. Once a listener has acquired an event bit, no other broadcaster will have access to it until it is relinquished by the first listener that gets it. The actual event bits that get acquired by listener may be different from what is requested in event_mask, and to track this the actual event bits that are acquired get returned.
[in] | listener_sp | The Listener object that wants to monitor the events that get broadcast by this object. |
[in] | event_mask | A bit mask that indicates which events the listener is asking to monitor. |
Definition at line 211 of file Broadcaster.h.
References m_broadcaster_sp.
Referenced by lldb::SBBroadcaster::AddListener(), and lldb_private::Listener::StartListeningForEvents().
|
inline |
Broadcast an event which has no associated data.
Definition at line 165 of file Broadcaster.h.
References m_broadcaster_sp.
Referenced by lldb::SBBroadcaster::BroadcastEvent(), lldb::SBBroadcaster::BroadcastEventByType(), lldb_private::Thread::BroadcastSelectedFrameChange(), lldb_private::Process::BroadcastStructuredData(), lldb_private::Process::ControlPrivateStateThread(), lldb_private::Debugger::DefaultEventHandler(), lldb_private::Process::DestroyImpl(), lldb_private::Process::Detach(), lldb_private::process_gdb_remote::ProcessGDBRemote::DoAttachToProcessWithID(), lldb_private::process_gdb_remote::ProcessGDBRemote::DoAttachToProcessWithName(), lldb_private::CommandObjectQuit::DoExecute(), lldb_private::process_gdb_remote::ProcessGDBRemote::DoResume(), ProcessKDP::DoResume(), lldb_private::Process::Halt(), lldb_private::Process::HandlePrivateEvent(), lldb_private::Target::ModulesDidLoad(), lldb_private::Target::ModulesDidUnload(), NotifyChange(), lldb_private::process_gdb_remote::GDBRemoteClientBase::OnRunPacketSent(), PrivateReportDiagnostic(), PrivateReportProgress(), lldb_private::ThreadedCommunication::ReadThread(), lldb_private::Thread::ReturnFromFrame(), lldb_private::Process::RunPrivateStateThread(), lldb_private::Process::RunThreadPlan(), lldb_private::Process::SendAsyncInterrupt(), lldb_private::TargetList::SendAsyncInterrupt(), lldb_private::Breakpoint::SendBreakpointChangedEvent(), lldb_private::BreakpointLocation::SendBreakpointLocationChangedEvent(), lldb_private::Watchpoint::SendWatchpointChangedEvent(), lldb_private::Process::SetPrivateState(), lldb_private::Debugger::SetPropertyValue(), lldb_private::process_gdb_remote::ProcessGDBRemote::StopAsyncThread(), ProcessKDP::StopAsyncThread(), lldb_private::Debugger::StopEventHandlerThread(), lldb_private::ThreadedCommunication::StopReadThread(), lldb_private::Target::SymbolsDidLoad(), and lldb_private::CommandInterpreter::UpdatePrompt().
|
inline |
Definition at line 173 of file Broadcaster.h.
References m_broadcaster_sp.
|
inline |
Definition at line 178 of file Broadcaster.h.
References m_broadcaster_sp.
|
inline |
Definition at line 169 of file Broadcaster.h.
References m_broadcaster_sp.
Referenced by lldb_private::ThreadedCommunication::AppendBytesToCache(), lldb_private::Process::AppendSTDERR(), lldb_private::Process::AppendSTDOUT(), lldb_private::Process::BroadcastAsyncProfileData(), lldb::SBBroadcaster::BroadcastEvent(), and lldb::SBBroadcaster::BroadcastEventByType().
|
inline |
Definition at line 182 of file Broadcaster.h.
References m_broadcaster_sp.
void Broadcaster::CheckInWithManager | ( | ) |
Definition at line 46 of file Broadcaster.cpp.
References m_manager_sp.
Referenced by lldb_private::CommandInterpreter::CommandInterpreter(), lldb_private::Target::Target(), lldb_private::TargetList::TargetList(), lldb_private::Thread::Thread(), and lldb_private::ThreadedCommunication::ThreadedCommunication().
|
inline |
Definition at line 187 of file Broadcaster.h.
References m_broadcaster_sp.
Referenced by lldb_private::Process::Finalize(), lldb_private::CommandObjectDisassemble::CommandOptions::OptionParsingStarting(), and ~Broadcaster().
|
inline |
Definition at line 248 of file Broadcaster.h.
References m_broadcaster_sp.
Referenced by lldb_private::Thread::BroadcastSelectedFrameChange(), lldb::SBBroadcaster::EventTypeHasListeners(), NotifyChange(), PrivateReportDiagnostic(), PrivateReportProgress(), lldb_private::Thread::ReturnFromFrame(), and lldb_private::BreakpointLocation::SendBreakpointLocationChangedEvent().
|
virtual |
This needs to be filled in if you are going to register the broadcaster with the broadcaster manager and do broadcaster class matching.
FIXME: Probably should make a ManagedBroadcaster subclass with all the bits needed to work with the BroadcasterManager, so that it is clearer how to add one.
Reimplemented in lldb_private::ThreadedCommunication, lldb_private::CommandInterpreter, lldb_private::Process, lldb_private::Target, lldb_private::TargetList, and lldb_private::Thread.
Definition at line 314 of file Broadcaster.cpp.
Referenced by lldb_private::Debugger::DefaultEventHandler(), lldb::SBEvent::GetBroadcasterClass(), lldb_private::BroadcastEventSpec::operator<(), and lldb_private::BroadcasterManager::SignUpListenersForBroadcaster().
|
inlineprotected |
Definition at line 435 of file Broadcaster.h.
References m_broadcaster_sp.
Referenced by lldb_private::Listener::BroadcasterWillDestruct(), lldb_private::Listener::HandleBroadcastEvent(), lldb_private::Event::SetBroadcaster(), lldb_private::Listener::StartListeningForEvents(), and lldb_private::Listener::StopListeningForEvents().
|
inline |
Get the NULL terminated C string name of this Broadcaster object.
Definition at line 220 of file Broadcaster.h.
References m_broadcaster_name.
Referenced by lldb_private::Event::Dump(), lldb_private::Broadcaster::BroadcasterImpl::GetBroadcasterName(), lldb_private::Broadcaster::BroadcasterImpl::GetEventNames(), lldb::SBBroadcaster::GetName(), lldb_private::Broadcaster::BroadcasterImpl::HijackBroadcaster(), lldb_private::Broadcaster::BroadcasterImpl::PrivateBroadcastEvent(), lldb_private::Broadcaster::BroadcasterImpl::RestoreBroadcaster(), lldb_private::ThreadedCommunication::StartReadThread(), ~Broadcaster(), and lldb_private::ThreadedCommunication::~ThreadedCommunication().
|
inline |
Definition at line 244 of file Broadcaster.h.
References m_broadcaster_sp.
|
inline |
Get the event name(s) for one or more event bits.
[in] | event_mask | A bit mask that indicates which events to get names for. |
Definition at line 229 of file Broadcaster.h.
References m_broadcaster_sp.
Referenced by lldb_private::Event::Dump().
|
inlineprotected |
Definition at line 437 of file Broadcaster.h.
References m_broadcaster_sp.
Referenced by lldb_private::Process::StateChangedIsExternallyHijacked(), and lldb_private::Process::StateChangedIsHijackedForSynchronousResume().
lldb::BroadcasterManagerSP lldb_private::Broadcaster::GetManager | ( | ) |
|
inline |
Provides a simple mechanism to temporarily redirect events from broadcaster.
When you call this function passing in a listener and event type mask, all events from the broadcaster matching the mask will now go to the hijacking listener. Only one hijack can occur at a time. If we need more than this we will have to implement a Listener stack.
[in] | listener_sp | A Listener object. You do not need to call StartListeningForEvents for this broadcaster (that would fail anyway since the event bits would most likely be taken by the listener(s) you are usurping. |
[in] | event_mask | The event bits listener wishes to hijack. |
Definition at line 291 of file Broadcaster.h.
References m_broadcaster_sp.
Referenced by lldb_private::Process::HijackProcessEvents().
|
inline |
Definition at line 296 of file Broadcaster.h.
References m_broadcaster_sp.
Referenced by lldb_private::Process::HandlePrivateEvent(), lldb_private::Process::StateChangedIsExternallyHijacked(), and lldb_private::Process::StateChangedIsHijackedForSynchronousResume().
|
privatedelete |
|
inline |
Removes a Listener from this broadcasters list and frees the event bits specified by event_mask that were previously acquired by listener (assuming listener was listening to this object) for other listener objects to use.
[in] | listener_sp | A Listener object that previously called AddListener. |
[in] | event_mask | The event bits listener wishes to relinquish. |
Definition at line 268 of file Broadcaster.h.
References m_broadcaster_sp.
Referenced by lldb_private::Broadcaster::BroadcasterImpl::RemoveListener(), lldb::SBBroadcaster::RemoveListener(), and lldb_private::Listener::StopListeningForEvents().
|
inline |
Restore the state of the Broadcaster from a previous hijack attempt.
Definition at line 301 of file Broadcaster.h.
References m_broadcaster_sp.
Referenced by lldb_private::Process::RestoreProcessEvents().
|
inline |
Set the name for an event bit.
[in] | event_mask | A bit mask that indicates which events the listener is asking to monitor. |
Definition at line 240 of file Broadcaster.h.
References m_broadcaster_sp.
Referenced by lldb_private::CommandInterpreter::CommandInterpreter(), lldb_private::Target::Target(), and lldb_private::ThreadedCommunication::ThreadedCommunication().
|
inlinevirtual |
Reimplemented in lldb_private::Process.
Definition at line 312 of file Broadcaster.h.
References m_broadcaster_sp.
Referenced by lldb_private::Process::SetShadowListener().
|
friend |
Definition at line 147 of file Broadcaster.h.
Referenced by lldb_private::Process::SetPrivateState(), and lldb_private::CommandInterpreter::UpdatePrompt().
|
friend |
Definition at line 146 of file Broadcaster.h.
|
private |
The name of this broadcaster object.
Definition at line 446 of file Broadcaster.h.
Referenced by GetBroadcasterName().
|
private |
Definition at line 442 of file Broadcaster.h.
Referenced by AddListener(), BroadcastEvent(), BroadcastEventIfUnique(), Clear(), EventTypeHasListeners(), GetBroadcasterImpl(), GetEventName(), GetEventNames(), GetHijackingListenerName(), HijackBroadcaster(), IsHijackedForEvent(), RemoveListener(), RestoreBroadcaster(), SetEventName(), and SetShadowListener().
|
private |
Definition at line 443 of file Broadcaster.h.
Referenced by CheckInWithManager().