Index: packages/Python/lldbsuite/test/tools/lldb-mi/stack/TestMiStack.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-mi/stack/TestMiStack.py +++ packages/Python/lldbsuite/test/tools/lldb-mi/stack/TestMiStack.py @@ -441,7 +441,7 @@ # Test that -stack-select-frame requires 1 mandatory argument self.runCmd("-stack-select-frame") - self.expect("\^error,msg=\"Command 'stack-select-frame'\. Command Args\. Validation failed. Mandatory args not found: frame\"") + self.expect("\^error,msg=\"Command 'stack-select-frame'\. Command Args\. Validation failed. Mandatory args not found: frame_id\"") # Test that -stack-select-frame fails on invalid frame number self.runCmd("-stack-select-frame 99") Index: tools/lldb-mi/MICmdBase.h =================================================================== --- tools/lldb-mi/MICmdBase.h +++ tools/lldb-mi/MICmdBase.h @@ -65,6 +65,7 @@ virtual CMICmdFactory::CmdCreatorFnPtr GetCmdCreatorFn() const; virtual MIuint GetGUID(); + void AddCommonArgs(); // Overrideable: public: @@ -94,6 +95,15 @@ bool m_bHasResultRecordExtra; // True = Yes command produced additional MI output to its 1 line response, false = no extra MI output // formed. CMICmdArgSet m_setCmdArgs; // The list of arguments *this command needs to parse from the options string to carry out work. + const CMIUtilString m_constStrArgThreadGroup; + const CMIUtilString m_constStrArgThread; + const CMIUtilString m_constStrArgFrame; + + // These 3 members can be used by the derived classes to make any of + // "thread", "frame" or "thread-group" mandatory. + bool m_ThreadGrpArgMandatory; + bool m_ThreadArgMandatory; + bool m_FrameArgMandatory; }; //++ ------------------------------------------------------------------------------------ Index: tools/lldb-mi/MICmdBase.cpp =================================================================== --- tools/lldb-mi/MICmdBase.cpp +++ tools/lldb-mi/MICmdBase.cpp @@ -11,6 +11,7 @@ #include "MICmdBase.h" #include "MICmnMIValueConst.h" #include "MICmnLLDBDebugSessionInfo.h" +#include "MICmdArgValOptionLong.h" //++ ------------------------------------------------------------------------------------ // Details: CMICmdBase constructor. @@ -23,6 +24,12 @@ : m_pSelfCreatorFn(nullptr) , m_rLLDBDebugSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()) , m_bHasResultRecordExtra(false) + , m_constStrArgThreadGroup("thread-group") + , m_constStrArgThread("thread") + , m_constStrArgFrame("frame") + , m_ThreadGrpArgMandatory(false) + , m_ThreadArgMandatory(false) + , m_FrameArgMandatory(false) { } @@ -79,6 +86,20 @@ } //++ ------------------------------------------------------------------------------------ +// Details: Help parse the arguments that are common to all commands. +// Args: None. +// Return: None +// Throws: None. +//-- +void +CMICmdBase::AddCommonArgs() +{ + m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgThreadGroup, m_ThreadGrpArgMandatory, true, CMICmdArgValListBase::eArgValType_ThreadGrp, 1)); + m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgThread, m_ThreadArgMandatory, true, CMICmdArgValListBase::eArgValType_Number, 1)); + m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgFrame, m_FrameArgMandatory, true, CMICmdArgValListBase::eArgValType_Number, 1)); +} + +//++ ------------------------------------------------------------------------------------ // Details: The invoker requires this function. A command must be given working data and // provide data about its status or provide information to other objects. // Type: Overridden. Index: tools/lldb-mi/MICmdCmdBreak.h =================================================================== --- tools/lldb-mi/MICmdCmdBreak.h +++ tools/lldb-mi/MICmdCmdBreak.h @@ -95,7 +95,6 @@ const CMIUtilString m_constStrArgNamedInoreCnt; const CMIUtilString m_constStrArgNamedRestrictBrkPtToThreadId; const CMIUtilString m_constStrArgNamedLocation; - const CMIUtilString m_constStrArgNamedThreadGroup; // Not specified in MI spec but Eclipse gives this option sometimes }; //++ ============================================================================ @@ -125,7 +124,6 @@ // Attributes: private: const CMIUtilString m_constStrArgNamedBrkPt; - const CMIUtilString m_constStrArgNamedThreadGrp; // Not specified in MI spec but Eclipse gives this option }; //++ ============================================================================ @@ -154,7 +152,6 @@ // Attributes: private: - const CMIUtilString m_constStrArgNamedThreadGrp; // Not specified in MI spec but Eclipse gives this option const CMIUtilString m_constStrArgNamedBrkPt; bool m_bBrkPtDisabledOk; MIuint m_nBrkPtId; @@ -186,7 +183,6 @@ // Attributes: private: - const CMIUtilString m_constStrArgNamedThreadGrp; // Not specified in MI spec but Eclipse gives this option const CMIUtilString m_constStrArgNamedBrkPt; bool m_bBrkPtEnabledOk; MIuint m_nBrkPtId; @@ -218,7 +214,6 @@ // Attributes: private: - const CMIUtilString m_constStrArgNamedThreadGrp; // Not specified in MI spec but Eclipse gives this option const CMIUtilString m_constStrArgNamedNumber; const CMIUtilString m_constStrArgNamedCount; MIuint m_nBrkPtId; @@ -255,7 +250,6 @@ // Attributes: private: - const CMIUtilString m_constStrArgNamedThreadGrp; // Not specified in MI spec but Eclipse gives this option const CMIUtilString m_constStrArgNamedNumber; const CMIUtilString m_constStrArgNamedExpr; const CMIUtilString m_constStrArgNamedExprNoQuotes; // Not specified in MI spec, we need to handle expressions not surrounded by quotes Index: tools/lldb-mi/MICmdCmdBreak.cpp =================================================================== --- tools/lldb-mi/MICmdCmdBreak.cpp +++ tools/lldb-mi/MICmdCmdBreak.cpp @@ -57,7 +57,6 @@ , m_constStrArgNamedInoreCnt("i") , m_constStrArgNamedRestrictBrkPtToThreadId("p") , m_constStrArgNamedLocation("location") - , m_constStrArgNamedThreadGroup("thread-group") { // Command factory matches this name with that received from the stdin stream m_strMiCmd = "break-insert"; @@ -102,8 +101,6 @@ m_setCmdArgs.Add(new CMICmdArgValOptionShort(m_constStrArgNamedRestrictBrkPtToThreadId, false, true, CMICmdArgValListBase::eArgValType_Number, 1)); m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgNamedLocation, false, true)); - m_setCmdArgs.Add( - new CMICmdArgValOptionLong(m_constStrArgNamedThreadGroup, false, true, CMICmdArgValListBase::eArgValType_ThreadGrp, 1)); return ParseValidateCmdOptions(); } @@ -139,7 +136,7 @@ CMICmdCmdBreakInsert::Execute() { CMICMDBASE_GETOPTION(pArgTempBrkPt, OptionShort, m_constStrArgNamedTempBrkPt); - CMICMDBASE_GETOPTION(pArgThreadGroup, OptionLong, m_constStrArgNamedThreadGroup); + CMICMDBASE_GETOPTION(pArgThreadGroup, OptionLong, m_constStrArgThreadGroup); CMICMDBASE_GETOPTION(pArgLocation, String, m_constStrArgNamedLocation); CMICMDBASE_GETOPTION(pArgIgnoreCnt, OptionShort, m_constStrArgNamedInoreCnt); CMICMDBASE_GETOPTION(pArgPendingBrkPt, OptionShort, m_constStrArgNamedPendinfBrkPt); @@ -372,7 +369,6 @@ //-- CMICmdCmdBreakDelete::CMICmdCmdBreakDelete() : m_constStrArgNamedBrkPt("breakpoint") - , m_constStrArgNamedThreadGrp("thread-group") { // Command factory matches this name with that received from the stdin stream m_strMiCmd = "break-delete"; @@ -404,8 +400,6 @@ bool CMICmdCmdBreakDelete::ParseArgs() { - m_setCmdArgs.Add( - new CMICmdArgValOptionLong(m_constStrArgNamedThreadGrp, false, false, CMICmdArgValListBase::eArgValType_ThreadGrp, 1)); m_setCmdArgs.Add(new CMICmdArgValListOfN(m_constStrArgNamedBrkPt, true, true, CMICmdArgValListBase::eArgValType_Number)); return ParseValidateCmdOptions(); } @@ -488,8 +482,7 @@ // Throws: None. //-- CMICmdCmdBreakDisable::CMICmdCmdBreakDisable() - : m_constStrArgNamedThreadGrp("thread-group") - , m_constStrArgNamedBrkPt("breakpoint") + : m_constStrArgNamedBrkPt("breakpoint") , m_bBrkPtDisabledOk(false) , m_nBrkPtId(0) { @@ -523,8 +516,6 @@ bool CMICmdCmdBreakDisable::ParseArgs() { - m_setCmdArgs.Add( - new CMICmdArgValOptionLong(m_constStrArgNamedThreadGrp, false, false, CMICmdArgValListBase::eArgValType_ThreadGrp, 1)); m_setCmdArgs.Add(new CMICmdArgValListOfN(m_constStrArgNamedBrkPt, true, true, CMICmdArgValListBase::eArgValType_Number)); return ParseValidateCmdOptions(); } @@ -627,8 +618,7 @@ // Throws: None. //-- CMICmdCmdBreakEnable::CMICmdCmdBreakEnable() - : m_constStrArgNamedThreadGrp("thread-group") - , m_constStrArgNamedBrkPt("breakpoint") + : m_constStrArgNamedBrkPt("breakpoint") , m_bBrkPtEnabledOk(false) , m_nBrkPtId(0) { @@ -662,8 +652,6 @@ bool CMICmdCmdBreakEnable::ParseArgs() { - m_setCmdArgs.Add( - new CMICmdArgValOptionLong(m_constStrArgNamedThreadGrp, false, false, CMICmdArgValListBase::eArgValType_ThreadGrp, 1)); m_setCmdArgs.Add(new CMICmdArgValListOfN(m_constStrArgNamedBrkPt, true, true, CMICmdArgValListBase::eArgValType_Number)); return ParseValidateCmdOptions(); } @@ -766,8 +754,7 @@ // Throws: None. //-- CMICmdCmdBreakAfter::CMICmdCmdBreakAfter() - : m_constStrArgNamedThreadGrp("thread-group") - , m_constStrArgNamedNumber("number") + : m_constStrArgNamedNumber("number") , m_constStrArgNamedCount("count") , m_nBrkPtId(0) , m_nBrkPtCount(0) @@ -802,8 +789,6 @@ bool CMICmdCmdBreakAfter::ParseArgs() { - m_setCmdArgs.Add( - new CMICmdArgValOptionLong(m_constStrArgNamedThreadGrp, false, false, CMICmdArgValListBase::eArgValType_ThreadGrp, 1)); m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgNamedNumber, true, true)); m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgNamedCount, true, true)); return ParseValidateCmdOptions(); @@ -896,8 +881,7 @@ // Throws: None. //-- CMICmdCmdBreakCondition::CMICmdCmdBreakCondition() - : m_constStrArgNamedThreadGrp("thread-group") - , m_constStrArgNamedNumber("number") + : m_constStrArgNamedNumber("number") , m_constStrArgNamedExpr("expr") , m_constStrArgNamedExprNoQuotes( "expression not surround by quotes") // Not specified in MI spec, we need to handle expressions not surrounded by quotes @@ -933,8 +917,6 @@ bool CMICmdCmdBreakCondition::ParseArgs() { - m_setCmdArgs.Add( - new CMICmdArgValOptionLong(m_constStrArgNamedThreadGrp, false, false, CMICmdArgValListBase::eArgValType_ThreadGrp, 1)); m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgNamedNumber, true, true)); m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgNamedExpr, true, true, true, true)); m_setCmdArgs.Add(new CMICmdArgValListOfN(m_constStrArgNamedExprNoQuotes, false, false, Index: tools/lldb-mi/MICmdCmdData.h =================================================================== --- tools/lldb-mi/MICmdCmdData.h +++ tools/lldb-mi/MICmdCmdData.h @@ -75,8 +75,6 @@ CMICmnMIValueTuple m_miValueTuple; bool m_bFoundInvalidChar; // True = yes found unexpected character in the expression, false = all ok char m_cExpressionInvalidChar; - const CMIUtilString m_constStrArgThread; // Not specified in MI spec but Eclipse gives this option. Not handled by command. - const CMIUtilString m_constStrArgFrame; // Not specified in MI spec but Eclipse gives this option. Not handled by command. const CMIUtilString m_constStrArgExpr; }; @@ -106,7 +104,6 @@ // Attributes: private: - const CMIUtilString m_constStrArgThread; // Not specified in MI spec but Eclipse gives this option. Not handled by command. const CMIUtilString m_constStrArgAddrStart; // MI spec non mandatory, *this command mandatory const CMIUtilString m_constStrArgAddrEnd; // MI spec non mandatory, *this command mandatory const CMIUtilString m_constStrArgConsume; @@ -140,8 +137,6 @@ // Attributes: private: - const CMIUtilString m_constStrArgThread; // Not in the MI spec but implemented by GDB. - const CMIUtilString m_constStrArgFrame; // Not in the MI spec but implemented by GDB. const CMIUtilString m_constStrArgByteOffset; const CMIUtilString m_constStrArgAddrExpr; const CMIUtilString m_constStrArgNumBytes; @@ -204,7 +199,6 @@ // Attributes: private: - const CMIUtilString m_constStrArgThreadGroup; // Not specified in MI spec but Eclipse gives this option const CMIUtilString m_constStrArgRegNo; // Not handled by *this command CMICmnMIValueList m_miValueList; }; @@ -240,7 +234,6 @@ // Attributes: private: - const CMIUtilString m_constStrArgThread; // Not specified in MI spec but Eclipse gives this option const CMIUtilString m_constStrArgSkip; // Not handled by *this command const CMIUtilString m_constStrArgFormat; const CMIUtilString m_constStrArgRegNo; @@ -297,7 +290,6 @@ // Attributes: private: - const CMIUtilString m_constStrArgThread; // Not specified in MI spec but Eclipse gives this option. Not handled by command. const CMIUtilString m_constStrArgAddr; const CMIUtilString m_constStrArgContents; const CMIUtilString m_constStrArgCount; @@ -331,7 +323,6 @@ // Attributes: private: - const CMIUtilString m_constStrArgThread; // Not specified in MI spec but Eclipse gives this option. Not handled by command. const CMIUtilString m_constStrArgOffset; // Not specified in MI spec but Eclipse gives this option. const CMIUtilString m_constStrArgAddr; // Not specified in MI spec but Eclipse gives this option. const CMIUtilString m_constStrArgD; // Not specified in MI spec but Eclipse gives this option. Index: tools/lldb-mi/MICmdCmdData.cpp =================================================================== --- tools/lldb-mi/MICmdCmdData.cpp +++ tools/lldb-mi/MICmdCmdData.cpp @@ -57,8 +57,6 @@ , m_strValue("??") , m_bFoundInvalidChar(false) , m_cExpressionInvalidChar(0x00) - , m_constStrArgThread("thread") - , m_constStrArgFrame("frame") , m_constStrArgExpr("expr") { // Command factory matches this name with that received from the stdin stream @@ -91,8 +89,6 @@ bool CMICmdCmdDataEvaluateExpression::ParseArgs() { - m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgThread, false, false, CMICmdArgValListBase::eArgValType_Number, 1)); - m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgFrame, false, false, CMICmdArgValListBase::eArgValType_Number, 1)); m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgExpr, true, true, true, true)); return ParseValidateCmdOptions(); } @@ -241,8 +237,7 @@ // Throws: None. //-- CMICmdCmdDataDisassemble::CMICmdCmdDataDisassemble() - : m_constStrArgThread("thread") - , m_constStrArgAddrStart("s") + : m_constStrArgAddrStart("s") , m_constStrArgAddrEnd("e") , m_constStrArgConsume("--") , m_constStrArgMode("mode") @@ -278,7 +273,6 @@ bool CMICmdCmdDataDisassemble::ParseArgs() { - m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgThread, false, true, CMICmdArgValListBase::eArgValType_Number, 1)); m_setCmdArgs.Add( new CMICmdArgValOptionShort(m_constStrArgAddrStart, true, true, CMICmdArgValListBase::eArgValType_StringQuotedNumber, 1)); m_setCmdArgs.Add( @@ -463,9 +457,7 @@ // Throws: None. //-- CMICmdCmdDataReadMemoryBytes::CMICmdCmdDataReadMemoryBytes() - : m_constStrArgThread("thread") - , m_constStrArgFrame("frame") - , m_constStrArgByteOffset("o") + : m_constStrArgByteOffset("o") , m_constStrArgAddrExpr("address") , m_constStrArgNumBytes("count") , m_pBufferMemory(nullptr) @@ -507,8 +499,6 @@ bool CMICmdCmdDataReadMemoryBytes::ParseArgs() { - m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgThread, false, true, CMICmdArgValListBase::eArgValType_Number, 1)); - m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgFrame, false, true, CMICmdArgValListBase::eArgValType_Number, 1)); m_setCmdArgs.Add(new CMICmdArgValOptionShort(m_constStrArgByteOffset, false, true, CMICmdArgValListBase::eArgValType_Number, 1)); m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgAddrExpr, true, true, true, true)); m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgNumBytes, true, true)); @@ -789,8 +779,7 @@ // Throws: None. //-- CMICmdCmdDataListRegisterNames::CMICmdCmdDataListRegisterNames() - : m_constStrArgThreadGroup("thread-group") - , m_constStrArgRegNo("regno") + : m_constStrArgRegNo("regno") , m_miValueList(true) { // Command factory matches this name with that received from the stdin stream @@ -823,7 +812,6 @@ bool CMICmdCmdDataListRegisterNames::ParseArgs() { - m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgThreadGroup, false, false, CMICmdArgValListBase::eArgValType_ThreadGrp, 1)); m_setCmdArgs.Add(new CMICmdArgValListOfN(m_constStrArgRegNo, false, false, CMICmdArgValListBase::eArgValType_Number)); return ParseValidateCmdOptions(); } @@ -977,8 +965,7 @@ // Throws: None. //-- CMICmdCmdDataListRegisterValues::CMICmdCmdDataListRegisterValues() - : m_constStrArgThread("thread") - , m_constStrArgSkip("skip-unavailable") + : m_constStrArgSkip("skip-unavailable") , m_constStrArgFormat("fmt") , m_constStrArgRegNo("regno") , m_miValueList(true) @@ -1288,8 +1275,7 @@ // Throws: None. //-- CMICmdCmdDataWriteMemoryBytes::CMICmdCmdDataWriteMemoryBytes() - : m_constStrArgThread("thread") - , m_constStrArgAddr("address") + : m_constStrArgAddr("address") , m_constStrArgContents("contents") , m_constStrArgCount("count") { @@ -1323,7 +1309,6 @@ bool CMICmdCmdDataWriteMemoryBytes::ParseArgs() { - m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgThread, false, false, CMICmdArgValListBase::eArgValType_Number, 1)); m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgAddr, true, true, false, true)); m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgContents, true, true, true, true)); m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgCount, false, true, false, true)); @@ -1400,8 +1385,7 @@ // Throws: None. //-- CMICmdCmdDataWriteMemory::CMICmdCmdDataWriteMemory() - : m_constStrArgThread("thread") - , m_constStrArgOffset("o") + : m_constStrArgOffset("o") , m_constStrArgAddr("address") , m_constStrArgD("d") , m_constStrArgNumber("a number") @@ -1445,7 +1429,6 @@ bool CMICmdCmdDataWriteMemory::ParseArgs() { - m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgThread, false, false, CMICmdArgValListBase::eArgValType_Number, 1)); m_setCmdArgs.Add(new CMICmdArgValOptionShort(m_constStrArgOffset, false, true, CMICmdArgValListBase::eArgValType_Number, 1)); m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgAddr, true, true)); m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgD, true, true)); Index: tools/lldb-mi/MICmdCmdExec.h =================================================================== --- tools/lldb-mi/MICmdCmdExec.h +++ tools/lldb-mi/MICmdCmdExec.h @@ -120,7 +120,6 @@ // Attributes: private: lldb::SBCommandReturnObject m_lldbResult; - const CMIUtilString m_constStrArgThread; // Not specified in MI spec but Eclipse gives this option const CMIUtilString m_constStrArgNumber; // Not specified in MI spec but Eclipse gives this option }; @@ -151,7 +150,6 @@ // Attributes: private: lldb::SBCommandReturnObject m_lldbResult; - const CMIUtilString m_constStrArgThread; // Not specified in MI spec but Eclipse gives this option const CMIUtilString m_constStrArgNumber; // Not specified in MI spec but Eclipse gives this option }; @@ -182,7 +180,6 @@ // Attributes: private: lldb::SBCommandReturnObject m_lldbResult; - const CMIUtilString m_constStrArgThread; // Not specified in MI spec but Eclipse gives this option const CMIUtilString m_constStrArgNumber; // Not specified in MI spec but Eclipse gives this option }; @@ -213,7 +210,6 @@ // Attributes: private: lldb::SBCommandReturnObject m_lldbResult; - const CMIUtilString m_constStrArgThread; // Not specified in MI spec but Eclipse gives this option const CMIUtilString m_constStrArgNumber; // Not specified in MI spec but Eclipse gives this option }; @@ -244,8 +240,6 @@ // Attributes: private: lldb::SBCommandReturnObject m_lldbResult; - const CMIUtilString m_constStrArgThread; // Not specified in MI spec but Eclipse gives this option - const CMIUtilString m_constStrArgFrame; // Not specified in MI spec but Eclipse gives this option }; // CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM Index: tools/lldb-mi/MICmdCmdExec.cpp =================================================================== --- tools/lldb-mi/MICmdCmdExec.cpp +++ tools/lldb-mi/MICmdCmdExec.cpp @@ -299,8 +299,7 @@ // Throws: None. //-- CMICmdCmdExecNext::CMICmdCmdExecNext() - : m_constStrArgThread("thread") - , m_constStrArgNumber("number") + : m_constStrArgNumber("number") { // Command factory matches this name with that received from the stdin stream m_strMiCmd = "exec-next"; @@ -332,7 +331,6 @@ bool CMICmdCmdExecNext::ParseArgs() { - m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgThread, false, true, CMICmdArgValListBase::eArgValType_Number, 1)); m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgNumber, false, false)); return ParseValidateCmdOptions(); } @@ -425,8 +423,7 @@ // Throws: None. //-- CMICmdCmdExecStep::CMICmdCmdExecStep() - : m_constStrArgThread("thread") - , m_constStrArgNumber("number") + : m_constStrArgNumber("number") { // Command factory matches this name with that received from the stdin stream m_strMiCmd = "exec-step"; @@ -458,7 +455,6 @@ bool CMICmdCmdExecStep::ParseArgs() { - m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgThread, false, true, CMICmdArgValListBase::eArgValType_Number, 1)); m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgNumber, false, false)); return ParseValidateCmdOptions(); } @@ -551,8 +547,7 @@ // Throws: None. //-- CMICmdCmdExecNextInstruction::CMICmdCmdExecNextInstruction() - : m_constStrArgThread("thread") - , m_constStrArgNumber("number") + : m_constStrArgNumber("number") { // Command factory matches this name with that received from the stdin stream m_strMiCmd = "exec-next-instruction"; @@ -584,7 +579,6 @@ bool CMICmdCmdExecNextInstruction::ParseArgs() { - m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgThread, false, true, CMICmdArgValListBase::eArgValType_Number, 1)); m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgNumber, false, false)); return ParseValidateCmdOptions(); } @@ -677,8 +671,7 @@ // Throws: None. //-- CMICmdCmdExecStepInstruction::CMICmdCmdExecStepInstruction() - : m_constStrArgThread("thread") - , m_constStrArgNumber("number") + : m_constStrArgNumber("number") { // Command factory matches this name with that received from the stdin stream m_strMiCmd = "exec-step-instruction"; @@ -710,7 +703,6 @@ bool CMICmdCmdExecStepInstruction::ParseArgs() { - m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgThread, false, true, CMICmdArgValListBase::eArgValType_Number, 1)); m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgNumber, false, false)); return ParseValidateCmdOptions(); } @@ -803,8 +795,6 @@ // Throws: None. //-- CMICmdCmdExecFinish::CMICmdCmdExecFinish() - : m_constStrArgThread("thread") - , m_constStrArgFrame("frame") { // Command factory matches this name with that received from the stdin stream m_strMiCmd = "exec-finish"; @@ -836,8 +826,6 @@ bool CMICmdCmdExecFinish::ParseArgs() { - m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgThread, false, true, CMICmdArgValListBase::eArgValType_Number, 1)); - m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgFrame, false, false, CMICmdArgValListBase::eArgValType_Number, 1)); return ParseValidateCmdOptions(); } Index: tools/lldb-mi/MICmdCmdFile.h =================================================================== --- tools/lldb-mi/MICmdCmdFile.h +++ tools/lldb-mi/MICmdCmdFile.h @@ -56,8 +56,6 @@ // Attributes: private: const CMIUtilString m_constStrArgNameFile; - const CMIUtilString - m_constStrArgThreadGrp; // Not handled by *this command. Not specified in MI spec but Eclipse gives this option sometimes const CMIUtilString m_constStrArgNamedPlatformName; // Added to support iOS platform selection const CMIUtilString m_constStrArgNamedRemotePath; // Added to support iOS device remote file location }; Index: tools/lldb-mi/MICmdCmdFile.cpp =================================================================== --- tools/lldb-mi/MICmdCmdFile.cpp +++ tools/lldb-mi/MICmdCmdFile.cpp @@ -32,7 +32,6 @@ //-- CMICmdCmdFileExecAndSymbols::CMICmdCmdFileExecAndSymbols() : m_constStrArgNameFile("file") - , m_constStrArgThreadGrp("thread-group") , m_constStrArgNamedPlatformName("p") , m_constStrArgNamedRemotePath("r") { @@ -66,8 +65,6 @@ bool CMICmdCmdFileExecAndSymbols::ParseArgs() { - m_setCmdArgs.Add( - new CMICmdArgValOptionLong(m_constStrArgThreadGrp, false, false, CMICmdArgValListBase::eArgValType_ThreadGrp, 1)); m_setCmdArgs.Add(new CMICmdArgValFile(m_constStrArgNameFile, true, true)); m_setCmdArgs.Add(new CMICmdArgValOptionShort(m_constStrArgNamedPlatformName, false, true, CMICmdArgValListBase::eArgValType_String, 1)); Index: tools/lldb-mi/MICmdCmdGdbSet.h =================================================================== --- tools/lldb-mi/MICmdCmdGdbSet.h +++ tools/lldb-mi/MICmdCmdGdbSet.h @@ -76,7 +76,6 @@ private: const static MapGdbOptionNameToFnGdbOptionPtr_t ms_mapGdbOptionNameToFnGdbOptionPtr; // - const CMIUtilString m_constStrArgNamedThreadGrp; const CMIUtilString m_constStrArgNamedGdbOption; bool m_bGdbOptionRecognised; // True = This command has a function with a name that matches the Print argument, false = not found bool m_bGdbOptionFnSuccessful; // True = The print function completed its task ok, false = function failed for some reason Index: tools/lldb-mi/MICmdCmdGdbSet.cpp =================================================================== --- tools/lldb-mi/MICmdCmdGdbSet.cpp +++ tools/lldb-mi/MICmdCmdGdbSet.cpp @@ -35,8 +35,7 @@ // Throws: None. //-- CMICmdCmdGdbSet::CMICmdCmdGdbSet() - : m_constStrArgNamedThreadGrp("thread-group") - , m_constStrArgNamedGdbOption("option") + : m_constStrArgNamedGdbOption("option") , m_bGdbOptionRecognised(true) , m_bGdbOptionFnSuccessful(false) , m_bGbbOptionFnHasError(false) @@ -73,8 +72,6 @@ CMICmdCmdGdbSet::ParseArgs() { m_setCmdArgs.Add( - new CMICmdArgValOptionLong(m_constStrArgNamedThreadGrp, false, false, CMICmdArgValListBase::eArgValType_ThreadGrp, 1)); - m_setCmdArgs.Add( new CMICmdArgValListOfN(m_constStrArgNamedGdbOption, true, true, CMICmdArgValListBase::eArgValType_StringAnything)); return ParseValidateCmdOptions(); } Index: tools/lldb-mi/MICmdCmdGdbShow.h =================================================================== --- tools/lldb-mi/MICmdCmdGdbShow.h +++ tools/lldb-mi/MICmdCmdGdbShow.h @@ -74,8 +74,7 @@ // Attributes: private: const static MapGdbOptionNameToFnGdbOptionPtr_t ms_mapGdbOptionNameToFnGdbOptionPtr; - // - const CMIUtilString m_constStrArgNamedThreadGrp; + const CMIUtilString m_constStrArgNamedGdbOption; bool m_bGdbOptionRecognised; // True = This command has a function with a name that matches the Print argument, false = not found bool m_bGdbOptionFnSuccessful; // True = The print function completed its task ok, false = function failed for some reason Index: tools/lldb-mi/MICmdCmdGdbShow.cpp =================================================================== --- tools/lldb-mi/MICmdCmdGdbShow.cpp +++ tools/lldb-mi/MICmdCmdGdbShow.cpp @@ -39,8 +39,7 @@ // Throws: None. //-- CMICmdCmdGdbShow::CMICmdCmdGdbShow() - : m_constStrArgNamedThreadGrp("thread-group") - , m_constStrArgNamedGdbOption("option") + : m_constStrArgNamedGdbOption("option") , m_bGdbOptionRecognised(true) , m_bGdbOptionFnSuccessful(false) , m_bGbbOptionFnHasError(false) @@ -77,8 +76,6 @@ CMICmdCmdGdbShow::ParseArgs() { m_setCmdArgs.Add( - new CMICmdArgValOptionLong(m_constStrArgNamedThreadGrp, false, false, CMICmdArgValListBase::eArgValType_ThreadGrp, 1)); - m_setCmdArgs.Add( new CMICmdArgValListOfN(m_constStrArgNamedGdbOption, true, true, CMICmdArgValListBase::eArgValType_StringAnything)); return ParseValidateCmdOptions(); } Index: tools/lldb-mi/MICmdCmdStack.h =================================================================== --- tools/lldb-mi/MICmdCmdStack.h +++ tools/lldb-mi/MICmdCmdStack.h @@ -57,7 +57,6 @@ // Attributes: private: MIuint m_nThreadFrames; - const CMIUtilString m_constStrArgThread; // Not specified in MI spec but Eclipse gives this option const CMIUtilString m_constStrArgMaxDepth; // Not handled by *this command }; @@ -122,7 +121,6 @@ private: MIuint m_nThreadFrames; VecMIValueResult_t m_vecMIValueResult; - const CMIUtilString m_constStrArgThread; // Not specified in MI spec but Eclipse gives this option const CMIUtilString m_constStrArgFrameLow; const CMIUtilString m_constStrArgFrameHigh; }; @@ -155,7 +153,6 @@ private: bool m_bThreadInvalid; // True = yes invalid thread, false = thread object valid CMICmnMIValueList m_miValueList; - const CMIUtilString m_constStrArgThread; // Not specified in MI spec but Eclipse gives this option const CMIUtilString m_constStrArgPrintValues; const CMIUtilString m_constStrArgFrameLow; const CMIUtilString m_constStrArgFrameHigh; @@ -189,8 +186,6 @@ private: bool m_bThreadInvalid; // True = yes invalid thread, false = thread object valid CMICmnMIValueList m_miValueList; - const CMIUtilString m_constStrArgThread; // Not specified in MI spec but Eclipse gives this option - const CMIUtilString m_constStrArgFrame; // Not specified in MI spec but Eclipse gives this option const CMIUtilString m_constStrArgPrintValues; }; @@ -222,8 +217,6 @@ private: bool m_bThreadInvalid; // True = yes invalid thread, false = thread object valid CMICmnMIValueList m_miValueList; - const CMIUtilString m_constStrArgThread; - const CMIUtilString m_constStrArgFrame; const CMIUtilString m_constStrArgPrintValues; }; @@ -254,5 +247,5 @@ // Attributes: private: bool m_bFrameInvalid; // True = yes invalid frame, false = ok - const CMIUtilString m_constStrArgFrame; + const CMIUtilString m_constStrArgFrameId; }; Index: tools/lldb-mi/MICmdCmdStack.cpp =================================================================== --- tools/lldb-mi/MICmdCmdStack.cpp +++ tools/lldb-mi/MICmdCmdStack.cpp @@ -41,7 +41,6 @@ //-- CMICmdCmdStackInfoDepth::CMICmdCmdStackInfoDepth() : m_nThreadFrames(0) - , m_constStrArgThread("thread") , m_constStrArgMaxDepth("max-depth") { // Command factory matches this name with that received from the stdin stream @@ -74,7 +73,6 @@ bool CMICmdCmdStackInfoDepth::ParseArgs() { - m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgThread, false, true, CMICmdArgValListBase::eArgValType_Number, 1)); m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgMaxDepth, false, false)); return ParseValidateCmdOptions(); } @@ -265,7 +263,6 @@ //-- CMICmdCmdStackListFrames::CMICmdCmdStackListFrames() : m_nThreadFrames(0) - , m_constStrArgThread("thread") , m_constStrArgFrameLow("low-frame") , m_constStrArgFrameHigh("high-frame") { @@ -446,7 +443,6 @@ CMICmdCmdStackListArguments::CMICmdCmdStackListArguments() : m_bThreadInvalid(false) , m_miValueList(true) - , m_constStrArgThread("thread") , m_constStrArgPrintValues("print-values") , m_constStrArgFrameLow("low-frame") , m_constStrArgFrameHigh("high-frame") @@ -632,8 +628,6 @@ CMICmdCmdStackListLocals::CMICmdCmdStackListLocals() : m_bThreadInvalid(false) , m_miValueList(true) - , m_constStrArgThread("thread") - , m_constStrArgFrame("frame") , m_constStrArgPrintValues("print-values") { // Command factory matches this name with that received from the stdin stream @@ -666,8 +660,6 @@ bool CMICmdCmdStackListLocals::ParseArgs() { - m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgThread, false, true, CMICmdArgValListBase::eArgValType_Number, 1)); - m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgFrame, false, true, CMICmdArgValListBase::eArgValType_Number, 1)); m_setCmdArgs.Add(new CMICmdArgValPrintValues(m_constStrArgPrintValues, true, true)); return ParseValidateCmdOptions(); } @@ -795,8 +787,6 @@ CMICmdCmdStackListVariables::CMICmdCmdStackListVariables() : m_bThreadInvalid(false) , m_miValueList(true) - , m_constStrArgThread("thread") - , m_constStrArgFrame("frame") , m_constStrArgPrintValues("print-values") { // Command factory matches this name with that received from the stdin stream @@ -829,8 +819,6 @@ bool CMICmdCmdStackListVariables::ParseArgs() { - m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgThread, false, true, CMICmdArgValListBase::eArgValType_Number, 1)); - m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgFrame, false, true, CMICmdArgValListBase::eArgValType_Number, 1)); m_setCmdArgs.Add(new CMICmdArgValPrintValues(m_constStrArgPrintValues, true, true)); return ParseValidateCmdOptions(); } @@ -956,7 +944,7 @@ //-- CMICmdCmdStackSelectFrame::CMICmdCmdStackSelectFrame() : m_bFrameInvalid(false) - , m_constStrArgFrame("frame") + , m_constStrArgFrameId("frame_id") { // Command factory matches this name with that received from the stdin stream m_strMiCmd = "stack-select-frame"; @@ -988,7 +976,7 @@ bool CMICmdCmdStackSelectFrame::ParseArgs() { - m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgFrame, true, false)); + m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgFrameId, true, false)); return ParseValidateCmdOptions(); } @@ -1004,7 +992,7 @@ bool CMICmdCmdStackSelectFrame::Execute() { - CMICMDBASE_GETOPTION(pArgFrame, Number, m_constStrArgFrame); + CMICMDBASE_GETOPTION(pArgFrame, Number, m_constStrArgFrameId); CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()); lldb::SBThread sbThread = rSessionInfo.GetProcess().GetSelectedThread(); Index: tools/lldb-mi/MICmdCmdVar.h =================================================================== --- tools/lldb-mi/MICmdCmdVar.h +++ tools/lldb-mi/MICmdCmdVar.h @@ -78,9 +78,6 @@ bool m_bValid; // True = Variable is valid, false = not valid CMIUtilString m_strExpression; CMIUtilString m_strValue; - const CMIUtilString m_constStrArgThread; // Not specified in MI spec but Eclipse gives this option - const CMIUtilString m_constStrArgThreadGroup; // Not specified in MI spec but Eclipse gives this option - const CMIUtilString m_constStrArgFrame; // Not specified in MI spec but Eclipse gives this option const CMIUtilString m_constStrArgName; const CMIUtilString m_constStrArgFrameAddr; const CMIUtilString m_constStrArgExpression; Index: tools/lldb-mi/MICmdCmdVar.cpp =================================================================== --- tools/lldb-mi/MICmdCmdVar.cpp +++ tools/lldb-mi/MICmdCmdVar.cpp @@ -51,9 +51,6 @@ , m_strType("??") , m_bValid(false) , m_strValue("??") - , m_constStrArgThread("thread") - , m_constStrArgThreadGroup("thread-group") - , m_constStrArgFrame("frame") , m_constStrArgName("name") , m_constStrArgFrameAddr("frame-addr") , m_constStrArgExpression("expression") @@ -88,10 +85,6 @@ bool CMICmdCmdVarCreate::ParseArgs() { - m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgThread, false, true, CMICmdArgValListBase::eArgValType_Number, 1)); - m_setCmdArgs.Add( - new CMICmdArgValOptionLong(m_constStrArgThreadGroup, false, false, CMICmdArgValListBase::eArgValType_ThreadGrp, 1)); - m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgFrame, false, true, CMICmdArgValListBase::eArgValType_Number, 1)); m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgName, false, true)); m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgFrameAddr, false, true)); m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgExpression, true, true, true, true)); Index: tools/lldb-mi/MICmdInvoker.cpp =================================================================== --- tools/lldb-mi/MICmdInvoker.cpp +++ tools/lldb-mi/MICmdInvoker.cpp @@ -189,16 +189,20 @@ { bool bOk = CmdAdd(vCmd); - if (bOk && !vCmd.ParseArgs()) + if (bOk) { - // Report command execution failed - const SMICmdData cmdData(vCmd.GetCmdData()); - CmdStdout(cmdData); - CmdCauseAppExit(vCmd); - CmdDelete(cmdData.id); + vCmd.AddCommonArgs(); + if (!vCmd.ParseArgs()) + { + // Report command execution failed + const SMICmdData cmdData(vCmd.GetCmdData()); + CmdStdout(cmdData); + CmdCauseAppExit(vCmd); + CmdDelete(cmdData.id); - // Proceed to wait or execute next command - return MIstatus::success; + // Proceed to wait or execute next command + return MIstatus::success; + } } if (bOk && !vCmd.Execute())