コード例 #1
0
DebuggerPerlDBGP::DebuggerPerlDBGP(LanguageSettings* langs)
    : AbstractDebugger(langs), m_name("perldbgp"), m_isRunning(false), m_isJITActive(false),
      m_listenPort(-1), m_currentExecutionPoint(0), m_globalExecutionPoint(0), 
      m_pdbgSettings(0), m_net(0)
{
  m_pdbgSettings = new PerlDBGPSettings(Protoeditor::self()->settings()->configFile(),
      name(), label(), langSettings());

  langSettings()->registerDebuggerSettings(name(), m_pdbgSettings);

  m_currentExecutionPoint = new DebuggerExecutionPoint();
  m_globalExecutionPoint  = new DebuggerExecutionPoint();


  connect(Protoeditor::self()->settings(), SIGNAL(sigSettingsChanged()),
          this, SLOT(slotSettingsChanged()));

  m_net = new PerlDBGPNet(this);
  connect(m_net, SIGNAL(sigStarted()), this, SLOT(slotStarted()));
  connect(m_net, SIGNAL(sigClosed()), this, SLOT(slotStopped()));
  connect(m_net, SIGNAL(sigError(const QString&)), this, SIGNAL(sigInternalError(const QString&)));
  connect(m_net, SIGNAL(sigStepDone()), this, SLOT(slotStepDone()));
  connect(m_net, SIGNAL(sigNewConnection()), this, SLOT(slotNewConnection()));
  //connect(m_net, SIGNAL(sigBreakpoint()), this, SLOT(slotBreakpoint()));  
}
コード例 #2
0
DebuggerDBG::DebuggerDBG(DebuggerManager* parent)
    : AbstractDebugger(parent), m_isSessionActive(false), m_isRunning(false),
    m_configuration(0), m_net(0), m_currentExecutionPoint(0)

