コード例 #1
0
//++
//------------------------------------------------------------------------------------
// Details: Unregister with the debugger, the SBListener, the type of events you
// are no
//          longer interested in. Others, like commands, may still remain
//          interested so
//          an event may not necessarily be stopped.
// Type:    Method.
// Args:    vClientName         - (R) ID of the client who no longer requires
// these events.
//          vBroadcasterClass   - (R) The SBBroadcaster's class name.
// Return:  MIstatus::success - Functionality succeeded.
//          MIstatus::failure - Functionality failed.
// Throws:  None.
//--
bool CMICmnLLDBDebugger::UnregisterForEvent(
    const CMIUtilString &vClientName, const CMIUtilString &vBroadcasterClass) {
  MIuint clientsEventMask = 0;
  if (!ClientGetTheirMask(vClientName, vBroadcasterClass, clientsEventMask))
    return MIstatus::failure;
  if (!ClientRemoveTheirMask(vClientName, vBroadcasterClass))
    return MIstatus::failure;

  const MIuint otherClientsEventMask =
      ClientGetMaskForAllClients(vBroadcasterClass);
  MIuint newEventMask = 0;
  for (MIuint i = 0; i < 32; i++) {
    const MIuint bit = 1 << i;
    const MIuint clientBit = bit & clientsEventMask;
    const MIuint othersBit = bit & otherClientsEventMask;
    if ((clientBit != 0) && (othersBit == 0)) {
      newEventMask += clientBit;
    }
  }

  const char *pBroadCasterName = vBroadcasterClass.c_str();
  if (!m_lldbListener.StopListeningForEventClass(
          m_lldbDebugger, pBroadCasterName, newEventMask)) {
    SetErrorDescription(
        CMIUtilString::Format(MIRSRC(IDS_LLDBDEBUGGER_ERR_STOPLISTENER),
                              vClientName.c_str(), pBroadCasterName));
    return MIstatus::failure;
  }

  return BroadcasterSaveMask(vBroadcasterClass, otherClientsEventMask);
}
コード例 #2
0
//++ ------------------------------------------------------------------------------------
// Details:	Given the client save its particular event requirements.
// Type:	Method.
// Args:	vClientName			- (R) The Client's unique ID.
//			vBroadcasterClass	- (R) The SBBroadcaster's class name targeted for the events.
//			vEventMask			- (R) The mask of events to listen for.
// Return:	MIstatus::success - Functionality succeeded.
//			MIstatus::failure - Functionality failed.
// Throws:	None.
//--
bool CMICmnLLDBDebugger::ClientSaveMask( const CMIUtilString & vClientName, const CMIUtilString & vBroadcasterClass, const MIuint vEventMask )
{
	if( vClientName.empty() )
	{
		SetErrorDescription( CMIUtilString::Format( MIRSRC( IDS_LLDBDEBUGGER_ERR_INVALIDCLIENTNAME ), vClientName.c_str() ) );
		return MIstatus::failure;
	}

	CMIUtilString strId( vBroadcasterClass );
	strId += vClientName;

	ClientRemoveTheirMask( vClientName, vBroadcasterClass );
	MapPairIdToEventMask_t pr( strId, vEventMask );
	m_mapIdToEventMask.insert( pr );

	return MIstatus::success;
}