コード例 #1
0
void NodeJSDebugger::GotControl(bool requestBacktrace)
{
    SetCanInteract(true);
    EventNotifier::Get()->TopFrame()->Raise();
    if(requestBacktrace) {
        Callstack();
    }
}
コード例 #2
0
ファイル: VRSDClient.cpp プロジェクト: cDoru/projectanarchy
void VRSDClient::HandleDebuggingMessage(VMessage* pMessage)
{
  if(!pMessage || !m_pClientLanguageImplementation)
    return;

  // Handle debugging messages here

  switch(pMessage->GetMessageType())
  {
    case 'RSRN':
      HandleScriptReloadMessage(pMessage);
      break;

    case 'GCST':
      {
        // get the callstack from the scripting language implementation
        DynArray_cl<VRSDClientCallstackEntry> Callstack(16);
        unsigned int CallstackEntryCount = 0;
        
        m_pClientLanguageImplementation->GetCallstack(Callstack, CallstackEntryCount);
        
        // send it
        SendCallstack(Callstack, CallstackEntryCount);
      }

      break;

    case 'GGSY':
      {
        // get the global symbol collection from the scripting language implementation
        DynArray_cl<VRSDScriptSymbol> globalSymbols(32, VRSDScriptSymbol());
        unsigned int iGlobalSymbolCount = 0;

        m_pClientLanguageImplementation->GetGlobalSymbols(globalSymbols, iGlobalSymbolCount);

        // send it
        SendSymbols('GSYC', globalSymbols, iGlobalSymbolCount);
      }


      break;

    case 'GLSY':
      {
        // get the local symbol collection from the scripting language implementation
        DynArray_cl<VRSDScriptSymbol> localSymbols(16, VRSDScriptSymbol());
        unsigned int iLocalSymbolCount = 0;

        m_pClientLanguageImplementation->GetLocalSymbols(localSymbols, iLocalSymbolCount);

        // send it
        SendSymbols('LSYC', localSymbols, iLocalSymbolCount);
      }

      break;

    case 'GSFG':
      {
        // read the symbol name for which the subsymbols are requested
        char* pSymbolName = NULL;
        if(pMessage->ReadString(&pSymbolName))
        {
          // get the global symbol collection from the scripting language implementation
          DynArray_cl<VRSDScriptSymbol> globalSymbols(16, VRSDScriptSymbol());
          unsigned int iGlobalSymbolCount = 0;

          if(m_pClientLanguageImplementation->GetSubSymbolsForGlobal(pSymbolName, globalSymbols, iGlobalSymbolCount))
          {
            // send it
            SendSymbols('GSSC', globalSymbols, iGlobalSymbolCount, pSymbolName);
          }
        }
      }
      break;

    case 'GSFL':
      {
        // read the symbol name for which the subsymbols are requested
        char* pSymbolName = NULL;
        if(pMessage->ReadString(&pSymbolName))
        {
          // get the global symbol collection from the scripting language implementation
          DynArray_cl<VRSDScriptSymbol> localSymbols(16, VRSDScriptSymbol());
          unsigned int iLocalSymbolCount = 0;

          if(m_pClientLanguageImplementation->GetSubSymbolsForLocal(pSymbolName, localSymbols, iLocalSymbolCount))
          {
            // send it
            SendSymbols('LSSC', localSymbols, iLocalSymbolCount, pSymbolName);
          }
        }
      }
      break;

      // get userdata type (local / global)
    case 'GUDT':
    case 'LUDT':
      {
        // read first the variable name we should check
        char* pVariableName = NULL;
        if(!pMessage->ReadString(&pVariableName))
          break;

        char pUserDataTypeName[512];
        bool success;

        if(pMessage->GetMessageType() == 'GUDT')
          success = m_pClientLanguageImplementation->GetGlobalType(pVariableName, pUserDataTypeName);
        else
          success = m_pClientLanguageImplementation->GetLocalType(pVariableName, pUserDataTypeName);

        if(success)
        {
          VMessage msg('VUDT', (int)strlen(pUserDataTypeName) + 5);
          msg.Write(pUserDataTypeName);

          VMutexLocker lock(m_ConnectionMutex);
          if(m_pConnection)
            m_pConnection->Send(&msg);
        }
        else
        {
          // if no type is found submit that
          VMessage msg('VUDT', 5);
          msg.Write("");

          VMutexLocker lock(m_ConnectionMutex);
          if(m_pConnection)
            m_pConnection->Send(&msg);
        }
      }
      break;

    // update the value of a variable (non userdata = strings, bools, numbers)
    case 'LVCU':
    case 'GVCU':
      UpdateVariable(pMessage);
      break;

    // request for user data update
    case 'LUDU':
    case 'GUDU':
      UpdateUserDataVariable(pMessage);
      break;

    // request for local user data members
    case 'LUDM':
    case 'GUDM':
      HandleUserDataMemberRequest(pMessage);
      break;
  }
}