[Lldb-commits] [PATCH] D24202: Fix parsing expressions to evaluate with spaces and optional args (MI)

Ilia K via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 21 22:17:34 PDT 2016


This revision was automatically updated to reflect the committed changes.
ki.stfu marked an inline comment as done.
Closed by commit rL282135: Fix parsing expressions to evaluate with spaces and optional args (MI) (authored by ki.stfu).

Changed prior to commit:
  https://reviews.llvm.org/D24202?vs=72136&id=72137#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24202

Files:
  lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
  lldb/trunk/tools/lldb-mi/MICmdArgValOptionLong.cpp

Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
@@ -61,7 +61,7 @@
         self.expect("\^done,value=\"30\"")
         self.runCmd("-var-update --all-values var2")
         # self.expect("\^done,changelist=\[\{name=\"var2\",value=\"30\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
-        # #FIXME -var-update doesn't work
+        # FIXME -var-update doesn't work
         self.runCmd("-var-delete var2")
         self.expect("\^done")
         self.runCmd("-var-create var2 * g_MyVar")
@@ -84,7 +84,7 @@
         self.expect("\^done,value=\"3\"")
         self.runCmd("-var-update --all-values var3")
         # self.expect("\^done,changelist=\[\{name=\"var3\",value=\"3\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
-        # #FIXME -var-update doesn't work
+        # FIXME -var-update doesn't work
         self.runCmd("-var-delete var3")
         self.expect("\^done")
         self.runCmd("-var-create var3 * s_MyVar")
@@ -107,7 +107,7 @@
         self.expect("\^done,value=\"2\"")
         self.runCmd("-var-update --all-values var4")
         # self.expect("\^done,changelist=\[\{name=\"var4\",value=\"2\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
-        # #FIXME -var-update doesn't work
+        # FIXME -var-update doesn't work
         self.runCmd("-var-delete var4")
         self.expect("\^done")
         self.runCmd("-var-create var4 * b")
@@ -148,6 +148,13 @@
         self.expect(
             "\^done,numchild=\"1\",children=\[child=\{name=\"var6\.\*\$[0-9]+\",exp=\"\*\$[0-9]+\",numchild=\"0\",type=\"const char\",thread-id=\"4294967295\",value=\"47 '/'\",has_more=\"0\"\}\],has_more=\"0\"")
 
+        # Print an expression with spaces and optional arguments
+        self.runCmd("-data-evaluate-expression \"a + b\"")
+        self.expect("\^done,value=\"12\"")
+        self.runCmd("-var-create var7 * \"a + b\" --thread 1 --frame 0")
+        self.expect(
+            "\^done,name=\"var7\",numchild=\"0\",value=\"12\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
+
     @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
     @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread races
     @skipIfLinux  # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
@@ -315,12 +322,14 @@
         # Test that -var-list-children lists all children with their values
         # (and that from and to are optional)
         self.runCmd("-var-list-children --all-values var_complx")
-        self.expect("\^done,numchild=\"3\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",value=\"3\",has_more=\"0\"\},child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\},child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type \*\",thread-id=\"1\",value=\"0x[0-9a-f]+\",has_more=\"0\"\}\],has_more=\"0\"")
+        self.expect(
+            "\^done,numchild=\"3\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",value=\"3\",has_more=\"0\"\},child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\},child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type \*\",thread-id=\"1\",value=\"0x[0-9a-f]+\",has_more=\"0\"\}\],has_more=\"0\"")
         self.runCmd("-var-list-children --simple-values var_complx_array")
         self.expect(
             "\^done,numchild=\"2\",children=\[child=\{name=\"var_complx_array\.\[0\]\",exp=\"\[0\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\},child=\{name=\"var_complx_array\.\[1\]\",exp=\"\[1\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
         self.runCmd("-var-list-children 0 var_pcomplx")
-        self.expect("\^done,numchild=\"2\",children=\[child=\{name=\"var_pcomplx\.complex_type\",exp=\"complex_type\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\},child={name=\"var_pcomplx\.complx\",exp=\"complx\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
+        self.expect(
+            "\^done,numchild=\"2\",children=\[child=\{name=\"var_pcomplx\.complex_type\",exp=\"complex_type\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\},child={name=\"var_pcomplx\.complx\",exp=\"complx\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
 
         # Test that -var-list-children lists children without values
         self.runCmd("-var-list-children 0 var_complx 0 1")
Index: lldb/trunk/tools/lldb-mi/MICmdArgValOptionLong.cpp
===================================================================
--- lldb/trunk/tools/lldb-mi/MICmdArgValOptionLong.cpp
+++ lldb/trunk/tools/lldb-mi/MICmdArgValOptionLong.cpp
@@ -184,16 +184,8 @@
 //--
 bool CMICmdArgValOptionLong::ExtractExpectedOptions(CMICmdArgContext &vrwTxt,
                                                     const MIuint nArgIndex) {
-  CMIUtilString::VecString_t vecOptions;
-  MIuint nOptionsPresent = 0;
-  if ((m_eExpectingOptionType != eArgValType_StringQuoted) &&
-      (m_eExpectingOptionType != eArgValType_StringQuotedNumber) &&
-      (m_eExpectingOptionType != eArgValType_StringQuotedNumberPath))
-    nOptionsPresent = vrwTxt.GetArgsLeftToParse().Split(" ", vecOptions);
-  else
-    nOptionsPresent =
-        vrwTxt.GetArgsLeftToParse().SplitConsiderQuotes(" ", vecOptions);
-  if (nOptionsPresent == 0)
+  CMIUtilString::VecString_t vecOptions = vrwTxt.GetArgs();
+  if (vecOptions.size() == 0)
     return MIstatus::failure;
 
   MIuint nArgIndexCnt = 0;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24202.72137.patch
Type: text/x-patch
Size: 6140 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160922/3a3f8af8/attachment-0001.bin>


More information about the lldb-commits mailing list