[Lldb-commits] [lldb] r251793 - Handle the options and parameters separator in every MI command

Hafiz Abid Qadeer via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 2 03:43:40 PST 2015


Author: abidh
Date: Mon Nov  2 05:43:40 2015
New Revision: 251793

URL: http://llvm.org/viewvc/llvm-project?rev=251793&view=rev
Log:
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

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py
    lldb/trunk/tools/lldb-mi/MICmdBase.cpp
    lldb/trunk/tools/lldb-mi/MICmdBase.h
    lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp
    lldb/trunk/tools/lldb-mi/MICmdCmdData.h

Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py?rev=251793&r1=251792&r2=251793&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py Mon Nov  2 05:43:40 2015
@@ -40,6 +40,10 @@ class MiDataTestCase(lldbmi_testcase.MiT
         # 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")

Modified: lldb/trunk/tools/lldb-mi/MICmdBase.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdBase.cpp?rev=251793&r1=251792&r2=251793&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdBase.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdBase.cpp Mon Nov  2 05:43:40 2015
@@ -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));
 }
 
 //++ ------------------------------------------------------------------------------------

Modified: lldb/trunk/tools/lldb-mi/MICmdBase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdBase.h?rev=251793&r1=251792&r2=251793&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdBase.h (original)
+++ lldb/trunk/tools/lldb-mi/MICmdBase.h Mon Nov  2 05:43:40 2015
@@ -98,6 +98,7 @@ class CMICmdBase : public CMICmnBase, pu
     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.

Modified: lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp?rev=251793&r1=251792&r2=251793&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp Mon Nov  2 05:43:40 2015
@@ -239,7 +239,6 @@ CMICmdCmdDataEvaluateExpression::HaveInv
 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();
 }

Modified: lldb/trunk/tools/lldb-mi/MICmdCmdData.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdData.h?rev=251793&r1=251792&r2=251793&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdCmdData.h (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdData.h Mon Nov  2 05:43:40 2015
@@ -106,7 +106,6 @@ class CMICmdCmdDataDisassemble : public
   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;
 };




More information about the lldb-commits mailing list