{
  m_configuration = new DBGConfiguration(
                      Settings::localBaseDir(),
                      Settings::serverBaseDir(),
                      Settings::listenPort(),
                      Settings::serverHost());

  m_net = new DBGNet(this);

  connect(m_net, SIGNAL(sigDBGStarted()), this, SLOT(slotDBGStarted()));
  connect(m_net, SIGNAL(sigDBGClosed()), this, SLOT(slotDBGClosed()));
  connect(m_net, SIGNAL(sigError(const QString&)), this, SLOT(slotInternalError(const QString&)));
  connect(m_net, SIGNAL(sigStepDone()), this, SLOT(slotStepDone()));
}
コード例 #3
0
void DebuggerManager::connectDebugger()
{

  connect(m_debugger, SIGNAL(sigDebugStarted()),
          this, SLOT(slotDebugStarted()));

  connect(m_debugger, SIGNAL(sigDebugEnded()),
          this, SLOT(slotDebugEnded()));

  connect(m_debugger, SIGNAL(sigInternalError(const QString&)),
          this, SLOT(slotInternalError(const QString&)));

  connect(m_debugger, SIGNAL(sigStepDone()),
          this, SLOT(slotStepDone()));

  connect(m_debugger, SIGNAL(sigBreakpointReached()),
          this, SLOT(slotBreakpointReached()));
}
コード例 #4
0
DebuggerDBG::DebuggerDBG(DebuggerManager* parent)
    : AbstractDebugger(parent), m_name("DBG"), m_isJITActive(false), m_isRunning(false),
    m_listenPort(-1), m_dbgSettings(0), m_net(0), m_profileDialog(0),
    m_currentExecutionPointID(CURLOC_SCOPE_ID), m_globalExecutionPointID(GLOBAL_SCOPE_ID)
{
  m_dbgSettings = new DBGSettings(m_name);

  ProtoeditorSettings::self()->registerDebuggerSettings(m_dbgSettings, m_name);

  connect(ProtoeditorSettings::self(), SIGNAL(sigSettingsChanged()),
          this, SLOT(slotSettingsChanged()));

  m_net = new DBGNet(this);
  m_net->setOptions(getDBGOptions());

  connect(m_net, SIGNAL(sigDBGStarted()), this, SLOT(slotDBGStarted()));
  connect(m_net, SIGNAL(sigDBGClosed()), this, SLOT(slotDBGClosed()));
  connect(m_net, SIGNAL(sigError(const QString&)), this, SIGNAL(sigInternalError(const QString&)));
  connect(m_net, SIGNAL(sigStepDone()), this, SLOT(slotStepDone()));
  connect(m_net, SIGNAL(sigBreakpoint()), this, SLOT(slotBreakpoint()));
}
コード例 #5
0
DebuggerXD::DebuggerXD(DebuggerManager* manager)
    : AbstractDebugger(manager), m_name("Xdebug"), m_isRunning(false), m_isJITActive(false),
      m_listenPort(-1), m_currentExecutionPoint(0), m_globalExecutionPoint(0), 
      m_xdSettings(0), m_net(0)
{
  m_currentExecutionPoint = new DebuggerExecutionPoint();
  m_globalExecutionPoint = new DebuggerExecutionPoint();

  m_xdSettings = new XDSettings(m_name);

  ProtoeditorSettings::self()->registerDebuggerSettings(m_xdSettings, m_name);

  connect(ProtoeditorSettings::self(), SIGNAL(sigSettingsChanged()),
          this, SLOT(slotSettingsChanged()));

  m_net = new XDNet(this);
  connect(m_net, SIGNAL(sigXDStarted()), this, SLOT(slotXDStarted()));
  connect(m_net, SIGNAL(sigXDClosed()), this, SLOT(slotXDStopped()));
  connect(m_net, SIGNAL(sigError(const QString&)), this, SIGNAL(sigInternalError(const QString&)));
  connect(m_net, SIGNAL(sigStepDone()), this, SLOT(slotStepDone()));
  //connect(m_net, SIGNAL(sigBreakpoint()), this, SLOT(slotBreakpoint()));
}
コード例 #6
0
ファイル: dbgnet.cpp プロジェクト: thiago-silva/protoeditor
bool DBGNet::processHeader(DBGHeader* header)
{
  if(header->sync() != DBGSYNC) {
    error("Network sync error.");
    return false;
  }

  switch(header->cmd()) {
    case DBGC_REPLY:
    case DBGC_END:
    case DBGC_EMBEDDED_BREAK:
    case DBGC_ERROR:
    case DBGC_LOG:
    case DBGC_SID:
    case DBGC_PAUSE:
      break;
    case DBGC_STARTUP:
      //so lets start too
      m_requestor->addHeaderFlags(DBGF_STARTED);

      //ask for module information
      m_requestor->requestSrcTree();

      //is annoying having to step twice in the begginig. Lets do the the first.
      m_requestor->requestStepInto();

      //tell everyone we are ok.
      emit sigDBGStarted();
      break;
    case DBGC_BREAKPOINT:
    case DBGC_STEPINTO_DONE:
    case DBGC_STEPOVER_DONE:
    case DBGC_STEPOUT_DONE:
      m_requestor->requestSrcTree();
      emit sigStepDone();
      break;
  }
  return true;
}
コード例 #7
0
DebuggerGB::DebuggerGB(DebuggerManager* manager)
    : AbstractDebugger(manager), m_name("Gubed"), m_isRunning(false), m_isJITActive(false),
      m_listenPort(-1), m_currentExecutionPoint(0), m_globalExecutionPoint(0), 
      m_gbSettings(0), m_net(0)
{
  m_currentExecutionPoint = new DebuggerExecutionPoint();
  m_globalExecutionPoint = new DebuggerExecutionPoint();

  m_gbSettings = new GBSettings(m_name);

  ProtoeditorSettings::self()->registerDebuggerSettings(m_gbSettings, m_name);

  connect(ProtoeditorSettings::self(), SIGNAL(sigSettingsChanged()),
          this, SLOT(slotSettingsChanged()));

  m_net = new GBNet(this);
  connect(m_net, SIGNAL(sigGBStarted()), this, SLOT(slotGBStarted()));
  connect(m_net, SIGNAL(sigGBClosed()), this, SLOT(slotGBClosed()));
  connect(m_net, SIGNAL(sigError(const QString&)), this, SIGNAL(sigInternalError(const QString&)));
  connect(m_net, SIGNAL(sigStepDone()), this, SLOT(slotStepDone()));
  connect(m_net, SIGNAL(sigNewConnection()), this, SLOT(slotNewConnection()));
}
コード例 #8
0
void UIPrepareStep::sltStepDone()
{
    emit sigStepDone(m_strStepId);
}
コード例 #9
0
ファイル: xdnet.cpp プロジェクト: thiago-silva/protoeditor
void XDNet::processResponse(QDomElement& root)
{
  QString cmd = root.attribute("command");

  if((cmd == "step_into") ||
      (cmd == "step_over") ||
      (cmd == "step_out") ||
      (cmd == "run"))
  {
    if((root.attribute("status") == "break"))
    {
      if(root.attribute("reason") == "error")
      {
        processError(root.firstChild().toElement());
      }

      requestStack();
      requestBreakpointList();
    }
    else if(root.attribute("status") == "stopped")
    {
      //nothing...
    }
    else
    {
      error(QString("Unknown error\ncommand: ") + cmd +
            "\nstatus: " + root.attribute("status") +
            "\nreason: " + root.attribute("reason"));
    }
  }
  else if(cmd == "stack_get")
  {
    QDomNodeList list = root.elementsByTagName("stack");
    QDomElement st;
    DebuggerStack* stack = new DebuggerStack();
    for(uint i = 0; i < list.count(); i++)
    {
      st = list.item(i).toElement();
      int level = st.attributeNode("level").value().toInt();
      int line = st.attributeNode("lineno").value().toInt();

      KURL file = st.attributeNode("filename").value();
      QString where = st.attributeNode("where").value();

      if((where == "{main}") || (where == "include"))
      {
        where = file.path() + "::main()";
      }

      //to local filepath
      QString localFile;

      SiteSettings* site = ProtoeditorSettings::self()->currentSiteSettings();
      if(site) 
      {
        localFile = site->localBaseDir()
                            + file.path().remove(0, site->remoteBaseDir().length());
      }
      else
      {
        localFile = file.path();
      }
      stack->insert(level, localFile, line, where);
    }

    //request global/local vars
    //requestVariables(stack->bottomExecutionPoint()->id(), XDNet::GLOBAL_SCOPE);
    //requestVariables(stack->topExecutionPoint()->id(), XDNet::LOCAL_SCOPE);


    //update stack
    m_debugger->updateStack(stack);

    emit sigStepDone();

    processPendingData();
  }
  else if(cmd == "context_get")
  {
    QDomNodeList list = root.childNodes();
    XDVariableParser p;

    VariablesList_t* array = p.parse(list);

    if(root.attributeNode("transaction_id").value().toInt() == LocalScopeId)
    {
      m_debugger->updateVariables(array, false);
    }
    else if(root.attributeNode("transaction_id").value().toInt() == GlobalScopeId)
    {
      if(root.attributeNode("transaction_id").value().toInt() ==
          GlobalScopeId && m_debugger->settings()->sendSuperGlobals())
      {
        m_globalVars = array;
      }
      else
      {
        m_debugger->updateVariables(array, true);
      }
    }
  }
  else if(cmd == "property_get")
  {
    QDomNode nd = root.firstChild();
    XDVariableParser p;

    Variable* var = p.parse(nd);
    if(root.attributeNode("transaction_id").value().toInt() == SuperGlobalId)
    {
      m_globalVars->append(var);
      m_superglobalsCount--;

      if(m_superglobalsCount == 0)
      {
        m_debugger->updateVariables(m_globalVars, true);
      }
    }
    else
    {
      m_debugger->updateWatch(var);
    }
  }
  else if((cmd == "stop") ||
          (cmd == "breakpoint_remove") ||
          (cmd == "stdout") ||
          (cmd == "stderr"))
  {
    //nothing..
  }
  else if((cmd == "breakpoint_set") || (cmd == "breakpoint_update"))
  {
    requestBreakpointList();
  }
  else if(cmd == "breakpoint_list")
  {
    /*
    <response command="breakpoint_list" transaction_id="1">
      <breakpoint type="line" filename="file:///usr/local/apache/htdocs/texto.php"
        lineno="9" state="enabled" id="157470001">
      </breakpoint>
      <breakpoint type="line" filename="file:///usr/local/apache/htdocs/texto.php" lineno="10" state="enabled" id="157470002">
      </breakpoint>
    </response>

    */
    QDomNodeList list = root.elementsByTagName("breakpoint");
    QDomElement e;
    for(uint i = 0; i < list.count(); i++)
    {
      e = list.item(i).toElement();
      int id = e.attributeNode("id").value().toInt();
      QString filePath = KURL(e.attributeNode("filename").value()).path();
      int line = e.attributeNode("lineno").value().toInt();
      QString state = e.attributeNode("state").value();
      int hitCount = e.attributeNode("hit_count").value().toInt();
      int skip = e.attributeNode("hit_value").value().toInt();
      QString condition = e.attributeNode("condition").value();

      m_debugger->updateBreakpoint(id, filePath, line, state, hitCount, skip, condition);
    }
  }
  else
  {
    error(QString("Unknow network packet: ") + cmd);
  }
}
コード例 #10
0
ファイル: dbgnet.cpp プロジェクト: thiago-silva/protoeditor
bool DBGNet::processHeader(DBGHeader* header)
{
  if(header->sync() != DBGSYNC)
  {
    error("Network sync error.");
    return false;
  }

  //TODO: create dbgStarted() and dbgStepDone() to organize this.

  switch(header->cmd())
  {
    case DBGC_REPLY:
      break;
    case DBGC_END:
      break;
    case DBGC_EMBEDDED_BREAK:
      break;
    case DBGC_ERROR:
      if(m_isProfiling)
      {
        error("PHP could not execute the script. Check for errors before running the profiler.");
        return false;
      }
      break;
    case DBGC_LOG:
    case DBGC_SID:
    case DBGC_PAUSE:
      break;
    case DBGC_STARTUP:
      //so lets start too...
      m_requestor->addHeaderFlags(DBGF_STARTED);

      //...sending options...
      m_requestor->requestOptions(m_opts);

      //...tell everyone we are running.
      if(!m_isProfiling)
      {
        emit sigDBGStarted();
      }

      //...fancy notification on taskbar
      KNotifyClient::userEvent(0, "", KNotifyClient::Taskbar);

      if(m_isProfiling)
      {
        m_requestor->requestStepInto();
        
        //get module info
//      m_requestor->requestSrcTree();
        //get frequency info
        
        m_requestor->requestProfileFreqData(TEST_LOOPS);
        //get lines info to set temp breakpoint on the last valid line
        m_requestor->requestSrcLinesInfo(1);
        break;
      }

      if(!(m_opts & SOF_BREAKONLOAD))
      {
        //workaround for my lazyness (I don't know why setting SOF_BREAKONLOAD
        //is not enough to avoid the load break)
        m_requestor->requestContinue();
      }
      else
      {

        //...asking for module information..
        m_requestor->requestSrcTree();

        //workaround for the double step on the begginning
        //is annoying having to step twice in the begginig. Lets do the the first.
        m_requestor->requestStepInto();
      }

      break;
    case DBGC_BREAKPOINT:
      if(!m_isProfiling)
      {
        emit sigBreakpoint();
        processStepData();
      }
      else
      {
        processProfileData();
      }
      break;
    case DBGC_STEPINTO_DONE:
    case DBGC_STEPOVER_DONE:
    case DBGC_STEPOUT_DONE:
      if(!m_isProfiling)
      {
        emit sigStepDone();
        processStepData();
      }
      break;
  }
  return true;
}