forked from OSchip/llvm-project
Handle the options and parameters separator in every MI command
Summary: As per the following link, the "--" separator can appear between the options and parameters of any MI command. Previously this separator was only handled by the `-data-disassemble` MI command. I have moved the relevant code into `CMICmdBase` so that any MI command can handle the aforementioned separator. https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Input-Syntax.html#GDB_002fMI-Input-Syntax Reviewers: ki.stfu Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D14197 llvm-svn: 251793
This commit is contained in:
parent
dd4ed3af98
commit
c10e82087b
|
@ -40,6 +40,10 @@ class MiDataTestCase(lldbmi_testcase.MiTestCaseBase):
|
|||
# Test -data-disassemble: try to disassemble some address
|
||||
self.runCmd("-data-disassemble -s %#x -e %#x -- 0" % (addr, addr + 0x10))
|
||||
self.expect("\^done,asm_insns=\[{address=\"0x0*%x\",func-name=\"main\",offset=\"0\",size=\"[1-9]+\",inst=\".+?\"}," % addr)
|
||||
|
||||
# Test -data-disassemble without "--"
|
||||
self.runCmd("-data-disassemble -s %#x -e %#x 0" % (addr, addr + 0x10))
|
||||
self.expect("\^done,asm_insns=\[{address=\"0x0*%x\",func-name=\"main\",offset=\"0\",size=\"[1-9]+\",inst=\".+?\"}," % addr)
|
||||
|
||||
# Run to hello_world
|
||||
self.runCmd("-break-insert -f hello_world")
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "MICmnMIValueConst.h"
|
||||
#include "MICmnLLDBDebugSessionInfo.h"
|
||||
#include "MICmdArgValOptionLong.h"
|
||||
#include "MICmdArgValConsume.h"
|
||||
|
||||
//++ ------------------------------------------------------------------------------------
|
||||
// Details: CMICmdBase constructor.
|
||||
|
@ -27,6 +28,7 @@ CMICmdBase::CMICmdBase()
|
|||
, m_constStrArgThreadGroup("thread-group")
|
||||
, m_constStrArgThread("thread")
|
||||
, m_constStrArgFrame("frame")
|
||||
, m_constStrArgConsume("--")
|
||||
, m_ThreadGrpArgMandatory(false)
|
||||
, m_ThreadArgMandatory(false)
|
||||
, m_FrameArgMandatory(false)
|
||||
|
@ -97,6 +99,7 @@ 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));
|
||||
m_setCmdArgs.Add(new CMICmdArgValConsume(m_constStrArgConsume, false));
|
||||
}
|
||||
|
||||
//++ ------------------------------------------------------------------------------------
|
||||
|
|
|
@ -98,6 +98,7 @@ class CMICmdBase : public CMICmnBase, public CMICmdInvoker::ICmd, public CMICmdF
|
|||
const CMIUtilString m_constStrArgThreadGroup;
|
||||
const CMIUtilString m_constStrArgThread;
|
||||
const CMIUtilString m_constStrArgFrame;
|
||||
const CMIUtilString m_constStrArgConsume;
|
||||
|
||||
// These 3 members can be used by the derived classes to make any of
|
||||
// "thread", "frame" or "thread-group" mandatory.
|
||||
|
|
|
@ -239,7 +239,6 @@ CMICmdCmdDataEvaluateExpression::HaveInvalidCharacterInExpression(const CMIUtilS
|
|||
CMICmdCmdDataDisassemble::CMICmdCmdDataDisassemble()
|
||||
: m_constStrArgAddrStart("s")
|
||||
, m_constStrArgAddrEnd("e")
|
||||
, m_constStrArgConsume("--")
|
||||
, m_constStrArgMode("mode")
|
||||
, m_miValueList(true)
|
||||
{
|
||||
|
@ -277,7 +276,6 @@ CMICmdCmdDataDisassemble::ParseArgs()
|
|||
new CMICmdArgValOptionShort(m_constStrArgAddrStart, true, true, CMICmdArgValListBase::eArgValType_StringQuotedNumber, 1));
|
||||
m_setCmdArgs.Add(
|
||||
new CMICmdArgValOptionShort(m_constStrArgAddrEnd, true, true, CMICmdArgValListBase::eArgValType_StringQuotedNumber, 1));
|
||||
m_setCmdArgs.Add(new CMICmdArgValConsume(m_constStrArgConsume, true));
|
||||
m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgMode, true, true));
|
||||
return ParseValidateCmdOptions();
|
||||
}
|
||||
|
|
|
@ -106,7 +106,6 @@ class CMICmdCmdDataDisassemble : public CMICmdBase
|
|||
private:
|
||||
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;
|
||||
const CMIUtilString m_constStrArgMode;
|
||||
CMICmnMIValueList m_miValueList;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue