LLDB
mainline
|
#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. More... | |
virtual | ~Broadcaster () |
Destructor. More... | |
void | CheckInWithManager () |
void | BroadcastEvent (lldb::EventSP &event_sp) |
Broadcast an event which has no associated data. More... | |
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. More... | |
ConstString | GetBroadcasterName () |
Get the NULL terminated C string name of this Broadcaster object. More... | |
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. More... | |
void | SetEventName (uint32_t event_mask, const char *name) |
Set the name for an event bit. More... | |
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. More... | |
bool | HijackBroadcaster (const lldb::ListenerSP &listener_sp, uint32_t event_mask=UINT32_MAX) |
Provides a simple mechanism to temporarily redirect events from broadcaster. More... | |
bool | IsHijackedForEvent (uint32_t event_mask) |
void | RestoreBroadcaster () |
Restore the state of the Broadcaster from a previous hijack attempt. More... | |
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. More... | |
lldb::BroadcasterManagerSP | GetManager () |
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. More... | |
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 242 of file Broadcaster.h.
|
protected |
Definition at line 521 of file Broadcaster.h.
|
protected |
Definition at line 522 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 308 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 262 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(), ProcessKDP::DoResume(), lldb_private::process_gdb_remote::ProcessGDBRemote::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::TargetList::SendAsyncInterrupt(), lldb_private::Process::SendAsyncInterrupt(), lldb_private::Breakpoint::SendBreakpointChangedEvent(), lldb_private::BreakpointLocation::SendBreakpointLocationChangedEvent(), lldb_private::Watchpoint::SendWatchpointChangedEvent(), lldb_private::Process::SetPrivateState(), ProcessKDP::StopAsyncThread(), lldb_private::Debugger::StopEventHandlerThread(), lldb_private::ThreadedCommunication::StopReadThread(), and lldb_private::Target::SymbolsDidLoad().
|
inline |
Definition at line 270 of file Broadcaster.h.
References m_broadcaster_sp.
|
inline |
Definition at line 275 of file Broadcaster.h.
References m_broadcaster_sp.
|
inline |
Definition at line 266 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 279 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 284 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 345 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::Target, lldb_private::Process, lldb_private::CommandInterpreter, lldb_private::ThreadedCommunication, lldb_private::Thread, and lldb_private::TargetList.
Definition at line 310 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 524 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 317 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 341 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 326 of file Broadcaster.h.
References m_broadcaster_sp.
Referenced by lldb_private::Event::Dump().
|
inlineprotected |
Definition at line 526 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 388 of file Broadcaster.h.
References m_broadcaster_sp.
Referenced by lldb_private::Process::HijackProcessEvents().
|
inline |
Definition at line 393 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 365 of file Broadcaster.h.
References m_broadcaster_sp.
Referenced by lldb::SBBroadcaster::RemoveListener(), lldb_private::Broadcaster::BroadcasterImpl::RemoveListener(), and lldb_private::Listener::StopListeningForEvents().
|
inline |
Restore the state of the Broadcaster from a previous hijack attempt.
Definition at line 398 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 337 of file Broadcaster.h.
References m_broadcaster_sp.
Referenced by lldb_private::CommandInterpreter::CommandInterpreter(), lldb_private::Target::Target(), and lldb_private::ThreadedCommunication::ThreadedCommunication().
|
friend |
Definition at line 244 of file Broadcaster.h.
Referenced by lldb_private::Process::SetPrivateState().
|
friend |
Definition at line 243 of file Broadcaster.h.
|
private |
The name of this broadcaster object.
Definition at line 535 of file Broadcaster.h.
Referenced by GetBroadcasterName().
|
private |
Definition at line 531 of file Broadcaster.h.
Referenced by AddListener(), BroadcastEvent(), BroadcastEventIfUnique(), Clear(), EventTypeHasListeners(), GetBroadcasterImpl(), GetEventName(), GetEventNames(), GetHijackingListenerName(), HijackBroadcaster(), IsHijackedForEvent(), RemoveListener(), RestoreBroadcaster(), and SetEventName().
|
private |
Definition at line 532 of file Broadcaster.h.
Referenced by CheckInWithManager().