diff --git a/debuggers/common/mi/mi.h b/debuggers/common/mi/mi.h index 67d578163f..52b2b331c5 100644 --- a/debuggers/common/mi/mi.h +++ b/debuggers/common/mi/mi.h @@ -1,422 +1,372 @@ /*************************************************************************** * Copyright (C) 2004 by Roberto Raggi * * roberto@kdevelop.org * * Copyright (C) 2005-2006 by Vladimir Prus * * ghost@cs.msu.su * * Copyright (C) 2016 by Aetf * * aetf@unlimitedcodeworks.xyz * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 of the * * License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef GDBMI_H #define GDBMI_H #include #include #include /** @author Roberto Raggi @author Vladimir Prus */ namespace KDevMI { namespace MI { enum CommandType { NonMI, BreakAfter, - BreakCatch, BreakCommands, BreakCondition, BreakDelete, BreakDisable, BreakEnable, BreakInfo, BreakInsert, BreakList, BreakWatch, DataDisassemble, DataEvaluateExpression, DataListChangedRegisters, DataListRegisterNames, DataListRegisterValues, DataReadMemory, DataWriteMemory, DataWriteRegisterVariables, EnablePrettyPrinting, EnableTimings, EnvironmentCd, EnvironmentDirectory, EnvironmentPath, EnvironmentPwd, ExecAbort, ExecArguments, ExecContinue, ExecFinish, ExecInterrupt, ExecNext, ExecNextInstruction, - ExecReturn, ExecRun, - ExecShowArguments, - ExecSignal, ExecStep, ExecStepInstruction, ExecUntil, - FileClear, FileExecAndSymbols, FileExecFile, - FileListExecSections, FileListExecSourceFile, FileListExecSourceFiles, - FileListSharedLibraries, - FileListSymbolFiles, FileSymbolFile, - GdbComplete, GdbExit, GdbSet, GdbShow, - GdbSource, GdbVersion, InferiorTtySet, InferiorTtyShow, InterpreterExec, ListFeatures, - OverlayAuto, - OverlayListMappingState, - OverlayListOverlays, - OverlayMap, - OverlayOff, - OverlayOn, - OverlayUnmap, - SignalHandle, - SignalListHandleActions, - SignalListSignalTypes, StackInfoDepth, StackInfoFrame, StackListArguments, - StackListExceptionHandlers, StackListFrames, StackListLocals, StackSelectFrame, - SymbolInfoAddress, - SymbolInfoFile, - SymbolInfoFunction, - SymbolInfoLine, - SymbolInfoSymbol, - SymbolListFunctions, SymbolListLines, - SymbolListTypes, - SymbolListVariables, - SymbolLocate, - SymbolType, TargetAttach, - TargetCompareSections, TargetDetach, TargetDisconnect, TargetDownload, - TargetExecStatus, - TargetListAvailableTargets, - TargetListCurrentTargets, - TargetListParameters, TargetSelect, ThreadInfo, - ThreadListAllThreads, ThreadListIds, ThreadSelect, - TraceActions, - TraceDelete, - TraceDisable, - TraceDump, - TraceEnable, - TraceExists, TraceFind, - TraceFrameNumber, - TraceInfo, - TraceInsert, - TraceList, - TracePassCount, - TraceSave, TraceStart, TraceStop, VarAssign, VarCreate, VarDelete, VarEvaluateExpression, VarInfoPathExpression, - VarInfoExpression, VarInfoNumChildren, VarInfoType, VarListChildren, VarSetFormat, VarSetFrozen, VarShowAttributes, VarShowFormat, VarUpdate }; /** Exception that is thrown when we're trying to invoke an operation that is not supported by specific MI value. For example, trying to index a string literal. Such errors are conceptually the same as assert, but in GUI we can't use regular assert, and Q_ASSERT, which only prints a message, is not suitable either. We need to break processing, and the higher-level code can report "Internal parsing error", or something. Being glorified assert, this exception does not cary any useful information. */ class type_error : public std::logic_error { public: type_error(); }; /** Base class for all MI values. MI values are of three kinds: - String literals - Lists (indexed by integer) - Tuple (set of named values, indexed by name) The structure of response to a specific gdb command is fixed. While any tuples in response may omit certain named fields, the kind of each item never changes. That is, response to specific command can't contains sometimes string and sometimes tuple in specific position. Because of that static structure, it's almost never needed to query dynamic type of a MI value. Most often we know it's say, tuple, and can subscripts it. So, the Value class has methods for accessing all kinds of values. Attempting to call a method that is not applicable to specific value will result in exception. The client code will almost never need to cast from 'Value' to its derived classes. Note also that all methods in this class are const and return const Value&. That's by design -- there's no need to modify gdb responses in GUI. */ struct Value { Value() : kind(StringLiteral) {} private: // Copy disabled to prevent slicing. Value(const Value&); Value& operator=(const Value&); public: virtual ~Value() {} enum { StringLiteral, Tuple, List } kind; /** If this value is a string literals, returns the string value. Othewise, throws type_error. */ virtual QString literal() const; //NOTE: Wouldn't it be better to use literal().toInt and get rid of that? /** If the value is a string literal, converts it to int and returns. If conversion fails, or the value cannot be converted to int, throws type_error. */ virtual int toInt(int base = 10) const; /** If this value is a tuple, returns true if the tuple has a field named 'variable'. Otherwise, throws type_error. */ virtual bool hasField(const QString& variable) const; /** If this value is a tuple, and contains named field 'variable', returns it. Otherwise, throws 'type_error'. This method is virtual, and derived in base class, so that we can save on casting, when we know for sure that instance is TupleValue, or ListValue. */ virtual const Value& operator[](const QString& variable) const; /** If this value is a list, returns true if the list is empty. If this value is not a list, throws 'type_error'. */ virtual bool empty() const; /** If this value is a list, returns it's size. Otherwise, throws 'type_error'. */ virtual int size() const; /** If this value is a list, returns the element at 'index'. Otherwise, throws 'type_error'. */ virtual const Value& operator[](int index) const; }; /** @internal Internal class to represent name-value pair in tuples. */ struct Result { Result() : value(0) {} ~Result() { delete value; value = 0; } QString variable; Value *value; }; struct StringLiteralValue : public Value { StringLiteralValue(const QString &lit) : literal_(lit) { Value::kind = StringLiteral; } public: // Value overrides QString literal() const override; int toInt(int base) const override; private: QString literal_; }; struct TupleValue : public Value { TupleValue() { Value::kind = Tuple; } ~TupleValue(); bool hasField(const QString&) const override; using Value::operator[]; const Value& operator[](const QString& variable) const override; QList results; QMap results_by_name; }; struct ListValue : public Value { ListValue() { Value::kind = List; } ~ListValue(); bool empty() const override; int size() const override; using Value::operator[]; const Value& operator[](int index) const override; QList results; }; struct Record { virtual ~Record() {} virtual QString toString() const { Q_ASSERT( 0 ); return QString::null; } enum { Prompt, Stream, Result, Async } kind; }; struct TupleRecord : public Record, public TupleValue { }; struct ResultRecord : public TupleRecord { ResultRecord(const QString& reason) : token(0) , reason(reason) { Record::kind = Result; } uint32_t token; QString reason; }; struct AsyncRecord : public TupleRecord { enum Subkind { Exec, Status, Notify }; AsyncRecord(Subkind subkind, const QString& reason) : subkind(subkind) , reason(reason) { Record::kind = Async; } Subkind subkind; QString reason; }; struct PromptRecord : public Record { inline PromptRecord() { Record::kind = Prompt; } virtual QString toString() const override { return "(prompt)\n"; } }; struct StreamRecord : public Record { enum Subkind { /// Console stream: usual CLI output of GDB in response to non-MI commands Console, /// Target output stream (stdout/stderr of the inferior process, only in some /// scenarios - usually we get stdout/stderr via other means) Target, /// Log stream: GDB internal messages that should be displayed as part of an error log Log }; StreamRecord(Subkind subkind) : subkind(subkind) { Record::kind = Stream; } Subkind subkind; QString message; }; } // end of namespace MI } // end of namespace KDevMI #endif diff --git a/debuggers/common/mi/micommand.cpp b/debuggers/common/mi/micommand.cpp index f83374050f..d07bf673a8 100644 --- a/debuggers/common/mi/micommand.cpp +++ b/debuggers/common/mi/micommand.cpp @@ -1,637 +1,489 @@ /*************************************************************************** begin : Sun Aug 8 1999 copyright : (C) 1999 by John Birch email : jbb@kdevelop.org ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "micommand.h" #include using namespace KDevMI::MI; FunctionCommandHandler::FunctionCommandHandler(const FunctionCommandHandler::Function& callback, CommandFlags flags) : _flags(flags) , _callback(callback) { } bool FunctionCommandHandler::handlesError() { return _flags & CmdHandlesError; } void FunctionCommandHandler::handle(const ResultRecord& r) { _callback(r); } MICommand::MICommand(CommandType type, const QString& command, CommandFlags flags) : type_(type) , flags_(flags) , command_(command) , commandHandler_(nullptr) , stateReloading_(false) , m_thread(-1) , m_frame(-1) { } MICommand::~MICommand() { if (commandHandler_ && commandHandler_->autoDelete()) { delete commandHandler_; } commandHandler_ = nullptr; } QString MICommand::cmdToSend() { return initialString() + '\n'; } QString MICommand::initialString() const { QString result = QString::number(token()); if (type() == NonMI) { result += command_; } else { result += miCommand(); if (m_thread != -1) result = result + QString(" --thread %1").arg(m_thread); if (m_frame != -1) result = result + QString(" --frame %1").arg(m_frame); if (!command_.isEmpty()) result += ' ' + command_; } return result; } bool MICommand::isUserCommand() const { return false; } void MICommand::setHandler(MICommandHandler* handler) { if (commandHandler_ && commandHandler_->autoDelete()) delete commandHandler_; commandHandler_ = handler; if (!commandHandler_) { flags_ = flags_ & ~CmdHandlesError; } } void MICommand::setHandler(const FunctionCommandHandler::Function& callback) { setHandler(new FunctionCommandHandler(callback, flags())); } bool MICommand::invokeHandler(const ResultRecord& r) { if (commandHandler_) { //ask before calling handler as it might deleted itself in handler bool autoDelete = commandHandler_->autoDelete(); commandHandler_->handle(r); if (autoDelete) { delete commandHandler_; } commandHandler_ = 0; return true; } else { return false; } } void MICommand::newOutput(const QString& line) { lines.push_back(line); } const QStringList& MICommand::allStreamOutput() const { return lines; } bool MICommand::handlesError() const { return commandHandler_ ? commandHandler_->handlesError() : false; } UserCommand::UserCommand(CommandType type, const QString& s) : MICommand(type, s, CmdMaybeStartsRunning) { } bool UserCommand::isUserCommand() const { return true; } QString MICommand::miCommand() const { QString command; switch (type()) { case NonMI: command = ""; break; case BreakAfter: command = "break-after";//"ignore" break; - case BreakCatch: // FIXME: non-exist command - command = "break-catch"; - break; case BreakCommands: command = "break-commands"; break; case BreakCondition: command = "break-condition";//"cond" break; case BreakDelete: command = "break-delete";//"delete breakpoint" break; case BreakDisable: command = "break-disable";//"disable breakpoint" break; case BreakEnable: command = "break-enable";//"enable breakpoint" break; case BreakInfo: command = "break-info";//"info break" break; case BreakInsert: command = "break-insert -f"; break; case BreakList: command = "break-list";//"info break" break; case BreakWatch: command = "break-watch"; break; case DataDisassemble: command = "data-disassemble"; break; case DataEvaluateExpression: command = "data-evaluate-expression"; break; case DataListChangedRegisters: command = "data-list-changed-registers"; break; case DataListRegisterNames: command = "data-list-register-names"; break; case DataListRegisterValues: command = "data-list-register-values"; break; case DataReadMemory: command = "data-read-memory"; break; case DataWriteMemory: command = "data-write-memory"; break; case DataWriteRegisterVariables: command = "data-write-register-values"; break; case EnablePrettyPrinting: command = "enable-pretty-printing"; break; case EnableTimings: command = "enable-timings"; break; case EnvironmentCd: command = "environment-cd"; break; case EnvironmentDirectory: command = "environment-directory"; break; case EnvironmentPath: command = "environment-path"; break; case EnvironmentPwd: command = "environment-pwd"; break; case ExecAbort: command = "exec-abort"; break; case ExecArguments: command = "exec-arguments";//"set args" break; case ExecContinue: command = "exec-continue"; break; case ExecFinish: command = "exec-finish"; break; case ExecInterrupt: command = "exec-interrupt"; break; case ExecNext: command = "exec-next"; break; case ExecNextInstruction: command = "exec-next-instruction"; break; - case ExecReturn: // FIXME: non-exist command - command = "exec-command ="; - break; case ExecRun: command = "exec-run"; break; - case ExecShowArguments: // FIXME: non-exist command - command = "exec-show-arguments"; - break; - case ExecSignal: // FIXME: non-exist command - command = "exec-signal"; - break; case ExecStep: command = "exec-step"; break; case ExecStepInstruction: command = "exec-step-instruction"; break; case ExecUntil: command = "exec-until"; break; - case FileClear: // FIXME: non-exist command - command = "file-clear"; - break; case FileExecAndSymbols: command = "file-exec-and-symbols";//"file" break; case FileExecFile: command = "file-exec-file";//"exec-file" break; - case FileListExecSections: // FIXME: non-exist command - command = "file-list-exec-sections"; - break; case FileListExecSourceFile: command = "file-list-exec-source-file"; break; case FileListExecSourceFiles: command = "file-list-exec-source-files"; break; - case FileListSharedLibraries: // FIXME: non-exist command - command = "file-list-shared-libraries"; - break; - case FileListSymbolFiles: // FIXME: non-exist command - command = "file-list-symbol-files"; - break; case FileSymbolFile: command = "file-symbol-file";//"symbol-file" break; - case GdbComplete: // FIXME: non-exist command - command = "gdb-complete"; - break; case GdbExit: command = "gdb-exit"; break; case GdbSet: command = "gdb-set";//"set" break; case GdbShow: command = "gdb-show";//"show" break; - case GdbSource: // FIXME: non-exist command - command = "gdb-source"; - break; case GdbVersion: command = "gdb-version";//"show version" break; case InferiorTtySet: command = "inferior-tty-set"; break; case InferiorTtyShow: command = "inferior-tty-show"; break; case InterpreterExec: command = "interpreter-exec"; break; case ListFeatures: command = "list-features"; break; - case OverlayAuto: // FIXME: non-exist command - command = "overlay-auto"; - break; - case OverlayListMappingState: // FIXME: non-exist command - command = "overlay-list-mapping-state"; - break; - case OverlayListOverlays: // FIXME: non-exist command - command = "overlay-list-overlays"; - break; - case OverlayMap: // FIXME: non-exist command - command = "overlay-map"; - break; - case OverlayOff: // FIXME: non-exist command - command = "overlay-off"; - break; - case OverlayOn: // FIXME: non-exist command - command = "overlay-on"; - break; - case OverlayUnmap: // FIXME: non-exist command - command = "overlay-unmap"; - break; - case SignalHandle: return "handle"; //command = "signal-handle"; break; - case SignalListHandleActions: // FIXME: non-exist command - command = "signal-list-handle-actions"; - break; - case SignalListSignalTypes: // FIXME: non-exist command - command = "signal-list-signal-types"; - break; case StackInfoDepth: command = "stack-info-depth"; break; case StackInfoFrame: command = "stack-info-frame"; break; case StackListArguments: command = "stack-list-arguments"; break; - case StackListExceptionHandlers: // FIXME: non-exist command - command = "stack-list-exception-handlers"; - break; case StackListFrames: command = "stack-list-frames"; break; case StackListLocals: command = "stack-list-locals"; break; case StackSelectFrame: command = "stack-select-frame"; break; - case SymbolInfoAddress: // FIXME: non-exist command - command = "symbol-info-address"; - break; - case SymbolInfoFile: // FIXME: non-exist command - command = "symbol-info-file"; - break; - case SymbolInfoFunction: // FIXME: non-exist command - command = "symbol-info-function"; - break; - case SymbolInfoLine: // FIXME: non-exist command - command = "symbol-info-line"; - break; - case SymbolInfoSymbol: // FIXME: non-exist command - command = "symbol-info-symbol"; - break; - case SymbolListFunctions: // FIXME: non-exist command - command = "symbol-list-functions"; - break; case SymbolListLines: command = "symbol-list-lines"; break; - case SymbolListTypes: // FIXME: non-exist command - command = "symbol-list-types"; - break; - case SymbolListVariables: // FIXME: non-exist command - command = "symbol-list-variables"; - break; - case SymbolLocate: // FIXME: non-exist command - command = "symbol-locate"; - break; - case SymbolType: // FIXME: non-exist command - command = "symbol-type"; - break; case TargetAttach: command = "target-attach"; break; - case TargetCompareSections: // FIXME: non-exist command - command = "target-compare-sections"; - break; case TargetDetach: command = "target-detach";//"detach" break; case TargetDisconnect: command = "target-disconnect";//"disconnect" break; case TargetDownload: command = "target-download"; break; - case TargetExecStatus: // FIXME: non-exist command - command = "target-exec-status"; - break; - case TargetListAvailableTargets: // FIXME: non-exist command - command = "target-list-available-targets"; - break; - case TargetListCurrentTargets: // FIXME: non-exist command - command = "target-list-current-targets"; - break; - case TargetListParameters: // FIXME: non-exist command - command = "target-list-parameters"; - break; case TargetSelect: command = "target-select"; break; case ThreadInfo: command = "thread-info"; break; - case ThreadListAllThreads: // FIXME: non-exist command - command = "thread-list-all-threads"; - break; case ThreadListIds: command = "thread-list-ids"; break; case ThreadSelect: command = "thread-select"; break; - case TraceActions: // FIXME: non-exist command - command = "trace-actions"; - break; - case TraceDelete: // FIXME: non-exist command - command = "trace-delete"; - break; - case TraceDisable: // FIXME: non-exist command - command = "trace-disable"; - break; - case TraceDump: // FIXME: non-exist command - command = "trace-dump"; - break; - case TraceEnable: // FIXME: non-exist command - command = "trace-enable"; - break; - case TraceExists: // FIXME: non-exist command - command = "trace-exists"; - break; case TraceFind: command = "trace-find"; break; - case TraceFrameNumber: // FIXME: non-exist command - command = "trace-frame-number"; - break; - case TraceInfo: // FIXME: non-exist command - command = "trace-info"; - break; - case TraceInsert: // FIXME: non-exist command - command = "trace-insert"; - break; - case TraceList: // FIXME: non-exist command - command = "trace-list"; - break; - case TracePassCount: // FIXME: non-exist command - command = "trace-pass-count"; - break; - case TraceSave: // FIXME: crashes gdb - command = "trace-save"; - break; case TraceStart: command = "trace-start"; break; case TraceStop: command = "trace-stop"; break; case VarAssign: command = "var-assign"; break; case VarCreate: command = "var-create"; break; case VarDelete: command = "var-delete"; break; case VarEvaluateExpression: command = "var-evaluate-expression"; break; case VarInfoPathExpression: command = "var-info-path-expression"; break; - case VarInfoExpression: // FIXME: non-exist command - command = "var-info-expression"; - break; case VarInfoNumChildren: command = "var-info-num-children"; break; case VarInfoType: command = "var-info-type"; break; case VarListChildren: command = "var-list-children"; break; case VarSetFormat: command = "var-set-format"; break; case VarSetFrozen: command = "var-set-frozen"; break; case VarShowAttributes: command = "var-show-attributes"; break; case VarShowFormat: command = "var-show-format"; break; case VarUpdate: command = "var-update"; break; default: command = "unknown"; break; } return '-' + command; } CommandType MICommand::type() const { return type_; } int MICommand::thread() const { return m_thread; } void MICommand::setThread(int thread) { m_thread = thread; } int MICommand::frame() const { return m_frame; } void MICommand::setFrame(int frame) { m_frame = frame; } QString MICommand::command() const { return command_; } void MICommand::setStateReloading(bool f) { stateReloading_ = f; } bool MICommand::stateReloading() const { return stateReloading_; } void MICommand::markAsEnqueued() { m_enqueueTimestamp = QDateTime::currentMSecsSinceEpoch(); } void MICommand::markAsSubmitted() { m_submitTimestamp = QDateTime::currentMSecsSinceEpoch(); } void MICommand::markAsCompleted() { m_completeTimestamp = QDateTime::currentMSecsSinceEpoch(); } qint64 MICommand::gdbProcessingTime() const { return m_completeTimestamp - m_submitTimestamp; } qint64 MICommand::queueTime() const { return m_submitTimestamp - m_enqueueTimestamp; } qint64 MICommand::totalProcessingTime() const { return m_completeTimestamp - m_enqueueTimestamp; } diff --git a/debuggers/common/mi/micommandqueue.cpp b/debuggers/common/mi/micommandqueue.cpp index 29586293f6..fe2c05179d 100644 --- a/debuggers/common/mi/micommandqueue.cpp +++ b/debuggers/common/mi/micommandqueue.cpp @@ -1,143 +1,142 @@ // ************************************************************************* // gdbcommandqueue.cpp // ------------------- // begin : Wed Dec 5, 2007 // copyright : (C) 2007 by Hamish Rodda // email : rodda@kde.org // ************************************************************************** // // ************************************************************************** // * * // * This program is free software; you can redistribute it and/or modify * // * it under the terms of the GNU General Public License as published by * // * the Free Software Foundation; either version 2 of the License, or * // * (at your option) any later version. * // * * // ************************************************************************** #include "micommandqueue.h" #include "mi.h" #include "micommand.h" #include "debuglog.h" using namespace KDevMI::MI; CommandQueue::CommandQueue() : m_tokenCounter(0) { } CommandQueue::~CommandQueue() { qDeleteAll(m_commandList); } void CommandQueue::enqueue(MICommand* command) { ++m_tokenCounter; if (m_tokenCounter == 0) m_tokenCounter = 1; command->setToken(m_tokenCounter); // take the time when this command was added to the command queue command->markAsEnqueued(); m_commandList.append(command); if (command->flags() & (CmdImmediately | CmdInterrupt)) ++m_immediatelyCounter; rationalizeQueue(command); dumpQueue(); } void CommandQueue::dumpQueue() { qCDebug(DEBUGGERCOMMON) << "Pending commands" << m_commandList.count(); unsigned commandNum = 0; foreach(const MICommand* command, m_commandList) { qCDebug(DEBUGGERCOMMON) << "Command" << commandNum << command->initialString(); ++commandNum; } } void CommandQueue::rationalizeQueue(MICommand* command) { if ((command->type() >= ExecAbort && command->type() <= ExecUntil) && - command->type() != ExecArguments && - command->type() != ExecShowArguments ) { + command->type() != ExecArguments ) { // Changing execution location, abort any variable updates removeVariableUpdates(); // ... and stack list updates removeStackListUpdates(); } } void CommandQueue::removeVariableUpdates() { QMutableListIterator it = m_commandList; while (it.hasNext()) { MICommand* command = it.next(); CommandType type = command->type(); if ((type >= VarEvaluateExpression && type <= VarListChildren) || type == VarUpdate) { if (command->flags() & (CmdImmediately | CmdInterrupt)) --m_immediatelyCounter; it.remove(); delete command; } } } void CommandQueue::removeStackListUpdates() { QMutableListIterator it = m_commandList; while (it.hasNext()) { MICommand* command = it.next(); CommandType type = command->type(); if (type >= StackListArguments && type <= StackListLocals) { if (command->flags() & (CmdImmediately | CmdInterrupt)) --m_immediatelyCounter; it.remove(); delete command; } } } void CommandQueue::clear() { qDeleteAll(m_commandList); m_commandList.clear(); m_immediatelyCounter = 0; } int CommandQueue::count() const { return m_commandList.count(); } bool CommandQueue::isEmpty() const { return m_commandList.isEmpty(); } bool CommandQueue::haveImmediateCommand() const { return m_immediatelyCounter > 0; } MICommand* CommandQueue::nextCommand() { if (m_commandList.isEmpty()) return nullptr; MICommand* command = m_commandList.takeAt(0); if (command->flags() & (CmdImmediately | CmdInterrupt)) --m_immediatelyCounter; return command; }