Logo Search packages:      
Sourcecode: kdbg version File versions

CmdQueueItem * DebuggerDriver::queueCmdString ( DbgCommand  cmd,
QString  cmdString,
QueueMode  mode 
) [protected]

Helper function that queues the given command string in the low-priority queue.

Definition at line 163 of file dbgdriver.cpp.

References m_activeCmd, CmdQueueItem::m_cmd, and CmdQueueItem::m_cmdString.

{
    // place a new command into the low-priority queue
    CmdQueueItem* cmdItem = 0;
    switch (mode) {
    case QMoverrideMoreEqual:
    case QMoverride:
      // check whether gdb is currently processing this command
      if (m_activeCmd != 0 &&
          m_activeCmd->m_cmd == cmd && m_activeCmd->m_cmdString == cmdString)
      {
          return m_activeCmd;
      }
      // check whether there is already the same command in the queue
      for (cmdItem = m_lopriCmdQueue.first(); cmdItem != 0; cmdItem = m_lopriCmdQueue.next()) {
          if (cmdItem->m_cmd == cmd && cmdItem->m_cmdString == cmdString)
            break;
      }
      if (cmdItem != 0) {
          // found one
          if (mode == QMoverrideMoreEqual) {
            // All commands are equal, but some are more equal than others...
            // put this command in front of all others
            m_lopriCmdQueue.take();
            m_lopriCmdQueue.insert(0, cmdItem);
          }
          break;
      } // else none found, so add it
      // drop through
    case QMnormal:
      cmdItem = new CmdQueueItem(cmd, cmdString);
      m_lopriCmdQueue.append(cmdItem);
    }

    // if gdb is idle, send it the command
    if (m_state == DSidle) {
      ASSERT(m_activeCmd == 0);
      writeCommand();
    }

    return cmdItem;
}


Generated by  Doxygen 1.6.0   Back to index